<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
    主站蜘蛛池模板: 国产一区二区三区免费观看在线| 亚洲AV成人片色在线观看| 亚洲综合av一区二区三区不卡| 一区二区在线免费观看| 亚洲AV无码码潮喷在线观看| 91精品全国免费观看青青| 亚洲国产精品福利片在线观看| 久久精品免费观看| 亚洲av午夜成人片精品网站 | 国产亚洲一区二区三区在线| h视频在线免费观看| 亚洲精品高清无码视频| 99国产精品免费视频观看| 精品日韩亚洲AV无码| 无码国产精品一区二区免费 | www.999精品视频观看免费| 中中文字幕亚洲无线码| 在线观看成人免费| 欧洲美女大片免费播放器视频| 77777亚洲午夜久久多人| 秋霞人成在线观看免费视频| 亚洲成人福利在线| 国产在线ts人妖免费视频| 一级毛片免费在线播放| 亚洲一本综合久久| 成人奭片免费观看| 青青久久精品国产免费看| 久久精品亚洲综合专区| 啦啦啦中文在线观看电视剧免费版| 黄色毛片免费在线观看| 国产成人亚洲精品青草天美| 无码国产精品一区二区免费虚拟VR | 精品免费久久久久国产一区| 亚洲乱亚洲乱淫久久| 性感美女视频在线观看免费精品 | A国产一区二区免费入口| 亚洲高清中文字幕| 免费A级毛片在线播放不收费| 国偷自产一区二区免费视频| 伊人久久五月丁香综合中文亚洲| 久久久久噜噜噜亚洲熟女综合|