OSDN Git Service

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