# Build my own streaming video player

**URL:** <https://forum.kirupa.com/t/build-my-own-streaming-video-player/299903>\
**Category:** flash\
**Created:** [November 12, 2009, 12:05pm UTC](https://forum.kirupa.com/t/build-my-own-streaming-video-player/299903 "2009-11-12T12:05:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daidai](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daidai/32/3087_2.png) [@daidai](https://forum.kirupa.com/u/daidai)\
**Post date:** [November 12, 2009, 12:05pm UTC](https://forum.kirupa.com/t/build-my-own-streaming-video-player/299903/1 "2009-11-12T12:05:57Z")

</div>

hi all  
Im trying to build my own video player which allows the use of normal video and ones from a streaming server.  
[AS]  
private var videoURL:String = “filename.f4v”;  
private function setupConnection():void  
{  
connection = new NetConnection();  
connection.addEventListener(NetStatusEvent.NET\_STATUS, netStatusHandler);  
connection.addEventListener(SecurityErrorEvent.SECURITY\_ERROR, securityErrorHandler);  
connection.addEventListener(AsyncErrorEvent.ASYNC\_ERROR, onErrorConnect);  
connection.connect(“rtmp://url to my streaming server”);   
}

```
    private function netStatusHandler(event:NetStatusEvent):void 
	{
		trace("event.info.code "+event.info.code);
        switch (event.info.code) {
            case "NetConnection.Connect.Success":
                connectStream();
                break;
			 case "NetStream.Play.Start":
              onPlayVideoHandler();
                break;
            case "NetStream.Play.StreamNotFound":
                trace("Stream not found: " + videoURL);
                break;
			default :
			//trace("default");		
        }			
    }		
	private function onErrorConnect(event:AsyncErrorEvent):void 
	{
        trace("onErrorConnect: " + event);
    }			
    private function securityErrorHandler(event:SecurityErrorEvent):void 
	{
        trace("securityErrorHandler: " + event);
    }
	
    private function connectStream():void 
	{
		stream = new NetStream(connection);
		stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
		stream.bufferTime= 10;
		
		var metaListener:Object = new Object();
		metaListener.onMetaData = theMeta;
		stream.client = metaListener;
		
		var video:Video = new Video();
		video.attachNetStream(stream);
		video.deblocking= 3;
		stream.play(videoURL);
		addChild(video);
    }[/AS]

```

the NetConnection traces im getting are :  
event.info.code NetStream.Play.Reset  
event.info.code NetStream.Play.Start  
event.info.code NetStream.Play.Stop  
event.info.code NetStream.Buffer.Flush

but no video ever gets added/played…any idea why? what am i doing wrong?

I know the video works as we’ve tested it in our jwplayer.

many thanks  
daidaidaiai  
🥚
