Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash RTMP闪存播放器_Flash - Fatal编程技术网

Flash RTMP闪存播放器

Flash RTMP闪存播放器,flash,Flash,在Rtmp Flash Player中,我有一个问题,Rtmp url使用我播放过的视频,但当我点击pause btn时,视频消失了。步骤:1复制代码并将以下代码粘贴到fla中 代码: function writeln(msg){ trace_txt.text += msg + "\n"; trace_txt.scroll = trace_txt.maxscroll; } /** * onStatus toggles the Connect button depending on t

在Rtmp Flash Player中,我有一个问题,Rtmp url使用我播放过的视频,但当我点击pause btn时,视频消失了。

步骤:1复制代码并将以下代码粘贴到fla中

代码:
function writeln(msg){
   trace_txt.text += msg + "\n";
 trace_txt.scroll = trace_txt.maxscroll;
}

/**
 * onStatus toggles the Connect button depending on the
 * current connection state, does some clean up when the
 * connection is closed, and sets up the NetStream.
 */
NetConnection.prototype.onStatus = function(info){
 writeln("NetConnection.onStatus> " + info.code);
 if (this.isConnected){
  connection_btn.setLabel("Disconnect");
 }
 else{
  connection_btn.setLabel("Connect");
  if (in_ns){
   in_ns.close();
   in_ns = null;
  }
 }
 if (info.code == "NetConnection.Connect.Success"){
  in_ns = new NetStream(nc);
  in_ns.setBufferTime(2)
  videoViewer.attachVideo(in_ns);
  in_ns.play("sample");
  stopStart_btn.setLabel("Stop");
 }
}

/** Reports connection events in the text field. */
NetStream.prototype.onStatus = function(info){
   writeln("NetStream.onStatus> " + info.code);
}

/** 
 * Connect or disconnect depending on the label of the 
 * Connect button.
 */
function doConnect(btn){
 if (btn.getLabel() == "Connect"){
  if (nc) nc.close();
  nc = new NetConnection();
  if (nc.connect("rtmp://192.168.0.173/vod")){
   btn.setLabel("Wait...");
  }
  else{
   writeln("Bad URI: " + nc.uri);
  }
 }
 else if (btn.getLabel() == "Disconnect"){
  nc.close();
 }
}



/** 
 * Start or stop the stream from playing based on the 
 * label of the stopStart_btn.
 */
function doStopStart(btn){
 if (btn.getLabel() == "Stop"){
    if (in_ns) {
   in_ns.play(false);
   btn.setLabel("Play");
  }
 }
 else {
  if (in_ns){
   in_ns.play("sample");
   btn.setLabel("Stop");
  }
 }
}

/** Pause or unpause the stream. Called by the pause_btn */
function doPause(btn){
 if(in_ns) in_ns.pause();
}

function onChangeTime(cb){
 if(in_ns) in_ns.seek(parseFloat(cb.getValue()))
}

this.onEnterFrame = function(){
 if (in_ns) {
  streamTime_txt.text = in_ns.time;
  streamBuffer_txt.text = in_ns.bufferLength;
 }
}