xhr.responseType="arraybuffer"

88 views
Skip to first unread message

Lee Goddard

unread,
Oct 7, 2012, 5:22:19 AM10/7/12
to mootool...@googlegroups.com
I'm making XHR requets with reponseType set to 'arraybuffer', so that I
can receive binary data to pass to a Web Audio API audio context's
decodeAudioData() method.

As far as I know, this cannot be done with MooTools as it stands,
because although I could sub-class Request and adjust the
onStateChange() and success(), access is required to the private XHR so
that the responseType can be set after the requested is open()ed.

Over-riding the send() method seems like a bad idea, as I'd have to keep
it updated with any change made to the core.

The only solution I can see is to expose the currently-private xhr
object, but I guess it is private for a reason.

Does anyone have any suggestions, please?

TIA
Lee

Barry van Oudtshoorn

unread,
Oct 7, 2012, 11:09:19 PM10/7/12
to mootool...@googlegroups.com
This sounds like it'd be something that could reasonably be exposed as
an option on the Request class, so my recommendation would be to alter
that class and send a pull request. No guarantee that it'll be accepted,
of course, but this is certainly the way that I'd want to interact with
this in MooTools. It's a pretty fundamental operation on XHR, to be
honest, so I think it's worthwhile.
--
Barry van Oudtshoorn
www.barryvan.com.au

Lee

unread,
Oct 8, 2012, 3:09:19 AM10/8/12
to mootool...@googlegroups.com
Thanks Barry.

Exciting. I've not tried this before, but I'm happy to do it (I've made
the mod already). Is there another list, or IRC, where I can ask
possibly stupid questions about the operation, if it is not
straight-forward?

TIA
Lee

Lee

unread,
Oct 8, 2012, 4:19:16 AM10/8/12
to mootool...@googlegroups.com
Pull request sent.

Until this code is merged, or something similar added, MooTools can not
be used with HTML5 Web Audio API, so I really hope we can get some
movement on this.

TIA
Lee


On 08/10/2012 05:09, Barry van Oudtshoorn wrote:
Reply all
Reply to author
Forward
0 new messages