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=ca59f5f1f85d5d2a776cdc2a11e4fde4f9139274;hp=b5abcd2a3597964903d9ef0b69e8469d70544713;hb=bfca1aa94da405643253af65c421f6665d6e6262;hpb=04ac203dfb25cc7e92db1f7f9f77122841f7cb1a diff --git a/0.6.x/js/07_audio/02_XHTMLAudio.js b/0.6.x/js/07_audio/02_XHTMLAudio.js index b5abcd2..ca59f5f 100644 --- a/0.6.x/js/07_audio/02_XHTMLAudio.js +++ b/0.6.x/js/07_audio/02_XHTMLAudio.js @@ -54,6 +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, X_HTMLAudio_volumeFix = X_UA[ 'Chrome' ], /* @@ -107,7 +109,7 @@ if( X_Audio_constructor ){ // 8:duration 取得済 // :timeupdate イベントで durationFixは完了 _durationFixPhase : X_HTMLAudio_durationFix ? 1 : 0, - _lastCurrentTime : 0, + _lastCurrentTime : 0, // ms _shortPlayFixON : false, _shortPlayFixTime : 0, @@ -203,7 +205,7 @@ if( X_Audio_constructor ){ if( !raw ) return; - //e.type !== 'timeupdate' && console.log( ' > ' + e.type ); + // e.type !== 'timeupdate' && console.log( ' > ' + e.type ); switch( e.type ){ @@ -278,11 +280,18 @@ if( X_Audio_constructor ){ if( ( now = this.getActualCurrentTime() ) === this._lastCurrentTime ){ eventType = X_EVENT_MEDIA_WAITING; } else + if( X_HTMLAudio_playStartFix && ( now < this._lastCurrentTime ) ){ + eventType = X_EVENT_MEDIA_WAITING; + //console.log( '@Firefox44.0.2 !! ' + now + ' / ' + this._lastCurrentTime ); + // Firefox44.0.2 で音声の再生開始に難あり... + // 20回程度 currentTime の更新に失敗する.... + this.actualPlay(); + } else if( this.playing ){ end = X_Audio_getEndTime( this ) + this._shortPlayFixTime; - - console.log( now + ' / ' + end );// Firefox44.0.2 で音声の再生開始に難あり... - + + //console.log( '@ ' + now + ' / ' + this._lastCurrentTime + ' / ' + end );// Firefox44.0.2 で音声の再生開始に難あり... + if( ( 0 + end <= 0 + now ) || // 0+ なぜか iem9 で必要,,, ( now < this._lastCurrentTime && now < 2000 ) ){ //( ( X_HTMLAudio_endedFixAOSP2 || X_HTMLAudio_endedFixAOSP4 ) && ( now < this._lastCurrentTime && now < 1000 ) ) ){ @@ -438,7 +447,7 @@ if( X_Audio_constructor ){ end = X_Audio_getEndTime( this ); begin = X_Audio_getStartTime( this, end, true ); - this._lastCurrentTime = begin / 1000; + this._lastCurrentTime = begin; if( this._shortPlayFixON ){ this._shortPlayFixTime = ( 1000 < end - begin ) ? 200 : 400; @@ -469,7 +478,7 @@ if( X_Audio_constructor ){ // iOS で duration が 0 の時に触ると error // 0 or 8 - if( !( this._durationFixPhase % 8 ) && this.duration ) raw.currentTime = this._lastCurrentTime; + if( !( this._durationFixPhase % 8 ) && this.duration ) raw.currentTime = this._lastCurrentTime / 1000; console.log( '[HTMLAudio] play ' + begin + ' -> ' + end + ' crt:' + ( raw.currentTime | 0 ) + ' last:' + this._lastCurrentTime ); @@ -509,7 +518,7 @@ if( X_Audio_constructor ){ getActualCurrentTime : function(){ return ( X_HTMLAudio_currentTimeFix ? X_Timer_now() - this._currentFixStart + this._currentFixBegin : - this._seekingFixON ? this._lastCurrentTime * 1000 : + this._seekingFixON ? this._lastCurrentTime : this[ '_rawObject' ].currentTime * 1000 | 0 ); }, /*