播放代码

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> 
    <mx:Script> 
        <![CDATA[ 
            import mx.controls.videoClasses.VideoError; 
            import mx.controls.Alert;
            import mx.events.VideoEvent; 
            private var link_url:String = "http://localhost:8000/SOSample/streams/"; 
            private function playFlv():void{ 
                if(VideoEvent.PLAYING == videoPlay.state){ 
                    playButton.label = "播放"; 
                    videoPlay.pause(); 
                }else if(VideoEvent.PAUSED == videoPlay.state){ 
                    playButton.label = "暂停"; 
                    videoPlay.play(); 
                }else if(VideoEvent.STOPPED == videoPlay.state){ 
                    playButton.label = "停止"; 
                    videoPlay.play(); 
                }else{ 
                    videoPlay.source = link_url+filmName.text;  //取得视频的名字
                    volumnHS.value = videoPlay.volume*10;  //视频的声音 
                    playButton.label = "暂停"; 
                } 
                test.text = videoPlay.state;  //视频的状态
            } 
            //播放器调度时调用的事件 
            private function videoProcess():void{ 
                playHS.value=videoPlay.playheadTime; 
                playHS.maximum=videoPlay.totalTime;   //播放时长怎么设置
                if(VideoEvent.REWINDING == videoPlay.state){ 
                    playButton.label = "重播"; 
                } 
                 
            } 
            //快进事件 
           private function changeProcess(event):void{ 
                videoPlay.playheadTime=playHS.value; 
            } 
 
            //声量调整 
            private function changeVolumn(event):void{ 
                videoPlay.volume = volumnHS.value; 
            } 
             
        ]]> 
    </mx:Script> 
    <mx:Panel x="21" y="19" width="359" height="334" layout="absolute"> 
        <mx:VideoDisplay id="videoPlay" x="10" y="9" width="320" height="240" playheadUpdate="videoProcess()" click="playFlv()"/> 
        <mx:HSlider x="10" y="257" width="141" id="playHS" change="changeProcess(event)" /> 
        <mx:HSlider x="272" y="257" width="57" id="volumnHS" change="changeVolumn(event)"/> 
    </mx:Panel> 
   
    <mx:Button x="319" y="361" label="播放" fontSize="12" id="playButton" click="playFlv()" /> 
    <mx:TextInput x="88" y="361" id="filmName" width="223" fontSize="12"/> 
    <mx:Label x="21" y="363" text="录像名:" width="59" fontSize="12"/> 
    <mx:Label x="21" y="409" text="" width="300" fontSize="12" id="test"/> 
</mx:Application>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值