mmir.env.media.Html5AudioOutput
        Audio handling for web / HTML5 environment
    
    
    
    
    
    
Requires
- module:window.URL
 
Members
- 
    
protected,readonly_pluginName
 - 
    
    
- Default Value:
 - "webAudio"
 
 - 
    
    Media error (codes): the corresponding code is their
index.Code 0 is an internal error code for unknown/unspecific error causes.
Codes 1 - 4 correspond to the HTML5 MediaError interface (which are the same as Cordova's Audio MediaError codes). The description texts are taken from the HTML5 documentation. 
Methods
- 
    
privatecreateDataUrl(blob, callback)
 - 
    
    HELPER for creating data-URL from binary data (blob)
Name Type Description blobBlob The audio data as blob callbackfunction callback that will be invoked with the data-URL: callback(dataUrl) - 
    
privatecreateError(code, errorEvent){Object}
 - 
    
    HELPER for creating error object that is returned in the failureCallbacks
Name Type Description codeNumber The error code: if in [1,4], the corresponding HTML5 MediaError information will be returned Otherwise an "error 0", i.e. internal/unknown error will be created errorEventEvent | Error the causing event- or error-object Returns:
Type Description Object the error object, which has 3 properties: code (Number): the error code message (String): the error name description (String): a descriptive text for the error  - 
    
privatecreateErrorWrapper(ctx, errorCallback){function}
 - 
    
    FACTORY for creating error-listeners (that trigger the failureCallback)
Name Type Description ctxObject optional the context for the errorCallback. IF omitted, the callback will be within the default (i.e. global) context. errorCallbackfunction optional the error callback. Is invoked with 2 arguments: errorCallback(error, event) where error has 3 properties: code (Number): the error code message (String): the error name description (String): a descriptive text for the error IF omitted, the error will be printed to the console. Returns:
Type Description function wrapper function that can be registered as event-listener (takes one argument: the event)  - 
    
getAudio()
 - 
    
    Get an audio object for the audio file specified by URL URL or by WAV data. NOTE that getWAVAsAudio may not be supported by all modules! Convenience function for
getURLAsAudioandgetWAVAsAudio: if first argument is a String, thengetURLAsAudiowill be invoked, otherwisegetWAVAsAudio(if the module supports this function). - 
    
getURLAsAudio(url, onPlayedCallback, failureCallback, onLoadedCallback){mmir.env.media.IAudio}
 - 
    
    Get an audio object for the audio file specified by URL. The audio object exports the following functions:
play() stop() release() enable() disable() setVolume(number) getDuration() isPaused() isEnabled()
NOTE: the audio object should only be used, after theonLoadedCallbackwas triggered.Name Type Description urlString onPlayedCallbackfunction optional OPTIONAL failureCallbackfunction optional OPTIONAL onLoadedCallbackfunction optional OPTIONAL Returns:
Type Description mmir.env.media.IAudio the audio  - 
    
getWAVAsAudio()
 - 
    
    
    
    
    
- See:
 - 
        
- mmir.MediaManager#getWAVAsAudio
 
 
 - 
    
privatehandlePlayPromise(p, audio, errorHandler){mmir.env.media.IAudio}
 - 
    
    HELPER for handling new play() promise mechanism: play may get rejected due to no user-interaction -> trigger 'errorplay' event on MediaManager
Name Type Description pPromise | void The promise returned by calling WebAudio.play() (or FALSY, if no promise was returned) audioIAudio The audio object for which play was invoked errorHandlerfunction The error handler/callback for the audio Returns:
Type Description mmir.env.media.IAudio the audio  - 
    
initialize()
 - 
    
    
    
    
    
 - 
    
play()
 - 
    
playURL()
 - 
    
    Play audio file from the specified URL.
 - 
    
playWAV()
 - 
    
    Play PCM audio data.
 - 
    
privatereleaseDataUrl(dataUrl)
 - 
    
    HELPER for releasing data-URL
Name Type Description dataUrlString The data URL for the audio blob