<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 閱讀(1576) 評論(0)  編輯  收藏 所屬分類: Flex & Flash
    主站蜘蛛池模板: 狼色精品人妻在线视频免费| 国产在线不卡免费播放| 国产裸体美女永久免费无遮挡| 亚洲成在人线电影天堂色| 亚洲一级片内射网站在线观看| 免费无码又爽又刺激高潮的视频 | 久久久久久亚洲av成人无码国产| 四虎影院永久免费观看| 成人免费AA片在线观看| 免费视频成人片在线观看| 久久免费香蕉视频| 人成电影网在线观看免费| 亚洲AV成人片无码网站| 国产成人亚洲综合一区| 亚洲一区二区三区播放在线 | 成人免费一区二区三区| 美女视频黄视大全视频免费的| 亚洲中文字幕一区精品自拍| 亚洲第一网站免费视频| 亚洲精品在线观看视频| 亚洲AV成人精品网站在线播放| 亚洲乳大丰满中文字幕| 亚洲综合AV在线在线播放| 区三区激情福利综合中文字幕在线一区亚洲视频1| 成年私人影院免费视频网站| 5555在线播放免费播放| 中文字幕亚洲免费无线观看日本 | 精品亚洲成a人片在线观看| 亚洲国产精品久久| 亚洲欧洲日韩国产综合在线二区| 精品国产亚洲一区二区三区| 久久国产亚洲精品麻豆| 亚洲AV无码乱码在线观看富二代| 亚洲精品成人网站在线观看| 日本亚洲视频在线| 亚洲欧洲国产精品你懂的| 亚洲福利电影一区二区?| 亚洲一级毛片免费在线观看| 67194在线午夜亚洲| 亚洲日韩一区精品射精| 国产精品亚洲а∨天堂2021|