2014-09-03 87 views
0

我正在流FLV视频,我需要暂停15秒的流。比在用户交互之后(在按下按钮之后)恢复流。X秒后暂停FLV视频

var connection:NetConnection; 
var stream:NetStream; 
var video:Video; 

connection = new NetConnection(); 

connection.connect(null); 

stream = new NetStream(connection); 

stream.client = this; 

video.attachNetStream(stream); 

stream.bufferTime = 1; 

stream.receiveAudio(true); 

stream.receiveVideo(true); 

stream.play("Cashwave.flv"); 

回答

0

只需添加一个计时器并在需要时停止播放。 类似这样的:

//EDIT: import timer class like this 
import flash.utils.Timer; 

var timer:Timer = new Timer(15000,1); 
timer.addEventListener(TimerEvent.TIMER, pauseMyVideo); 
timer.start(); 

function pauseMyVideo(e:TimerEvent.TIMER) { 
    stream.pause(); 
    // do other stuff like add resume button 
} 
+0

它给了我这个:1046:Type找不到或者不是编译时常量:TIMER。 – 2014-09-03 10:55:53

+0

尝试导入Timer类。 import flash.utils.Timer; – gabriel 2014-09-03 11:34:11