Search completed in 1.11 seconds.
MediaRecorder.ondataavailable - Web APIs
the mediarecorder.
ondataavailable event handler (part of the mediastream recording api) handles the dataavailable event, letting you run code in response to blob data being made available for use.
...this occurs in four situations: when the media stream ends, any media data not already delivered to your
ondataavailable handler is passed in a single blob.
... syntax mediarecorder.
ondataavailable = function(event) { ...
...And 2 more matches
RTCPeerConnection.ondatachannel - Web APIs
the rtcpeerconnection.
ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection.
... syntax rtcpeerconnection.
ondatachannel = function; value set this property to be a function you provide which receives as input a single parameter: an rtcdatachannelevent which provides in its channel property the rtcdatachannel which has been created.
... example pc.
ondatachannel = function(ev) { console.log('data channel is created!'); ev.channel.onopen = function() { console.log('data channel is open and ready to be used.'); }; }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.
ondatachannel' in that specification.
PRSocketOptionData
syntax #include <prio.h> typedef struct prsocketopti
ondata { prsockoption option; union { pruintn ip_ttl; pruintn mcast_ttl; pruintn tos; prbool non_blocking; prbool reuse_addr; prbool keep_alive; prbool mcast_loopback; prbool no_delay; prsize max_segment; prsize recv_buffer_size; prsize send_buffer_size; prlinger linger; prmcastrequest add_member; prmcastrequest drop_member; prnetaddr mcast_if; } value; } prsocketopti
ondata; fields the structure has the following fields: ip_ttl ip time-to-live.
... description prsocketopti
ondata is a name-value pair for a socket option.
nsIDeviceMotionData
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named nsidevicemoti
ondata prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3).
nsIFaviconService
to use this service, use: var faviconservice = components.classes["@mozilla.org/browser/favicon-service;1"] .getservice(components.interfaces.nsifaviconservice); method overview void addfailedfavicon(in nsiuri afaviconuri); void expireallfavicons(); void getfavic
ondata(in nsiuri afaviconuri, out autf8string amimetype, [optional] out unsigned long adatalen, [array,retval,size_is(adatalen)] out octet adata); obsolete since gecko 22.0 astring getfavic
ondataasdataurl(in nsiuri afaviconuri); obsolete since gecko 22.0 nsiuri getfaviconforpage(in nsiuri apageuri); obsolete since gecko 22.0 nsiuri getfaviconimageforpage(in nsiuri apageuri); ...
...obsolete since gecko 22.0 nsiuri getfaviconlinkforicon(in nsiuri afaviconuri); boolean isfailedfavicon(in nsiuri afaviconuri); void removefailedfavicon(in nsiuri afaviconuri); void setandloadfaviconforpage(in nsiuri apageuri, in nsiuri afaviconuri, in boolean aforcereload, in unsigned long afaviconloadtype, [optional] in nsifavic
ondatacallback acallback); obsolete since gecko 22.0 void setfavic
ondata(in nsiuri afaviconuri, [const,array,size_is(adatalen)] in octet adata, in unsigned long adatalen, in autf8string amimetype, in prtime aexpiration); obsolete since gecko 22.0 void setfavic
ondatafromdataurl(in nsiuri afaviconuri, in astring adataurl, in prtime aexpiration); obsolete since gecko 22.0 void setfaviconurlforpage(in nsiuri apa...
... getfavic
ondata() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was removed in gecko 22.0.
...And 15 more matches
mozIAsyncFavicons
method overview void getfaviconurlforpage(in nsiuri apageuri, in nsifavic
ondatacallback acallback); void getfavic
ondataforpage(in nsiuri apageuri, in nsifavic
ondatacallback acallback); void setandfetchfaviconforpage(in nsiuri apageuri, in nsiuri afaviconuri, in boolean aforcereload, in unsigned long afaviconloadtype, [optional] in nsifavic
ondatacallback acallback); void replacefavic
ondata(in nsiuri afaviconuri, [const,array,si...
...ze_is(adatalen)] in octet adata, in unsigned long adatalen, in autf8string amimetype, [optional] in prtime aexpiration); void replacefavic
ondatafromdataurl(in nsiuri afaviconuri, in astring adataurl, [optional] in prtime aexpiration); methods getfaviconurlforpage() retrieve the url of the favicon for the given page.
... void getfaviconurlforpage( in nsiuri apageuri, in nsifavic
ondatacallback acallback ); parameters apageuri uri of the page whose favicon's url we're looking up.
...And 8 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
to trigger the alert() in the listener and pass the data from the web page, write code such as this in the web page: var element = document.createelement("myextensi
ondataelement"); element.setattribute("attribute1", "foobar"); element.setattribute("attribute2", "hello world"); document.documentelement.appendchild(element); var evt = document.createevent("events"); evt.initevent("myextensionevent", true, false); element.dispatchevent(evt); this code creates an arbitrary element -- <myextensi
ondataelement/> -- and inserts it into the web page's dom.
... (to better ensure others do not also implement the same event with a different meaning, one might either attach a namespace to <myextensi
ondataelement/> and check on the event handler for the correct namespaceuri property, or as per the dom specification, use initevent() with an event name that is itself namespaced (xml name characters only): "it is also strongly recommended that third parties adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events.") in the case whe...
... document.addeventlistener("message", function(e) { yourfunction(e); }, false, true); sending data from chrome to unprivileged document to "answer" the web page (e.g., return code), your extension can set an attribute or attach child elements on the event target element (<myextensi
ondataelement/> in this example).
... in the web page: document.addeventlistener("myanswerevent",function(e) { extensionanswer(e); },false); var element; function callextension() { var element = document.createelement("myextensi
ondataelement"); element.setattribute("attribute1", "foobar"); element.setattribute("attribute2", "hello world"); document.documentelement.appendchild(element); var evt = document.createevent("events"); evt.initevent("myextensionevent", true, false); element.dispatchevent(evt); } function extensionanswer(evtanswer) { alert(element.getattribute("attribute3") + " " + evtanswer.targe...
Necko walkthrough
has onstartrequest, onstoprequest,
ondataavailable, the three functions in which channel responses are received asynchronously.
... receive response get a callback to each of these: nsistreamlistener::onstartrequest (header info) nsistreamlistener::
ondataavailable (data in single or multiple chunks) nsistreamlistener::onstoprequest (no more data from http) this all happens on the main thread, in a non-blocking fashion: make your request on the main thread, then carry on and get the async response later, also on the main thread.
... there is an option to receive
ondataavailable specifically on a non-main thread, but all other calls happen on the main thread.
... these functions call nsistreamlistener::onstartrequest, nsistreamlistener::
ondataavailable and nsistreamlistener::onstoprequest respectively.
Index
540 nsidevicemoti
ondata acceleration, dom, interfaces, interfaces:scriptable, mobile, orientation, xpcom, xpcom interface reference the values of x, y, and z can range from -1 to 1, where 0 means the device is balanced on that axis.
... 601 nsifavic
ondatacallback interfaces, interfaces:scriptable, places, xpcom, xpcom api reference, xpcom interface reference called when the required favicon's information is available.
... 867 nsirequest interfaces, interfaces:scriptable, xpcom, xpcom interface reference for example nsichannel typically passes itself as the nsirequest argument to the nsistreamlistener on each onstartrequest,
ondataavaliable, and onstoprequest invocation.
...so, in all the three methods -
ondataavailable(), nsirequestobserver.onstartrequest() and nsirequestobserver.onstoprequest() have to be implemented.
nsIStreamListener
so, in all the three methods -
ondataavailable(), nsirequestobserver.onstartrequest() and nsirequestobserver.onstoprequest() have to be implemented.
... method overview void
ondataavailable(in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount); methods
ondataavailable() this method is called when the next chunk of data for the ongoing request may be read without blocking the calling thread.
...void
ondataavailable( in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount ); parameters arequest an nsirequest indicating the source of the data.
...aoffset number of bytes that were sent in previous
ondataavailable() calls for this request.
PR_SetSocketOption
syntax #include <prio.h> prstatus pr_setsocketoption( prfiledesc *fd, prsocketopti
ondata *data); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket whose options are to be set.
... data a pointer to a structure of type prsocketopti
ondata specifying the options to set.
... description on input, the caller must set both the option and value fields of the prsocketopti
ondata object pointed to by the data parameter.
Necko Architecture
the
ondataavailable() notification provides a chance for the nsistreamlistener to actually retrieve data that the channel has acquired.
... one of the arguments to the
ondataavailable() notification is an nsiinputstream (which can be considered the underlying data).
...when you receive the
ondataavailable() callback, you are handed an nsiinputsteam which you can read the data from (you will more than likely need to be able to handle multiple
ondataavailable() callbacks, buffering the data you receive as necessary).
XPCOM Stream Guide
from the nsistreamlistener interface, the .
ondataavailable(request, context, inputstream, offset, count) method gives you the input stream and the number of bytes available.
...a request will have one .onstartrequest(request, context) call, followed by at least one .
ondataavailable(...) call, followed by one .onstoprequest(request, context) call.
... the context argument will be something passed from whoever invokes the request to the .onstartrequest(), .
ondataavailable(), and .onstoprequest() methods of the listener.
imgIDecoderObserver
method overview void
ondataavailable(in imgirequest arequest, in boolean acurrentframe, [const] in nsintrect arect); native code only!
...quest(in imgirequest arequest); void onstopcontainer(in imgirequest arequest, in imgicontainer acontainer); void onstopdecode(in imgirequest arequest, in nsresult status, in wstring statusarg); void onstopframe(in imgirequest arequest, in unsigned long aframe); void onstoprequest(in imgirequest arequest, in boolean aislastpart); methods native code only!
ondataavailable decode notification.
...void
ondataavailable( in imgirequest arequest, in boolean acurrentframe, [const] in nsintrect arect ); parameters arequest the request on which data is available, or null if being called for an imgidecoder object.
nsIDeviceMotionListener
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void onmotionchange(in nsidevicemoti
ondata amoti
ondata); methods onmotionchange() called when new orientation or acceleration data is available.
... void onmotionchange( in nsidevicemoti
ondata amoti
ondata ); parameters aacceleration the nsidevicemoti
ondata object describing updated motion information.
... see also mozorientation nsidomorientationevent nsidevicemotion nsidevicemoti
ondata ...
nsIStreamConverter
you can supply data directly to the converter by calling it's nsistreamlistener.
ondataavailable() method.
... it will then convert that data from type x to your desired output type and return converted data to you via the nsistreamlistener you passed in by calling its nsistreamlistener.
ondataavailable() method.
...o=to_mime_type method overview void asyncconvertdata(in string afromtype, in string atotype, in nsistreamlistener alistener, in nsisupports actxt); nsiinputstream convert(in nsiinputstream afromstream, in string afromtype, in string atotype, in nsisupports actxt); methods asyncconvertdata() asynchronous version: converts data arriving via the converter's nsistreamlistener.
ondataavailable() method from one type to another, pushing the converted data out to the caller via alistener::
ondataavailable().
nsITraceableChannel
ondataavailable: data is arriving on the http channel.
...nsebody; // we'll set this to the this.responsestatuscode; this.deferreddone = { promise: null, resolve: null, reject: null }; this.deferreddone.promise = new promise(function(resolve, reject) { this.resolve = resolve; this.reject = reject; }.bind(this.deferreddone)); object.freeze(this.deferreddone); this.promisedone = this.deferreddone.promise; } tracinglistener.prototype = {
ondataavailable: function(arequest, acontext, ainputstream, aoffset, acount) { var istream = new binaryinputstream(ainputstream) // binaryainputstream var sstream = new storagestream(8192, acount, null); // storagestream // not sure why its 8192 but thats how eveyrone is doing it, we should ask why var ostream = new binaryoutputstream(sstream.getoutputstream(0)); // binaryoutputstream // copy r...
... var data = istream.readbytes(acount); this.receivedchunks.push(data); ostream.writebytes(data, acount); this.originallistener.
ondataavailable(arequest, acontext, sstream.newinputstream(0), aoffset, acount); }, onstartrequest: function(arequest, acontext) { this.originallistener.onstartrequest(arequest, acontext); }, onstoprequest: function(arequest, acontext, astatuscode) { this.responsebody = this.receivedchunks.join(""); delete this.receivedchunks; this.responsestatus = astatuscode; this.originallistener.onstoprequest(arequest, acontext, astatuscode); this.deferreddone.resolve(); }, queryinterface: function(aiid) { if (aiid.equals(ci.nsistreamlistener) || aiid.equals(ci.nsisupports)) { return this; } throw cr.ns_nointerface; } }...
nsIWebappsSupport
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void installapplication(in wstring title, in wstring uri, in wstring iconuri, in wstring ic
ondata); boolean isapplicationinstalled(in wstring uri); methods installapplication() this method installs a web application.
... void installapplication( in wstring title, in wstring uri, in wstring iconuri, in wstring ic
ondata ); parameters title the user-friendly name of the application.
...ic
ondata a base64 encoded representation of the application's icon.
MediaRecorder: dataavailable event - Web APIs
bubbles no cancelable no interface blobevent event handler property
ondataavailable for details of the all the possible reasons this event may raise, see the documentation for the event handler property:
ondataavailable.
... the same, but using the
ondataavailable event handler property: ...
... var chunks = []; mediarecorder.onstop = function(e) { console.log("data available after mediarecorder.stop() called."); var audio = document.createelement('audio'); audio.controls = true; var blob = new blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); var audiourl = window.url.createobjecturl(blob); audio.src = audiourl; console.log("recorder stopped"); } mediarecorder.
ondataavailable = function(e) { chunks.push(e.data); } ...
MerchantValidationEvent.complete() - Web APIs
syntax merchantvalidationevent.complete(validati
ondata); merchantvalidationevent.complete(merchantsessionpromise); parameters validati
ondata or merchantsessionpromise an object containing the data needed to complete the merchant validation process, or a promise which resolves to the validation data.
... example in this example, we see the client-side code needed to support merchant validation for a payment request called payrequest: payrequest.onmerchantvalidation = event => { const validati
ondatapromise = getvalidati
ondata(event.validationurl); event.complete(validati
ondatapromise); } function getvalidati
ondata(url) { /* ...retrieve the validation data from the url...
...the event handler calls a function, getvalidati
ondata(), which retrieves the data from the validation url, then passes that data (or a promise to deliver the data) into complete().
Creating Sandboxed HTTP Connections
ondataavailable - new data is available.
...ewchannelfromuri(uri); // get an listener var listener = new streamlistener(callbackfunc); gchannel.notificationcallbacks = listener; gchannel.asyncopen(listener, null); function streamlistener(acallbackfunc) { this.mcallbackfunc = acallbackfunc; } streamlistener.prototype = { mdata: "", // nsistreamlistener onstartrequest: function (arequest, acontext) { this.mdata = ""; },
ondataavailable: function (arequest, acontext, astream, asourceoffset, alength) { var scriptableinputstream = components.classes["@mozilla.org/scriptableinputstream;1"] .createinstance(components.interfaces.nsiscriptableinputstream); scriptableinputstream.init(astream); this.mdata += scriptableinputstream.read(alength); }, onstoprequest: function (arequest, acontext, asta...
HTML parser threading
the nsistreamlistener methods (onstartrequest,
ondataavailable and onstoprequest) are called on the main thread.
...
ondataavailable and onstoprequest on the main thread post runnables on to the parser thread.
PRSockOption
enumeration type used in the option field of prsocketopti
ondata to form the name portion of a name-value pair.
...the option field of prsocketopti
ondata should be set to an enumerator of type prsockoption.
PR_GetSocketOption
syntax #include <prio.h> prstatus pr_getsocketoption( prfiledesc *fd, prsocketopti
ondata *data); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket whose options are to be retrieved.
... data a pointer to a structure of type prsocketopti
ondata.
nsIMsgMessageService
the consumer has to be a stream listener and in your listener's
ondataavailable method, you can write out the stream data to a local file or concatenate it to a string.
...the consumer has to be a stream listener and in your listener's
ondataavailable method, you can write out the stream data to a local file or concatenate it to a string.
nsIRequest
inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) for example nsichannel typically passes itself as the nsirequest argument to the nsistreamlistener on each onstartrequest,
ondataavaliable, and onstoprequest invocation.
... requests that use nsistreamlistener must not call
ondataavailable anymore after cancel has been called.
nsIScriptableInputStream
"@mozilla.org/scriptableinputstream;1", "nsiscriptableinputstream", "init"); let entry = this.getentry(name); let stream = new scriptableinputstream(this.getinputstream(name)); try { // use readbytes to get binary data, read to read a (null-terminated) string let contents = stream.readbytes(entry.realsize); } finally { stream.close(); } example usage in
ondataavailable remember: the nsiscriptableinputstream has a contract where `init` should only be called once, and should always be closed.
... var scriptableinputstream = cc("@mozilla.org/scriptableinputstream;1", "nsiscriptableinputstream", "init"); var blah = { data: '', onstartrequest: function (arequest, acontext) { this.data = ''; },
ondataavailable: function(request, context, inputstream, offset, count) { var scriptstream = new scriptableinputstream(inputstream); this.data += scriptstream.read(count); scriptstream.close(); } }; see also nsscriptableinputstream nsiinputstream ...
XPCOM Interface Reference
nsidomstoragemanagernsidomstoragewindownsidomuserdatahandlernsidomwindownsidomwindow2nsidomwindowinternalnsidomwindowutilsnsidomxpathevaluatornsidomxpathexceptionnsidomxpathexpressionnsidomxpathresultnsidomxulcontrolelementnsidomxulelementnsidomxullabeledcontrolelementnsidomxulselectcontrolelementnsidomxulselectcontrolitemelementnsidatasignatureverifiernsidebugnsidebug2nsidevicemotionnsidevicemoti
ondatansidevicemotionlistenernsidialogcreatornsidialogparamblocknsidictionarynsidirindexnsidirindexlistenernsidirindexparsernsidirectoryenumeratornsidirectoryiteratornsidirectoryservicensidirectoryserviceprovidernsidirectoryserviceprovider2nsidiskcachestreaminternalnsidispatchsupportnsidocshellnsidocumentloadernsidownloadnsidownloadhistorynsidownloadmanagernsidownloadmanageruinsidownloadobservernsidownl...
...sieditordocshellnsieditorimesupportnsieditorloggingnsieditormailsupportnsieditorobservernsieditorspellchecknsieffectivetldservicensienumeratornsienvironmentnsierrorservicensieventlistenerinfonsieventlistenerservicensieventsourcensieventtargetnsiexceptionnsiextensionmanagernsiexternalhelperappservicensiexternalprotocolservicensiexternalurlhandlerservicensiftpchannelnsiftpeventsinknsifactorynsifavic
ondatacallbacknsifaviconservicensifeednsifeedcontainernsifeedelementbasensifeedentrynsifeedgeneratornsifeedpersonnsifeedprocessornsifeedprogresslistenernsifeedresultnsifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotocolhandlernsifilespecnsifilestreamsnsifileurlnsifileutilitiesnsifileviewnsifocusmanagernsiformhistory2nsiframeloadernsiframeloadero...
Index - Web APIs
2388 mediarecorder.
ondataavailable api, audio, media capture, media recorder api, mediarecorder, mediastream recording api, property, reference, video,
ondataavailable the mediarecorder.
ondataavailable event handler (part of the mediastream recording api) handles the dataavailable event, letting you run code in response to blob data being made available for use.
... 3435 rtcpeerconnection.
ondatachannel event handler, experimental, property, rtcpeerconnection, reference, webrtc,
ondatachannel the rtcpeerconnection.
ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection.
MediaRecorder - Web APIs
event handlers mediarecorder.
ondataavailable called to handle the dataavailable event, which is periodically triggered each time timeslice milliseconds of media have been recorded (or when the entire media has been recorded, if timeslice wasn't specified).
...o.controls = true; var blob = new blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); chunks = []; var audiourl = url.createobjecturl(blob); audio.src = audiourl; console.log("recorder stopped"); deletebutton.onclick = function(e) { evttgt = e.target; evttgt.parentnode.parentnode.removechild(evttgt.parentnode); } } mediarecorder.
ondataavailable = function(e) { chunks.push(e.data); } }) .catch(function(err) { console.log('the following error occurred: ' + err); }) } this code sample is inspired by the web dictaphone demo.
Recording a media element - Web APIs
starting media recording the startrecording() function handles starting the recording process: function startrecording(stream, lengthinms) { let recorder = new mediarecorder(stream); let data = []; recorder.
ondataavailable = event => data.push(event.data); recorder.start(); log(recorder.state + " for " + (lengthinms/1000) + " seconds..."); let stopped = new promise((resolve, reject) => { recorder.onstop = resolve; recorder.onerror = event => reject(event.name); }); let recorded = wait(lengthinms).then( () => recorder.state == "recording" && recorder.stop() ); return promise.all...
... line 3 creates an empty array, data, which will be used to hold the blobs of media data provided to our
ondataavailable event handler.
MediaStream Recording API - Web APIs
set mediarecorder.
ondataavailable to an event handler for the dataavailable event; this will be called whenever data is available for you.
...var stream = canvas.capturestream(25); var recordedchunks = []; console.log(stream); var options = { mimetype: "video/webm; codecs=vp9" }; mediarecorder = new mediarecorder(stream, options); mediarecorder.
ondataavailable = handledataavailable; mediarecorder.start(); function handledataavailable(event) { console.log("data-available"); if (event.data.size > 0) { recordedchunks.push(event.data); console.log(recordedchunks); download(); } else { // ...
RTCPeerConnection.createDataChannel() - Web APIs
negotiated optional by default (false), data channels are negotiated in-band, where one side calls createdatachannel, and the other side listens to the rtcdatachannelevent event using the
ondatachannel eventhandler .
... // offerer side var pc = new rtcpeerconnection(options); var channel = pc.createdatachannel("chat"); channel.onopen = function(event) { channel.send('hi you!'); } channel.onmessage = function(event) { console.log(event.data); } // answerer side var pc = new rtcpeerconnection(options); pc.
ondatachannel = function(event) { var channel = event.channel; channel.onopen = function(event) { channel.send('hi back!'); } channel.onmessage = function(event) { console.log(event.data); } } alternatively, more symmetrical out-of-band negotiation can be used, using an agreed-upon id (0 here): // both sides var pc = new rtcpeerconnection(options); var channel = pc.createdatachan...
RTCPeerConnection: datachannel event - Web APIs
bubbles no cancelable no interface rtcdatachannelevent event handler property
ondatachannel examples this example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly added rtcdatachannel and by adding event handlers for the events that occur on that channel.
... this same code can also instead use the rtcpeerconnection interface's
ondatachannel event handler property, like this: pc.
ondatachannel = ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'datachannel' in that speci...
RTCPeerConnection - Web APIs
this happens whenever the aggregate state of the connection changes.
ondatachannel the rtcpeerconnection.
ondatachannel property is an eventhandler which specifies a function which is called when the datachannel event occurs on an rtcpeerconnection.
... also available through the
ondatachannel event handler property.
Index - Archive of obsolete content
the final goal is to find the correct stream listener to pump the data into when necko calls
ondataavailable (e.g., we may find the html parser as the stream listener to give the data to).
Error codes returned by Mozilla APIs
ns_error_offline (0x804b0010) ns_error_no_content (0x804b0011) returned from nsichannel.asyncopen() to indicate that
ondataavailable will not be called because there is no content available.
Implementing Download Resuming
(it is possible to pass an empty string as the id; however, this means that you have no assurance that the file remained unchanged) now, you can open the channel as usual (using nsichannel.asyncopen() in the common case) and write to the file in the
ondataavailable notifications.
Introduction to Layout in Mozilla
a parser, returned as nsistreamlistener back to the docshell creates a content sink, which is linked to the parser and the document creates a documentviewerimpl object, which is returned as nsicontentviewer back to the docshell documentviewerimpl creates pres context and pres shell content model construction content arrives from network via nsistreamlistener::
ondataavailable parser tokenizes & processes content; invokes methods on nsicontentsink with parser node objects some buffering and fixup occurs here opencontainer, closecontainer, addleaf content sink creates and attaches content nodes using nsicontent interface content sink maintains stack of “live” elements more buffering and fixup occurs here inse...
I/O Types
file info types prfileinfo prfileinfo64 prfiletype network address types prnetaddr pripv6addr types used with socket options functions prsocketopti
ondata prsockoption prlinger prmcastrequest type used with memory-mapped i/o prfilemap offset interpretation for seek functions prseekwhence ...
Necko Interfaces Overview
http) maps uri string to nsiuri instance via newuri method creates nsichannel instance from nsiuri instance via newchannel method nsistreamlistener : nsirequestobserver implemented by the consumer of a nsichannel instance passed to nsichannel::asyncopen method nsirequestobserver::onstartrequest - notifies start of async download nsistreamlistener::
ondataavailable - notifies presence of downloaded data nsirequestobserver::onstoprequest - notifies completion of async download, possibly w/ error nsiloadgroup : nsirequest attribute of a nsirequest channel impl adds itself to its load group during invocation of asyncopen channel impl removes itself from its load group when download completes load groups in gecko own all channels used to load a...
imgILoader
this must already be opened before this method is called, and there must have been no
ondataavailable calls for it yet.
nsICachingChannel
if this flag has been set, and the request can be satisfied via the cache, then the
ondataavailable events will be skipped.
nsIDeviceMotion
see also mozorientation nsidomorientationevent nsidevicemoti
ondata nsidevicemotionlistener ...
nsIProtocolHandler
uri_does_not_return_data 1<<11 channels using this protocol never call
ondataavailable() on the listener passed to asyncopen(), and therefore do not return any usable data.
nsIResumableChannel
in both of these cases, no
ondataavailable will be called, and onstoprequest will immediately follow with the same status code.
XPCOM Interface Reference by grouping
rkerglobalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree nsitreeboxobject nsitreecolumn nsitreecolumns nsitreecontentview nsitreeselection nsitreeview xform nsixformsmodelelement nsixformsnsinstanceelement nsixformsnsmodelelement xmlhttprequest nsixmlhttprequesteventtarget favicon nsifavic
ondatacallback nsifaviconservice frame nsichromeframemessagemanager nsiframeloader nsiframeloaderowner nsiframemessagelistener nsiframemessagemanager interface nsijsxmlhttprequest jetpack nsijetpack nsijetpackservice offlinestorage nsiapplicationcache nsiapplicationcachechannel nsiapplicationcachecontainer nsiapplication...
AudioContext.createMediaStreamDestination() - Web APIs
er(dest.stream); osc.connect(dest); b.addeventlistener("click", function(e) { if (!clicked) { mediarecorder.start(); osc.start(0); e.target.innerhtml = "stop recording"; clicked = true; } else { mediarecorder.stop(); osc.stop(0); e.target.disabled = true; } }); mediarecorder.
ondataavailable = function(evt) { // push each chunk (blobs) in an array chunks.push(evt.data); }; mediarecorder.onstop = function(evt) { // make blob out of our blobs, and open it.
MediaRecorder.onerror - Web APIs
function recordstream(stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { return err.name; /* return the error name */ } recorder.
ondataavailable = function(event) { bufferlist.push(event.data); }; recorder.onerror = function(event) { let error = event.error; switch(error.name) { case invalidstateerror: shownotification("you can't record the video right " + "now.
MediaRecorder.onstop - Web APIs
mediarecorder.onstop = function(e) { console.log("data available after mediarecorder.stop() called."); var audio = document.createelement('audio'); audio.controls = true; var blob = new blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); var audiourl = window.url.createobjecturl(blob); audio.src = audiourl; console.log("recorder stopped"); } mediarecorder.
ondataavailable = function(e) { chunks.push(e.data); } ...
MediaRecorder.requestData() - Web APIs
capturemedia.onclick = function() { mediarecorder.requestdata(); // makes snapshot available of data so far //
ondataavailable fires, then capturing continues // in new blob } ...
MediaRecorderErrorEvent.error - Web APIs
function recordstream(stream) { let recorder = null; let bufferlist = []; try { recorder = new mediarecorder(stream); } catch(err) { /* exception while trying to create the recorder; handle that */ } recorder.
ondataavailable = function(event) { bufferlist.push(event.data); }; recorder.onerror = function(event) { let error = event.error; }; recorder.start(100); /* 100ms time slices per buffer */ return recorder; } specifications specification status comment mediastream recordingthe definition of 'mediarecordererrorevent.error' in that specification.
Using the MediaStream Recording API - Web APIs
we register an event handler to do this using mediarecorder.
ondataavailable: let chunks = []; mediarecorder.
ondataavailable = function(e) { chunks.push(e.data); } note: the browser will fire dataavailable events as needed, but if you want to intervene you can also include a timeslice when invoking the start() method — for example start(10000) — to control this interval, or call mediarecorder.requestdata() to trigger an event when you need it.
Payment processing concepts - Web APIs
paymentrequest.onmerchantvalidation = function(event) { event.complete(fetchvalidati
ondata(event.validationurl)); } in this example, fetchvalidati
ondata() is a function which loads the payment handler specific identifying information from the address given by validationurl.
RTCDataChannelEvent.channel - Web APIs
pc.
ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent.channel' i...
RTCDataChannelEvent - Web APIs
pc.
ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } see a simple rtcdatachannel sample for another, more complete, example of how to use data channels.
A simple RTCDataChannel sample - Web APIs
set up the remote peer remoteconnection = new rtcpeerconnection(); remoteconnection.
ondatachannel = receivechannelcallback; the remote end is set up similarly, except that we don't need to explicitly create an rtcdatachannel ourselves, since we're going to be connected through the channel established above.
Audio and Video Delivery - Developer guides
the main mechanism is outlined below: navigator.mediadevices.getusermedia({audio:true}) .then(function onsuccess(stream) { var recorder = new mediarecorder(stream); var data = []; recorder.
ondataavailable = function(e) { data.push(e.data); }; recorder.start(); recorder.onerror = function(e) { throw e.error || new error(e.name); // e.name is ff non-spec } recorder.onstop = function(e) { var audio = document.createelement('audio'); audio.src = window.url.createobjecturl(new blob(data)); } settimeout(function() { rec.stop(); }, 50...