2014-09-03 66 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