OSDN Git Service

Version 0.6.90, performance fix for HTML5Audio & rename SilverLight -> Silverlight.
authoritozyun <itozyun@user.sourceforge.jp>
Sun, 5 Oct 2014 11:55:02 +0000 (20:55 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Sun, 5 Oct 2014 11:55:02 +0000 (20:55 +0900)
0.6.x/js/02_plugin/00_XPlugin.js
0.6.x/js/06_audio/00_XAudio.js
0.6.x/js/06_audio/01_XHTML5Audio.js
0.6.x/js/06_audio/02_XSilverLightAudio.js

index 5df17a4..d7e2032 100644 (file)
@@ -58,9 +58,9 @@ X.Pulgin = {
 
        FlashEnabled       : X_Pulgin_FLASH_ENABLED,
 
-       SilverLight        : X_Pulgin_SILVER_LIGHT_VERSION,
+       Silverlight        : X_Pulgin_SILVER_LIGHT_VERSION,
        
-       SilverLightEnabled : X_Pulgin_SILVER_LIGHT_ENABLED,
+       SilverlightEnabled : X_Pulgin_SILVER_LIGHT_ENABLED,
        
        Unity              : X_Pulgin_UNITY_VERSION,
        
index b4cb185..3727959 100644 (file)
@@ -1,7 +1,7 @@
 X.Audio = {\r
        HTML5       : 1,\r
        Flash       : 2,\r
-       SilverLight : 3,\r
+       Silverlight : 3,\r
        Unity       : 4,\r
        WMP         : 5,\r
        RealPlayer  : 6,\r
index efbae42..5bea55f 100644 (file)
@@ -137,8 +137,6 @@ if( window.HTMLAudioElement ){
                {\r
                        \r
                        proxy           : null,\r
-                       xnodeAudio      : null,\r
-                       rawAudio        : null,\r
                        \r
                        _closed         : true,\r
                        _lastUserAction : '',\r
@@ -156,21 +154,23 @@ if( window.HTMLAudioElement ){
                                if( option.startTime ) this._startTime = option.startTime;\r
                                if( option.volume )    this._volume    = option.volume;\r
                                \r
-                               this.xnodeAudio = new X.EventDispatcher( this.rawAudio = X_Audio_rawAudio || new Audio( source ) )//X.Dom.Node.create( 'audio', { src : source } ).appendToRoot();//( X.Dom.Node._systemNode );\r
-                                       .listen( [\r
+                               this._rawObject = X_Audio_rawAudio || new Audio( source );//X.Dom.Node.create( 'audio', { src : source } ).appendToRoot();//( X.Dom.Node._systemNode );\r
+                               \r
+                               this.listen( [\r
                                                'loadstart', 'load', 'progress', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'pause', 'loadedmetadata',\r
                                                'loadeddata', 'waiting', 'playing', 'canplay', 'canplaythrough', 'seeking', 'seeked', 'timeupdate', 'ended',\r
-                                               'ratechange', 'durationchange', 'volumechange' ], this, this.handleEventProxy );                                \r
+                                               'ratechange', 'durationchange', 'volumechange' ], this.handleEventProxy );                              \r
+                               \r
                                if( X_Audio_rawAudio ){\r
                                        X_Audio_rawAudio.src = source;\r
                                        X_Audio_rawAudio.load(); // 要る?\r
                                        X_Audio_rawAudio = null;\r
                                };\r
 \r
-                               document.body.appendChild( this.rawAudio );\r
+                               //document.body.appendChild( this._rawObject );\r
 \r
-                               this.rawAudio.volume   = this._volume;\r
-                               this.rawAudio.autoplay = false;\r
+                               this._rawObject.volume   = this._volume;\r
+                               this._rawObject.autoplay = false;\r
                                option.autoplay && X.Timer.once( 100, this, this.play );\r
                                \r
                                this.listenOnce( X.Event.KILL_INSTANCE );\r
@@ -180,8 +180,6 @@ if( window.HTMLAudioElement ){
                                switch( e.type ){\r
 \r
                                        case X.Event.KILL_INSTANCE :\r
-                                               this.xnodeAudio.unlisten();\r
-                                               this.xnodeAudio.kill(); // <img> と同じく <audio> は pool した方がいいかも\r
                                                break;\r
                                };\r
                        },\r
@@ -239,44 +237,44 @@ if( window.HTMLAudioElement ){
                        \r
                            if( X.UA.Chrome ){ // [CHROME][FIX] volume TODO どの version で 修正される?\r
                                // [!] delay\r
-                               X.Timer.once( 0, this, this._fixForChrome, [ this.rawAudio.volume ] );\r
-                               this.rawAudio.volume = 0;\r
+                               X.Timer.once( 0, this, this._fixForChrome, [ this._rawObject.volume ] );\r
+                               this._rawObject.volume = 0;\r
                            };\r
                            \r
-                           if( !this.rawAudio.paused ){\r
+                           if( !this._rawObject.paused ){\r
                                this.currentTime( this._startTime );\r
                            };\r
-                           this.rawAudio.play();\r
+                           this._rawObject.play();\r
                        },\r
                        \r
                        // [CHROME][FIX] volume\r
                        _fixForChrome : X.UA.Chrome && function( volume ){\r
-                               !this._closed && ( this.rawAudio.volume = volume );\r
+                               !this._closed && ( this._rawObject.volume = volume );\r
                        },\r
                        \r
                        pause : function(){\r
-                           if( !this._closed && !this.rawAudio.error ){\r
+                           if( !this._closed && !this._rawObject.error ){\r
                                this._lastUserAction = 'pause';\r
-                               this.rawAudio.pause();          \r
+                               this._rawObject.pause();        \r
                            };\r
                        },\r
                        \r
                        stop : function(){\r
-                           if( !this._closed && !this.rawAudio.error ){\r
+                           if( !this._closed && !this._rawObject.error ){\r
                                this._lastUserAction = 'stop';\r
-                               this.rawAudio.pause();\r
+                               this._rawObject.pause();\r
                                this.currentTime( this._startTime );\r
                            };\r
                        },\r
                        \r
                        loop : function( v ){\r
                            if( v === undefined ) return this._loop;\r
-                           this.rawAudio.loop = this._loop = v;\r
+                           this._rawObject.loop = this._loop = v;\r
                        },\r
        \r
                        state : function(){\r
-                           var paused = !!this.rawAudio.paused,\r
-                               ended  = !!this.rawAudio.ended;\r
+                           var paused = !!this._rawObject.paused,\r
+                               ended  = !!this._rawObject.ended;\r
                        \r
                            if( this._lastUserAction === 'stop' ){\r
                                if( paused ){\r
@@ -286,18 +284,18 @@ if( window.HTMLAudioElement ){
                            };\r
                        \r
                            return {\r
-                               loop     : this.rawAudio.loop,\r
-                               error    : this.rawAudio.error    || 0,   // 0, 1 ~ 4\r
+                               loop     : this._rawObject.loop,\r
+                               error    : this._rawObject.error    || 0,   // 0, 1 ~ 4\r
                                paused   : paused,\r
                                ended    : ended,\r
-                               source   : this.rawAudio.src      || '',\r
-                               duration : this.rawAudio.duration || 0\r
+                               source   : this._rawObject.src      || '',\r
+                               duration : this._rawObject.duration || 0\r
                            };\r
                        },\r
        \r
                        volume : function( v ){\r
                            if( v === undefined ) return this.audio.volume;\r
-                           this.rawAudio.volume = v;\r
+                           this._rawObject.volume = v;\r
                        },\r
        \r
                        startTime : function( time ){\r
@@ -306,12 +304,12 @@ if( window.HTMLAudioElement ){
                        },\r
        \r
                        currentTime : function( time ){\r
-                           if( time === undefined ) return this.rawAudio.currentTime;\r
-                           this.rawAudio.currentTime = time;\r
+                           if( time === undefined ) return this._rawObject.currentTime;\r
+                           this._rawObject.currentTime = time;\r
                        },\r
        \r
                        isPlaying : function(){\r
-                           return !this.rawAudio.error && !this.rawAudio.paused && !this.rawAudio.ended;\r
+                           return !this._rawObject.error && !this._rawObject.paused && !this._rawObject.ended;\r
                        }\r
        \r
                }\r
index e3dda4d..ca199d3 100644 (file)
@@ -14,7 +14,7 @@ var X_Audio_SLAudio, X_Audio_SLAudioWrapper,
        X_Audio_SLAudio_LIVE_LIST = [],\r
        X_Audio_SLAudio_POOL_LIST = [];\r
 \r
-if( X.Pulgin.SilverLightEnabled ){\r
+if( X.Pulgin.SilverlightEnabled ){\r
        \r
        function getSLAudioWrapper( proxy ){\r
                var i = X_Audio_SLAudio_LIVE_LIST.length;\r
@@ -26,7 +26,7 @@ if( X.Pulgin.SilverLightEnabled ){
        X_Audio_SLAudio = X.Class._override(\r
                new X.EventDispatcher(),\r
                {\r
-                       backendName : 'SilverLight Audio',\r
+                       backendName : 'Silverlight Audio',\r
 \r
                        detect : function( source, ext ){\r
                                var ok = ext === 'mp3' || ext === 'wma';\r
@@ -89,10 +89,10 @@ if( X.Pulgin.SilverLightEnabled ){
        };\r
        \r
        X_Audio_SLAudioWrapper = X.EventDispatcher.inherits(\r
-               'X.AV.SilverLightAudioWrapper',\r
+               'X.AV.SilverlightAudioWrapper',\r
                X.Class.POOL_OBJECT,\r
                {\r
-                       _isSilverLight  : true, // for X.EventDispatcher.listen\r
+                       _isSilverlight  : true, // for X.EventDispatcher.listen\r
                proxy           : null,\r
                _onload         : '',\r
                _callback       : null,                 \r
@@ -122,8 +122,9 @@ if( X.Pulgin.SilverLightEnabled ){
                                        // <script id="silverlightaudio" type="text/xaml"><Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"></Canvas></script>\r
                                };\r
                                /*\r
+                                * [Silverlight 2]JavaScriptコードからSilverlightのオブジェクトを利用するには?[C#、VB]\r
                                 * http://www.atmarkit.co.jp/fdotnet/dotnettips/902slobjcallfromjs/slobjcallfromjs.html\r
-                                * 動いている\r
+                                * このページのサンプルは sl5+firefox32 環境で動いている。xaml を js から利用する形ではなく、.xap を sl4 以下で作るのがよさそう.\r
                                 */\r
                                this.proxy       = proxy;\r
                        this._onload     = 'XAudioSilverlightOnLoad';// + ( ++X_Audio_SLAudio_uid );\r
@@ -132,9 +133,9 @@ if( X.Pulgin.SilverLightEnabled ){
                                .create( 'object', {\r
                                                type   : 'application/x-silverlight-2',\r
                                                data   : 'data:application/x-silverlight-2,',\r
-                                               width  : 100,\r
-                                               height : 100\r
-                                       }, { width : '20px', height : '20px', display : 'block', '-moz-binding' : 'none' } )\r
+                                               width  : 1,\r
+                                               height : 1\r
+                                       })\r
                                        .html(\r
                                            '<param name="background" value="#00000000">' +      // transparent\r
                                            '<param name="windowless" value="true">' +\r