Search code examples
actionscript-3flash-cs4flash-cs5flash-cs3

I am trying to play .m4a file using stream method. but its not working


var video:Video = new Video();
addChild(video);
var netCon:NetConnection = new NetConnection();
netCon.connect(null);
var streamNS:NetStream = new NetStream(netCon);
//streamNS.client = this;
//video.attachNetStream(streamNS);
streamNS.play("AfricanElengwen.m4a");
streamNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

function netStatusHandler(e:NetStatusEvent):void
{
    if (e.info.code == "NetStream.Play.FileStructureInvalid")
    {
        trace("The MP4's file structure is invalid.");
    } else if (e.info.code == "NetStream.Play.NoSupportedTrackFound")
    {
        trace("The MP4 doesn't contain any supported tracks");
    }
}

I get this code from the below link, http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player.html#articlecontentAdobe_numberedheader_0

I didn't get any error. Can anyone say what is the bug?


Solution

  • May be your .m4a file bit rate or something unsupportable to the flash player. Better way is u can convert it into a mp3 file and then use it.