OSDN Git Service

Fix the bug of X.NodeAnime.
[pettanr/clientJs.git] / 0.6.x / js / 07_audio / 05_XWMPAudio.js
index 075f537..cb750fb 100644 (file)
@@ -7,7 +7,7 @@
 
 var X_WMPAudio;
 
-if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
+if( X_Plugin_WMP_VERSION ){ // IETester で 6.x は不可
        X_WMPAudio = X_AudioBase[ 'inherits' ](
                'X.WMPAudio',
                X_Class.POOL_OBJECT,
@@ -22,11 +22,11 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                _seekDirection  : 0,
                        _timerID        : 0,
                        
-                       'Constructor' : function( disatcher, source, option ){
-                               this.disatcher   = disatcher || this;
+                       'Constructor' : function( dispatcher, source, option ){
+                               this.dispatcher   = dispatcher || this;
                                this._source     = source;
                                
-                               if( 7 <= X_Pulgin_WMP_VERSION ){
+                               if( 7 <= X_Plugin_WMP_VERSION ){
                                this.xnodeObject = X_Node_systemNode[ 'create' ]( 'object', {
                                                        'classID' : 'CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6',
                                                        width     : 1,
@@ -59,7 +59,7 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                                switch( e.type ){
                                        case X_EVENT_AFTER_UPDATE :
                                                this._readyState = 1;
-                                               if( 7 <= X_Pulgin_WMP_VERSION ){
+                                               if( 7 <= X_Plugin_WMP_VERSION ){
                                                        this._wmp          = this.xnodeObject[ '_rawObject' ];
                                                        this._wmp[ 'URL' ] = this._source;
                                                        this.wmp           = this._wmp[ 'controls' ];
@@ -71,7 +71,7 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                                                break;
 
                                        case X_EVENT_KILL_INSTANCE :
-                                               this.playing && this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
+                                               this.playing && this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
                                                this.playing && this.actualPause();
                                            this.wmp.stop();
                                                this.xnodeObject[ 'kill' ]();
@@ -112,23 +112,23 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                                _onTimer : function(){
                                        var progress, time;
                                        
-                                       // road 中の場合
+                                       // load 中の場合
                                        if( this._readyState === 1 ){
-                                               if( 7 <= X_Pulgin_WMP_VERSION ){
+                                               if( 7 <= X_Plugin_WMP_VERSION ){
                                                progress = this._wmp[ 'network' ][ 'downloadProgress' ];
                                                } else {
                                                progress = this.wmp[ 'BufferingProgress' ];
                                                };
                                                if( progress < 100 ){
-                                                       this.disatcher[ 'dispatch' ]( { type : X_EVENT_PROGRESS, 'percent' : progress } );
+                                                       this.dispatcher[ 'dispatch' ]( { type : X_EVENT_PROGRESS, 'percent' : progress } );
                                                } else {
                                                        this._readyState = 2;
-                                                       if( 7 <= X_Pulgin_WMP_VERSION ){
+                                                       if( 7 <= X_Plugin_WMP_VERSION ){
                                                        this.duration = this._wmp[ 'currentMedia' ].duration * 1000 | 0;
                                                        } else {
                                                        this.duration = this.wmp[ 'Duration' ] * 1000 | 0;
                                                        };
-                                                       this.disatcher[ 'dispatch' ]( X_EVENT_READY );
+                                                       this.dispatcher[ 'dispatch' ]( X_EVENT_READY );
                                                };
                                        } else
                                        // ended の判定
@@ -138,33 +138,33 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                                // waiting
                                if( this._seekDirection ){
                                        if( this._seekDirection === 1 ? ( time < this._beginTime ) : ( this._lastCurrentTime <= time ) ){
-                                               this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_SEEKING );
+                                               this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_SEEKING );
                                                return;
                                        };
                                        delete this._seekDirection;
                                };
                                if( time === this._lastCurrentTime ){
-                                       this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_WAITING );
+                                       this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_WAITING );
                                        return;
                                };              
                                this._lastCurrentTime = time;
                                
                                // ended ではない
                                if( time - X_Audio_getEndTime( this ) < -50 ){
-                                       this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
+                                       this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_PLAYING );
                                        return;
                                };
                                
                                // 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();
                                        };
                                } else {
                                        this.actualPause();
-                                       this.disatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
+                                       this.dispatcher[ 'dispatch' ]( X_EVENT_MEDIA_ENDED );
                                        delete this._timerID;
                                                        return X_CALLBACK_UN_LISTEN;
                                };
@@ -181,7 +181,7 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                        },
 
                        setVolume : function(){
-                               if( 7 <= X_Pulgin_WMP_VERSION ){
+                               if( 7 <= X_Plugin_WMP_VERSION ){
                                this._wmp[ 'settings' ][ 'Volume' ] = this.gain * 100;
                                } else {
                                this.wmp[ 'Volume' ] = ( 1 - this.gain ) * 10000;
@@ -207,10 +207,11 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
        X_Audio_BACKENDS.push( {
                backendID   : 16,
                
-               backendName : 'WMP' + X_Pulgin_WMP_VERSION,
+               backendName : 'WMP' + X_Plugin_WMP_VERSION,
 
                canPlay : {
                        'mp3'  : true,
+                       'm4a'  : true,
                        'wma'  : true,
                        'wav'  : true,
                        'mid'  : true,
@@ -218,12 +219,12 @@ if( X_Pulgin_WMP_VERSION ){ // IETester で 6.x は不可
                        'snd'  : true,
                        'au'   : true,
                        'aif'  : true,
-                       'aicf' : true,
-                       'aiff' : true
+                       'aiff' : true,
+                       'aicf' : true
                },
 
-               detect : function( proxy, source, ext ){
-                       proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : ext === 'mp3' || ext === 'wma' || ext === 'wav' } );                             
+               detect : function( proxy, ext /* hash */ ){
+                       proxy[ 'asyncDispatch' ]( { type : X_EVENT_COMPLETE, canPlay : 0 <= 'mp3 m4a wma wav midi snd au aiff aicf'.indexOf( ext ) } );                         
                },
                
                klass : X_WMPAudio