From 86581b41630966e02d93bc37bc221c5fc55f5322 Mon Sep 17 00:00:00 2001 From: itozyun Date: Fri, 23 Oct 2015 23:16:06 +0900 Subject: [PATCH] Version 0.6.183, refactoring X.HTMLAudio. --- 0.6.x/js/01_core/14_XEvent.js | 4 +- 0.6.x/js/03_plugin/00_XPlugin.js | 2 + 0.6.x/js/06_net/01_XNetXHR.js | 57 ++++++------ 0.6.x/js/07_audio/01_XWebAudio.js | 14 ++- 0.6.x/js/07_audio/02_XHTMLAudio.js | 168 ++++++++++++++++++----------------- 0.6.x/js/07_audio/10_XAudioSprite.js | 11 ++- 6 files changed, 134 insertions(+), 122 deletions(-) diff --git a/0.6.x/js/01_core/14_XEvent.js b/0.6.x/js/01_core/14_XEvent.js index 0c52605..48f5b72 100644 --- a/0.6.x/js/01_core/14_XEvent.js +++ b/0.6.x/js/01_core/14_XEvent.js @@ -107,7 +107,7 @@ var // 内部イベント X_EVENT_MEDIA_ENDED = 46, X_EVENT_MEDIA_WAITING = 47, X_EVENT_MEDIA_SEEKING = 48, - X_EVENT_MEDIA_CAN_TOUCH_LOAD = 49, + X_EVENT_MEDIA_TOUCH_FOR_LOAD = 49, X_EVENT_NEED_AUTH = 50, @@ -223,7 +223,7 @@ X[ 'Event' ] = /** @lends X.Event */ 'MEDIA_ENDED' : X_EVENT_MEDIA_ENDED, 'MEDIA_WAITING' : X_EVENT_MEDIA_WAITING, 'MEDIA_SEEKING' : X_EVENT_MEDIA_SEEKING, - 'MEDIA_CAN_TOUCH_LOAD' : X_EVENT_MEDIA_CAN_TOUCH_LOAD, + 'MEDIA_TOUCH_FOR_LOAD' : X_EVENT_MEDIA_TOUCH_FOR_LOAD, 'NEED_AUTH' : X_EVENT_NEED_AUTH, diff --git a/0.6.x/js/03_plugin/00_XPlugin.js b/0.6.x/js/03_plugin/00_XPlugin.js index 3114a87..07420dd 100644 --- a/0.6.x/js/03_plugin/00_XPlugin.js +++ b/0.6.x/js/03_plugin/00_XPlugin.js @@ -87,6 +87,8 @@ X[ 'Pulgin' ] = { 'Flash' : X_Pulgin_FLASH_VERSION, + // FlashLite + 'Silverlight' : X_Pulgin_SILVER_LIGHT_VERSION, 'Unity' : X_Pulgin_UNITY_VERSION, diff --git a/0.6.x/js/06_net/01_XNetXHR.js b/0.6.x/js/06_net/01_XNetXHR.js index 0094a05..13ee2f9 100644 --- a/0.6.x/js/06_net/01_XNetXHR.js +++ b/0.6.x/js/06_net/01_XNetXHR.js @@ -171,12 +171,11 @@ if( X_XHR_w3c || X_XHR_msXML ){ postdata = obj[ 'postdata' ] || '', timeout = obj[ 'timeout' ] || 20000, noCache = obj[ 'cache' ] !== true, + dataType = X_XHR._dataType = obj[ 'dataType' ], xDomain = !X_URL_isSameDomain( url ), isFile = X_URL_isLocal( url ), init, type, tmp, p; - - X_XHR._dataType = obj[ 'dataType' ]; if( !raw || xDomain !== X_XHR._isXDR || ( X_XHR_createMSXML && isFile !== X_XHR._isMsXML ) ){ raw && X_XHR[ 'unlisten' ]( [ 'load', 'readystatechange', 'progress', 'error', 'timeout' ] ); @@ -203,14 +202,14 @@ if( X_XHR_w3c || X_XHR_msXML ){ raw.open( method, url, async, username, password ); if( raw.responseType !== undefined ){ - switch( X_XHR._dataType ){ + switch( dataType ){ case '' : case 'text' : // js, css raw.responseType = 'text'; break; case 'json' : // firefox9- は moz-json - raw.responseType = X_UA[ 'Gecko' ] < 10 ? 'moz-json' : X_UA[ 'Gecko' ] ? X_XHR._dataType : ''; // Iron 37 でエラー + raw.responseType = X_UA[ 'Gecko' ] < 10 ? 'moz-json' : X_UA[ 'Gecko' ] ? dataType : ''; // Iron 37 でエラー break; case 'document' : case 'xml' : @@ -222,14 +221,14 @@ if( X_XHR_w3c || X_XHR_msXML ){ case 'blob' : case 'arraybuffer' : // jpeg,jpg,png,gif,mp3,ogg... - raw.responseType = X_XHR._dataType; + raw.responseType = dataType; break; }; }; // http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r_1.html if( !X_XHR._isMsXML && raw.overrideMimeType ){ - type = X_URL_getEXT( url ) || X_XHR._dataType; + type = X_URL_getEXT( url ) || dataType; switch( type ){ case 'html' : case 'htm' : @@ -254,6 +253,15 @@ if( X_XHR_w3c || X_XHR_msXML ){ case 'mp4' : tmp = 'audio/x-' + type; break; + case 'jpeg' : + case 'jpg' : + case 'png' : + case 'gif' : + case 'bmp' : + case 'ico' : + tmp = 'text/plain; charset=x-user-defined'; + break; + }; if( tmp = obj[ 'mimeType' ] || tmp ) raw.overrideMimeType( tmp ); }; @@ -269,7 +277,7 @@ if( X_XHR_w3c || X_XHR_msXML ){ // http://nakigao.sitemix.jp/blog/?p=2040 // json 取得時に SafariでHTTP/412のエラー。但し相手が audio の場合この指定があるとロードに失敗する。 iOS8.2, iOS7.1 では遭遇せず - if( X_XHR._dataType === 'json' ){ + if( dataType === 'json' ){ headers[ 'If-Modified-Since' ] = ( new Date ).toUTCString(); }; @@ -380,7 +388,7 @@ if( X_XHR_w3c || X_XHR_msXML ){ handleEvent : function( e ){ var raw = X_XHR[ '_rawObject' ], live = !X_XHR._canceled, - headers, status, data; + headers, status, text, data; switch( e && e.type || 'readystatechange' ){ /* @@ -450,6 +458,17 @@ if( X_XHR_w3c || X_XHR_msXML ){ ){ /* * opera8, safari2, khtml3 で utf8 日本語文字列の文字化け + * + * http://www.kawa.net/works/js/jkl/parsexml.html + + text = raw[ 'responseText' ]; + // Safari and Konqueror cannot understand the encoding of text files. + if( text && ( X_UA[ 'Webkit' ] < 420 || X_UA[ 'KHTML' ] < 4 ) ){ + text = escape( text ); + if ( !text.match( '%u' ) && esc.match( '%' ) ){ + text = decodeURIComponent( text ); + }; + }; */ // parse json, html, xml, text, script, css @@ -475,6 +494,8 @@ if( X_XHR_w3c || X_XHR_msXML ){ break; case 'blob' : case 'arraybuffer' : + // TODO resoponceBody if( X_UA[ 'IE' ] < 10 ) + // http://d.hatena.ne.jp/maachang/20130221/1361427565 data = raw[ 'response' ] || raw[ 'responseText' ]; // とりあえず break; }; @@ -522,26 +543,6 @@ JKL.ParseXML.HTTP.prototype.documentElement = function() { return this.req.documentElement; // IXMLDOMDocument } }; - -// ================================================================ -// method: responseText() -// return: text string in response body - -JKL.ParseXML.HTTP.prototype.responseText = function() { - // debug.print( "responseText: "+this.req ); - if ( ! this.req ) return; - - // Safari and Konqueror cannot understand the encoding of text files. - if ( navigator.appVersion.match( "KHTML" ) ) { - var esc = escape( this.req.responseText ); -// debug.print( "escape: "+esc ); - if ( ! esc.match("%u") && esc.match("%") ) { - return decodeURIComponent(esc); - } - } - - return this.req.responseText; -}; */ onTimeout : function(){ diff --git a/0.6.x/js/07_audio/01_XWebAudio.js b/0.6.x/js/07_audio/01_XWebAudio.js index 966f667..47026ef 100644 --- a/0.6.x/js/07_audio/01_XWebAudio.js +++ b/0.6.x/js/07_audio/01_XWebAudio.js @@ -299,20 +299,28 @@ if( X_WebAudio_context ){ console.log( 'WebAudio buffer ready' ); - this.autoplay && X_Timer_once( 16, this, this.play ); + this.autoplay && !X_WebAudio_need1stTouch && X_Timer_once( 16, this, this.actualPlay ); }, actualPlay : function(){ - var begin, end; + var e, begin, end; - console.log( '[WebAudio] play abuf:' + !!this.audioBuffe ); + console.log( '[WebAudio] play abuf:' + !!this.audioBuffer ); if( !this.audioBuffer ){ this.autoplay = true; return; }; + if( X_WebAudio_need1stTouch ){ + e = X_EventDispatcher_CURRENT_EVENTS[ X_EventDispatcher_CURRENT_EVENTS.length - 1 ]; + if( !e || !e[ 'pointerType' ] ){ + alert( 'タッチイベント以外での play! ' + ( e ? e.type : '' ) ); + return; + }; + }; + end = X_Audio_getEndTime( this ); begin = X_Audio_getStartTime( this, end, true ); diff --git a/0.6.x/js/07_audio/02_XHTMLAudio.js b/0.6.x/js/07_audio/02_XHTMLAudio.js index 4095242..2c64eeb 100644 --- a/0.6.x/js/07_audio/02_XHTMLAudio.js +++ b/0.6.x/js/07_audio/02_XHTMLAudio.js @@ -79,26 +79,27 @@ if( X_Audio_constructor ){ X_Class.POOL_OBJECT, { _closed : true, - _loaded : false, - _ready : false, - _src : '', - - // 0: - // 1: touch 要求完了 - // 2: touch による play 中 - // 4: duration 取得完了 currentTime へのセット - // 8: playing || loadeddata or canplaythrought - // 16: READY 発火済 + + // 1: canplaythrought|timeupdateに達している、またはdurationFixが終了している + // 2: READY イベント発火済 _readyState : 0, + _src : '', - _touchRequested : false, - _touched : false, + // 0:ok + // 1:touch 要求済 + // 2:touch による play 済 + _touchState : X_HTMLAudio_need1stTouch ? 1 : 0, _currentFixStart : 0, _currentFixBegin : 0, + // 0:durationFix不要 または 完了 + // 1:durationFix未着手(touchState=1なら play() に入れる) + // 2:canplay イベント発生 -> play() + // 4:play() 実施済 + // 8:duration 取得済 + // :timeupdate イベントで durationFixは完了 _durationFixPhase : X_HTMLAudio_durationFix ? 1 : 0, - _durationFixSkip : X_HTMLAudio_durationFix && !X_HTMLAudio_need1stTouch, _lastCurrentTime : 0, _shortPlayFixON : false, @@ -132,8 +133,7 @@ if( X_Audio_constructor ){ X_elmBody.appendChild( raw ); } else { raw = X_TEMP.rawAudio || new X_Audio_constructor( '' ); - // X_Doc_create( 'audio', { src : source } )[ 'appendTo' ]( X.Doc.body ); - //raw.autoplay = raw.autobuffer = raw.loop = false; // loop を使えば ended で止まること回避できるかも 但し ended イベントが起きなくなる + // raw.loop = false; // loop を使えば ended で止まること回避できるかも 但し ended イベントが起きなくなる if( X_TEMP.rawAudio ) delete X_TEMP.rawAudio; }; @@ -163,8 +163,10 @@ if( X_Audio_constructor ){ if( X_HTMLAudio_need1stTouch ){ raw.src = source; } else { - raw.preload = 'auto'; - raw.autoplay = true; // Android 4.0-4.1.x で必要 + // if( this.autoplay ){ + raw.preload = 'auto'; + raw.autoplay = true; // Android 4.0-4.1.x で必要 + //}; //raw.autobuffer = true; raw.src = source; raw.load(); // Android4.1.1 HTL21 では必要! @@ -175,17 +177,21 @@ if( X_Audio_constructor ){ this.disatcher[ 'dispatch' ]( { type : X_EVENT_DEBUG, 'rawEvent' : e.type, - current : this.getActualCurrentTime() | 0, + current : this[ '_rawObject' ].currentTime, duration : this[ '_rawObject' ].duration } ); }, handleEvent : function( e ){ + if( !e || !e.type ) alert( 888 ); + var raw = this[ '_rawObject' ], actualEnded = e.type === 'ended', ended = actualEnded, ready, eventType, duration, end, now; + if( this._closed ) return; + // global に公開 //window[ '__rawAudio' ] = this[ '_rawObject' ]; @@ -194,13 +200,12 @@ if( X_Audio_constructor ){ switch( e.type ){ case X_EVENT_KILL_INSTANCE : - // 【javascript】モバイル向けブラウザでも音を鳴らしたい【WebAudio】 - // http://ingaouhou.com/archives/3633 - // ・使い終わったインスタンスはload()しておくとやや安定 - this.playing && this.actualPause(); delete this._closed; - delete this._loaded; + this.playing && this.actualPause(); + // 【javascript】モバイル向けブラウザでも音を鳴らしたい【WebAudio】 + // http://ingaouhou.com/archives/3633 + // ・使い終わったインスタンスはload()しておくとやや安定 raw.src = ''; raw.load(); @@ -218,13 +223,14 @@ if( X_Audio_constructor ){ case 'loadeddata' : // コンテンツの表示を現在の再生位置で初めて行えるようになった場合に発生 case 'canplaythrough' : // 今すぐに再生を開始してもバッファリングで停止することなく最後まで表示できると予測している場合に発生 - if( !this._endedFixON ){ - ready = true; + if( !this._endedFixON && !X_HTMLAudio_durationFix && !X_HTMLAudio_need1stTouch ){ + this._readyState |= 1; }; case 'canplay' : // 今すぐに再生を再開できるが、バッファリングが不十分でコンテンツを最後まで表示できないと予測している場合に発生 - if( X_HTMLAudio_durationFix && !X_HTMLAudio_need1stTouch && this._durationFixPhase === 1 ){ + if( this._durationFixPhase === 1 && !X_HTMLAudio_need1stTouch ){ + this._durationFixPhase = 2; this.actualPlay(); - raw.currentTime = 0; // 必要! + raw.currentTime = 0; // Win8 + Opera12 で必要 }; if( this._endedFixON ){ console.log( '▽ onEndedFix の終了 @' + e.type ); @@ -240,32 +246,38 @@ if( X_Audio_constructor ){ // TODO firefox で 短い音声でtimeupdate, ended が発火しない <- 最後の音に無音部分を追加する case 'timeupdate' : // 通常の再生が行われ現在の再生位置の変化が起こった場合に発生 - if( this._durationFixPhase & 3 ){ // 1 or 2 + if( this._durationFixPhase === 8 ){ + this._durationFixPhase = 0; + this._readyState |= 1; + } else + if( this._durationFixPhase === 4 ){ // 1 or 2 duration = raw.duration; + eventType = X_EVENT_MEDIA_WAITING; + } else + if( !X_HTMLAudio_durationFix && X_HTMLAudio_need1stTouch && this._touchState === 3 ){ + this._touchState = 0; + this._readyState |= 1; } else if( ( now = this.getActualCurrentTime() ) === this._lastCurrentTime ){ eventType = X_EVENT_MEDIA_WAITING; - } else { - this._lastCurrentTime = now; // *1 rm - - if( this.playing ){ - end = X_Audio_getEndTime( this ) + this._shortPlayFixTime; - //console.log( now + ' / ' + end ); - // || now < this._lastCurrentTime // loop した場合 - if( 0 + end <= 0 + now ){ // 0+ なぜか iem9 で必要,,, - if( this.autoLoop ){ - console.log( '☆★☆ 曲の最後に到達 @timeupdate now-end:' + ( now - end ) ); - ended = true; - if( X_HTMLAudio_endedFixIOS ) actualEnded = true; - } else { - this.actualPause(); - eventType = X_EVENT_MEDIA_ENDED; - }; + } else + if( this.playing ){ + end = X_Audio_getEndTime( this ) + this._shortPlayFixTime; + //console.log( now + ' / ' + end ); + // || now < this._lastCurrentTime // loop した場合 + if( 0 + end <= 0 + now ){ // 0+ なぜか iem9 で必要,,, + if( this.autoLoop ){ + console.log( '☆★☆ 曲の最後に到達 @timeupdate now-end:' + ( now - end ) ); + ended = true; + if( X_HTMLAudio_endedFixIOS ) actualEnded = true; } else { - eventType = X_EVENT_MEDIA_PLAYING; - // *1 this._lastCurrentTime = now; + this.actualPause(); + eventType = X_EVENT_MEDIA_ENDED; }; + } else { + eventType = X_EVENT_MEDIA_PLAYING; }; + this._lastCurrentTime = now; }; break; @@ -289,7 +301,7 @@ if( X_Audio_constructor ){ //if( X_HTMLAudio_currentTimeFix && !this._currentFixStart ){ //this._currentFixStart = X_Timer_now(); // 正確な再生開始時間に補正 //}; - eventType = !this._durationFixSkip && !this._endedFixON ? X_EVENT_MEDIA_PLAYING : X_EVENT_MEDIA_WAITING; + eventType = !this._durationFixPhase && !this._endedFixON ? X_EVENT_MEDIA_PLAYING : X_EVENT_MEDIA_WAITING; //case 'play' : // 再生が開始された。play()メソッドからの復帰後に発生する場合に発生 //case 'pause' : // 再生が一時停止された。pauseメソッドからの復帰後に発生する場合に発生 //case 'seeked' : @@ -309,15 +321,12 @@ if( X_Audio_constructor ){ if( 0 < duration && X_Type_isFinite( duration ) ){ this.duration = duration * 1000; - if( this._durationFixPhase === 2 ){ + if( this._durationFixPhase === 4 ){ console.log( '▼ DurationFix の終了 @' + e.type ); - this._durationFixPhase = 4; + this._durationFixPhase = 8; - ready = true; - - if( this.autoplay || this._loaded ){ + if( this.autoplay ){ console.log( '☆ 再生 <- DurationFix の終了' ); - this._durationFixSkip = false; this.actualPlay(); } else if( X_HTMLAudio_pauseFix ){ @@ -327,23 +336,20 @@ if( X_Audio_constructor ){ this.actualPause(); }; } else - if( this._durationFixPhase ){ - this._durationFixPhase = 4; + if( this._durationFixPhase & 3 ){ // === 1 | 2 + this._durationFixPhase = 8; }; }; - this._loaded = this._loaded || ready; - // - if( X_HTMLAudio_need1stTouch && !this._touchRequested ){ // !this._readyState + if( this._touchState === 1 ){ if( e.type === X_HTMLAudio_playTrigger ){ - this._touchRequested = true; - this._readyState = 1; - this.disatcher[ 'asyncDispatch' ]( X_EVENT_MEDIA_CAN_TOUCH_LOAD ); + this._touchState = 2; + this.disatcher[ 'asyncDispatch' ]( X_EVENT_MEDIA_TOUCH_FOR_LOAD ); }; } else if( ended ){ - if( !this._closed && this.autoLoop ){ + if( this.autoLoop ){ if( !( this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ this.looped = true; this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); @@ -358,49 +364,45 @@ if( X_Audio_constructor ){ this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED ); }; } else - if( this._loaded && this.duration && !this._ready ){ - this._ready = true; + if( this._readyState === 1 && this.duration ){ + this._readyState = 3; this.disatcher[ 'asyncDispatch' ]( X_EVENT_READY ); - this.autoplay && !X_HTMLAudio_need1stTouch && X_Timer_once( 16, this, this.actualPlay ); + this.autoplay && X_Timer_once( 16, this, this.actualPlay ); console.log( '> Audio Loaded!! ' + e.type + ' d:' + ( this.duration | 0 ) ); } else if( eventType ){ this.disatcher[ 'dispatch' ]( eventType ); - // eventType === X_EVENT_ERROR && this[ 'kill' ](); }; }, actualPlay : function( forcePlay, forceReload ){ var raw = this[ '_rawObject' ], e, begin, end; - - // もし kill 後に autoplayTimer で呼ばれても、_closed==true なので平気 + if( this._closed ) return; - if( !raw.src ){ // X_HTMLAudio_pauseFix によって src が空になっている console.log( '○ 削除された audio.src の復帰' ); raw.src = this._src; - //return; + return; }; - - if( this._touchRequested && !this._touched ){ // this._readyState === 1 + + if( this._touchState === 2 ){ e = X_EventDispatcher_CURRENT_EVENTS[ X_EventDispatcher_CURRENT_EVENTS.length - 1 ]; if( !e || !e[ 'pointerType' ] ){ - alert( 'タッチイベント以外での play! ' + e.type ); + alert( 'タッチイベント以外での play! ' + ( e ? e.type : '' ) ); return; }; - this._touched = true; - this._readyState = 2; + this._touchState = 3; } else - if( !this._ready && ( !X_HTMLAudio_durationFix || !X_HTMLAudio_need1stTouch ) ){ // this._readyState < 2 + if( this._readyState !== 3 && this._durationFixPhase < 2 ){ this.autoplay = true; return; }; - - if( X_HTMLAudio_durationFix && X_HTMLAudio_need1stTouch && this._durationFixPhase === 1 ){ - console.log( '▲ DurationFix の開始(タッチ用)' ); - this._durationFixPhase = 2; + + if( this._durationFixPhase & 3 ){ // 1 or 2 + console.log( '▲ DurationFix の開始' ); + this._durationFixPhase = 4; }; end = X_Audio_getEndTime( this ); @@ -415,7 +417,7 @@ if( X_Audio_constructor ){ }; }; - if( this._durationFixSkip || this._endedFixON ){ + if( this._endedFixON ){ console.log( '☆ audio.play をスキップ ' + begin + ' -> ' + end + ' crt:' + ( raw.currentTime | 0 ) ); } else { if( !this.playing ){ @@ -437,7 +439,8 @@ if( X_Audio_constructor ){ //また、GoogleChrome7 では currentTime = 0 直後に play() すると、pause()した位置前後の音が混ざることがある。(少なくとも自分の環境では) // iOS で duration が 0 の時に触ると error - if( !X_HTMLAudio_durationFix || this.duration ) raw.currentTime = this._lastCurrentTime; // 2 < this._readyState + // 0 or 8 + if( !( this._durationFixPhase % 8 ) && this.duration ) raw.currentTime = this._lastCurrentTime; console.log( '[HTMLAudio] play ' + begin + ' -> ' + end + ' crt:' + ( raw.currentTime | 0 ) + ' last:' + this._lastCurrentTime ); @@ -474,7 +477,6 @@ if( X_Audio_constructor ){ raw.src = ''; if( X_HTMLAudio_durationFix ){ delete this._durationFixPhase; - delete this._durationFixSkip; }; }; delete this.playing; diff --git a/0.6.x/js/07_audio/10_XAudioSprite.js b/0.6.x/js/07_audio/10_XAudioSprite.js index 85f9511..57e5d41 100644 --- a/0.6.x/js/07_audio/10_XAudioSprite.js +++ b/0.6.x/js/07_audio/10_XAudioSprite.js @@ -63,7 +63,7 @@ X[ 'AudioSprite' ] = function( setting ){ n = video ? 1 : setting[ 'numTracks' ] || 1, option = { volume : setting[ 'volume' ] || 0.5, - autoplay : false, + autoplay : true, startTime : 0, endTime : X_AudioSprite_lengthSilence, loop : true @@ -374,8 +374,8 @@ function X_AudioSprite_backendHandler( e ){ } else if( name === 'HTMLAudio' ){ if( _e[ 'needTouchForLoad' ] = X_HTMLAudio_need1stTouch ){ - last[ 'listenOnce' ]( X_EVENT_MEDIA_CAN_TOUCH_LOAD, X_AudioSprite_instance, X_AudioSprite_instance[ 'asyncDispatch' ], [ _e ] ); - last[ 'listenOnce' ]( !X_HTMLAudio_durationFix ? X_EVENT_MEDIA_PLAYING : X_EVENT_READY, X_AudioSprite_instance, X_AudioSprite_backendHandler ); + last[ 'listenOnce' ]( X_EVENT_MEDIA_TOUCH_FOR_LOAD, X_AudioSprite_instance, X_AudioSprite_instance[ 'asyncDispatch' ], [ _e ] ); + last[ 'listenOnce' ]( X_EVENT_READY, X_AudioSprite_instance, X_AudioSprite_backendHandler ); } else { X_AudioSprite_instance[ 'asyncDispatch' ]( _e ); last[ 'listenOnce' ]( X_EVENT_READY, X_AudioSprite_instance, X_AudioSprite_backendHandler ); @@ -385,7 +385,7 @@ function X_AudioSprite_backendHandler( e ){ for( i = 0; i < X_AudioSprite_TEMP.tracks.length; ++i ){ X_AudioSprite_instance[ 'pause' ]( i ); }; - }; + }; }; } else { @@ -402,8 +402,7 @@ function X_AudioSprite_backendHandler( e ){ [ 'asyncDispatch' ]( X_EVENT_BACKEND_NONE ); return X_CALLBACK_STOP_NOW; - case X_EVENT_READY : - case X_EVENT_MEDIA_PLAYING : + case X_EVENT_READY : console.log( 'X.AudioSprite - Ready!' ); for( i = 0; i < X_AudioSprite_TEMP.tracks.length; ++i ){ X_AudioSprite_instance[ 'pause' ]( i ); -- 2.11.0