X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=blobdiff_plain;f=0.6.x%2Fjs%2F07_audio%2F02_XHTMLAudio.js;fp=0.6.x%2Fjs%2F07_audio%2F02_XHTMLAudio.js;h=ab983897a765a4b93f037a708703136b2d896cee;hp=1c88ae5cb9c1a49f8744289864f1a46e561c283d;hb=66ccef8a1fdd3994dd3c75dcfede668ea55f1d2e;hpb=4e4ab3be10850546063d4a4b93250ed142bb8cd2 diff --git a/0.6.x/js/07_audio/02_XHTMLAudio.js b/0.6.x/js/07_audio/02_XHTMLAudio.js index 1c88ae5..ab98389 100644 --- a/0.6.x/js/07_audio/02_XHTMLAudio.js +++ b/0.6.x/js/07_audio/02_XHTMLAudio.js @@ -54,8 +54,8 @@ var // Opera Mobile 12 は 2回目以降の currentTime へのセットで currentTime が更新されなくなるため、タイマーを使用する X_HTMLAudio_currentTimeFix = !!X_UA[ 'OperaMobile' ] || !!X_UA[ 'OperaTablet' ], - // Firefox44.0.2 で音声の再生開始に難あり... - X_HTMLAudio_playStartFix = X_UA[ 'Windows' ] && X_UA[ 'Gecko' ] === 44, + // Firefox44.0.2 で音声の再生開始に難あり... 49 でも確認, あるいはCGIで動的に生成しているmp3自体に問題があるのかも + X_HTMLAudio_playStartFix = X_UA[ 'Windows' ] && 44 <= X_UA[ 'Gecko' ], X_HTMLAudio_volumeFix = X_UA[ 'Chrome' ], /* @@ -118,10 +118,10 @@ if( X_Audio_constructor ){ _seekingFixON : false, - 'Constructor' : function( disatcher, source, option ){ + 'Constructor' : function( dispatcher, source, option ){ var raw; - this.disatcher = disatcher || this; + this.dispatcher = dispatcher || this; this._src = source; if( X_HTMLAudio_shortPlayFix ){ @@ -188,7 +188,7 @@ if( X_Audio_constructor ){ }, onDebug : function( e ){ - this.disatcher[ 'dispatch' ]( { + this.dispatcher[ 'dispatch' ]( { type : X_EVENT_DEBUG, 'rawEvent' : e.type, 'current' : this[ '_rawObject' ].currentTime, @@ -232,7 +232,7 @@ if( X_Audio_constructor ){ for( i = time = 0, l = buf && buf.length; i < l; ++i ){ time += buf[ 'end' ]( i ) - buf[ 'start' ]( i ); }; - this.disatcher[ 'dispatch' ]( { type : X_EVENT_PROGRESS, 'percent' : time * 1000 / this.duration * 100 } ); + this.dispatcher[ 'dispatch' ]( { type : X_EVENT_PROGRESS, 'percent' : time * 1000 / this.duration * 100 } ); }; break; @@ -379,29 +379,36 @@ if( X_Audio_constructor ){ if( this._touchState === 1 ){ if( e.type === X_HTMLAudio_playTrigger ){ this._touchState = 2; - this.disatcher[ 'asyncDispatch' ]( X_EVENT_MEDIA_WAIT_FOR_TOUCH ); + this.dispatcher[ 'asyncDispatch' ]( X_EVENT_MEDIA_WAIT_FOR_TOUCH ); }; } else if( ended ){ if( this.autoLoop ){ - if( !( this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ + if( !( this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_BEFORE_LOOP ) & X_CALLBACK_PREVENT_DEFAULT ) ){ this.looped = true; - this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); + this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_LOOPED ); this.actualPlay( X_HTMLAudio_endedFixCWV && actualEnded, X_HTMLAudio_endedFixAOSP3 && actualEnded ); }; } else { this.seekTime = 0; delete this.playing; - this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED ); + this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED ); }; } else if( this._readyState === 1 && this.duration ){ this._readyState |= 2; - this.disatcher[ 'asyncDispatch' ]( X_EVENT_READY ); + this.dispatcher[ 'asyncDispatch' ]( X_EVENT_READY ); + + // TODO 勝手に play する環境があるので pause() を実施 + /* + if( !this.playing && !this.autoplay && !this._playReserved && !X_HTMLAudio_pauseFix ){ + this.actualPause(); + }; */ + console.log( '> Audio Loaded!! ' + e.type + ' d:' + ( this.duration | 0 ) ); } else if( eventType ){ - this.disatcher[ 'dispatch' ]( eventType ); + this.dispatcher[ 'dispatch' ]( eventType ); }; }, @@ -488,7 +495,7 @@ if( X_Audio_constructor ){ this._endedFixON = true; raw.src = this._src; console.log( '△ onEndedFix の開始' ); - this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_WAITING ); + this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_WAITING ); }; };