Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Play.StreamNotFound

Copy link to clipboard
Copied
I'm trying to add a rtmp stream on my stage. But i'm getting the following error. I have added my code here. Please check my code here and suggest me how to fix the code.
Error:
NetConnection.Connect.Success
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Play.StreamNotFound
at main/attachnetstream()[/Users/user/Desktop/ojotha/main.as:27]
Code:
package {
import flash.display.MovieClip;
import flash.net.*;
import flash.events.NetStatusEvent;
import flash.media.Video;
import flash.events.Event;
public class main extends MovieClip {
public var streamserver:String="rtmp://216.245.200.114/live/";
public var streamname:String="shomoy";
public var netconnection:NetConnection=new NetConnection();
public function main() {
netconnection.connect(streamserver);
netconnection.addEventListener(NetStatusEvent.NET_STATUS, attachnetstream);
}
public function attachnetstream(event:NetStatusEvent):void{
trace(event.info.code);
switch (event.info.code) {
case "NetConnection.Connect.Success":
var video:Video=new Video();
var netstream:NetStream=new NetStream(netconnection);
video.attachNetStream(netstream);
netstream.play(streamname);
video.height=480;
video.width=640;
addChild(video);
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: ");
break;
}
}
}
}
Copy link to clipboard
Copied
if
netconnection.connect(streamserver); is line 27, you're not connecting. |

