tags:

views:

11

answers:

2

In Rtmp Flash Player i hav one problem, Rtmp url using i had played video, but when i hit pause btn, video is gone ,any sample code for that.. urgent pls help me

A: 

I recommend checking out the OSMF project for your video needs. Simplifies it all. http://www.opensourcemediaframework.com/

Chad Udell
A: 

step :1 Copy the code and paste the following code in to your fla

code :

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; } }

Ganesh