<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-193  評論-715  文章-1  trackbacks-0
    Recently, I had spent a lot of time on sound playback of Flash Player 10, but I can't slove a performance issue in none-ActiveX architecture. I will get stutter/machine gun sound when I load a heavy load web page at the same time in Firefox/Chrome/Safari. this case don't happen in IE, and I always get smooth sound.

    The root cause of this issue is used to extract method of Sound class for retract samples, and then play by extracted samples. You may ask me, why don't use play method of Sound class directly? I think I only answer you that it's business requirements.

    Following are my test code:
    package {
        
    import flash.events.Event;
        
    import flash.events.SampleDataEvent;
        
    import flash.media.Sound;
        
    import flash.net.URLRequest;
        
    import flash.system.System;
        
    import flash.utils.ByteArray;

        
    public class Extract {
            
    private var sourceSnd:Sound = new Sound();
            
    private var outputSnd:Sound = new Sound();
            
    private var urlReq:URLRequest = new URLRequest("11k.mp3"); //this file has 575 frames
            
    //        private var urlReq:URLRequest = new URLRequest("44k.mp3");  //this file has 1150 frames
            private var samplesCount:uint = 0;

            
    public function play():void {
                sourceSnd.load(urlReq);
                
    //            sourceSnd.play(); // if use source sound to playing, we will not be got machine gun sound.
                sourceSnd.addEventListener(Event.COMPLETE, loaded); //use this approach, we will be got stutter.
            }


            
    private function loaded(event:Event):void {
                outputSnd.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound);
                outputSnd.play();
            }


            
    private function processSound(event:SampleDataEvent):void {
                var bytes:ByteArray 
    = new ByteArray();
                var samplesPerTime:uint 
    = sourceSnd.extract(bytes, 8192);
                samplesCount 
    += samplesPerTime;
                
    //            trace("samplesCount:" + samplesCount + ",samplesPerTime:" + samplesPerTime);
                event.data.writeBytes(bytes);
                
    //            flash.system.System.gc();
            }


        }

    }

    You can refer to following test steps for reproduce stutter/machine gun sound issue:
     
    1, Run/debug test application in Firefox, you will get smooth sound at once.
     
    2, Open a new tab in the same window, and open a heavy load web page (for example: http://www.taobao.com)
     
    3, You will get stutter when a heavy load page is loading.

    If you interest in this problem also, we can study it together.
    posted on 2010-03-05 12:15 Robin's Programming World 閱讀(1582) 評論(0)  編輯  收藏 所屬分類: Flex & Flash
    主站蜘蛛池模板: 中文字幕乱码免费视频| 国产在线19禁免费观看国产| 国产精品高清视亚洲精品| 日本高清免费网站| 中出五十路免费视频| 亚洲午夜电影一区二区三区| 免费人成在线观看视频播放| 日韩精品人妻系列无码专区免费| 亚洲欧美成人一区二区三区| 亚洲精品无码久久久久sm| h在线观看视频免费网站| 无套内谢孕妇毛片免费看看| 久久亚洲精品成人AV| 成人永久福利免费观看| 日韩精品免费视频| 国产精品亚洲AV三区| 久久青青草原亚洲av无码app| 国产又长又粗又爽免费视频| 99热这里只有精品免费播放 | 一级中文字幕免费乱码专区| 亚洲男人天堂2017| 亚洲第一视频在线观看免费| 九九精品免费视频| 免费毛片a线观看| 青青青亚洲精品国产| 亚洲另类春色校园小说| 亚洲人成77777在线播放网站| 成人免费毛片观看| 97av免费视频| a级男女仿爱免费视频| 国产亚洲成在线播放va| 亚洲乱码一区av春药高潮| 亚洲成AV人片在线观看| 亚洲av无码天堂一区二区三区| 国国内清清草原免费视频99| 99麻豆久久久国产精品免费| 老司机午夜精品视频在线观看免费| 亚洲AV综合色区无码二区偷拍 | 亚洲精品A在线观看| 成年午夜视频免费观看视频 | 亚洲综合精品网站在线观看|