# Flash keeps crashing when I try and play a live video from netstream

**URL:** https://forum.kirupa.com/t/flash-keeps-crashing-when-i-try-and-play-a-live-video-from-netstream/324430
**Category:** flash
**Created:** [August 20, 2011, 5:13pm UTC](https://forum.kirupa.com/t/flash-keeps-crashing-when-i-try-and-play-a-live-video-from-netstream/324430 "2011-08-20T17:13:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pixelvoodoo425](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@pixelvoodoo425](https://forum.kirupa.com/u/pixelvoodoo425)
#### Post date: [August 20, 2011, 5:13pm UTC](https://forum.kirupa.com/t/flash-keeps-crashing-when-i-try-and-play-a-live-video-from-netstream/324430/1 "2011-08-20T17:13:20Z")

</div>

Hi,

My video player keeps crashing.

Works fine on pre-recorded video streams but when I try and connect to a live video stream it crashes. This is happening in the browser and in the Flash application. If I remove the live netstream the player works fine.

Am I missing something with the setup for a live stream?

No idea how to debug?

```auto

var nc:NetConnection = new NetConnection();
var ns:NetStream;

netConnectionDir = "rtmp://videoserverurl/"
streamURL = "video"

//Removes two error messages from stopping the player working
nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

function onNetStatus(evt:NetStatusEvent):void {
    if (evt.info.code =="NetConnection.Connect.Success") {
        
        ns = new NetStream(nc);
        ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
        ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
        
        var myVideo:Video = new Video(768,432);
        
        myVideo.attachNetStream(ns);
        
        addChild(myVideo);

    };
};

//The streaming URL
nc.connect(netConnectionDir,true);

//Removes further error messages that stop the player working
function asyncErrorHandler(event:AsyncErrorEvent):void{
   //ignore error; 
}

NetConnection.prototype.onBWDone = function(p_bw) {
   //trace("onBWDone: "+p_bw);
}

NetConnection.prototype.onBWCheck = function() {
   return ++counter;
}

mcPlay.addEventListener(MouseEvent.CLICK, fcPlayVideoClick);
mcPlay.addEventListener(MouseEvent.ROLL_OVER, fcPlayVideoRollover);
mcPlay.addEventListener(MouseEvent.ROLL_OUT, fcPlayVideoRollout);
mcPlay.buttonMode = true;

function fcPlayVideoClick(e:MouseEvent):void {
        ns.play(streamURL, true);
}

```
