X秒后暂停FLV视频

时间:2014-09-03 09:19:45

标签: actionscript-3 stream flv

我正在播放一个flv视频,我需要在第15秒暂停流。比用户交互后(在点击按钮后)恢复流。

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");

1 个答案:

答案 0 :(得分: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
 }