nl_tokens: Initiates the audio file
pl_tokens: function ( win , lose , args ) { var id = args [ 0 ] ; var srcUri = processUri ( args [ 1 ] ) ; var createAudioNode = ! ! args [ 2 ] ; var thisM = Media . get ( id ) ; Media . prototype . node = null ; var prefix = args [ 1 ] . split ( ':' ) . shift ( ) ; var extension = srcUri . extension ; if ( thisM . node === null ) { if ( SUPPORTED_EXTENSIONS . indexOf ( extension ) === - 1 && SUPPORTED_PREFIXES . indexOf ( prefix ) === - 1 ) { if ( lose ) { lose ( { code : MediaError . MEDIA_ERR_ABORTED } ) ; } return false ; // unable to create } // Don't create Audio object in case of record mode if ( createAudioNode === true ) { thisM . node = new Audio ( ) ; thisM . node . msAudioCategory = "BackgroundCapableMedia" ; thisM . node . src = srcUri . absoluteCanonicalUri ; thisM . node . onloadstart = function ( ) { Media . onStatus ( id , Media . MEDIA_STATE , Media . MEDIA_STARTING ) ; } ; thisM . node . ontimeupdate = function ( e ) { Media . onStatus ( id , Media . MEDIA_POSITION , e . target . currentTime ) ; } ; thisM . node . onplaying = function ( ) { Media . onStatus ( id , Media . MEDIA_STATE , Media . MEDIA_RUNNING ) ; } ; thisM . node . ondurationchange = function ( e ) { Media . onStatus ( id , Media . MEDIA_DURATION , e . <mask> . duration || - 1 ) ; } ; thisM . node . onerror = function ( e ) { // Due to media.spec.15 It should return MediaError for bad filename var err = e . target . error . code === MediaError . MEDIA_ERR_SRC_NOT_SUPPORTED ? { code : MediaError . MEDIA_ERR_ABORTED } : e . target . error ; Media . onStatus ( id , Media . MEDIA_ERROR , err ) ; } ; thisM . node . onended = function ( ) { Media . onStatus ( id , Media . MEDIA_STATE , Media . MEDIA_STOPPED ) ; } ; } } return true ; // successfully created }