Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The code you have should work however, the appendBytes method was included in Flash Player 10.1 and newer. If you are compiling against anything lower then 10.1, you would get an error similar to the one listed in your question. Check out the following blog post at ByteArray.org, and the example I've included below. I built the example for a different post and I hope it helps you out as well!</p> <p><a href="http://www.bytearray.org/?p=1689" rel="nofollow">AppendBytes</a></p> <hr> <p>Playback Initialization:</p> <pre><code>var video:Video = new Video(width, height); var video_nc:NetConnection = new NetConnection(); var video_ns:NetStream = new NetStream(); video_nc.connect(null); video_ns.play(null); video_ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN); video.attachNetStream(video_ns); </code></pre> <p>ProgressEvent.PROGRESS Handler:</p> <pre><code>video_ns.appendBytes(bytesAvailable); </code></pre> <p>This is essentially the jist of it, bytesAvailable will represent the read bytes from the event data buffer. A full example is listed below:</p> <pre><code>package { import flash.display.Sprite; import flash.events.NetStatusEvent; import flash.events.ProgressEvent; import flash.media.Video; import flash.net.NetConnection; import flash.net.NetStream; import flash.net.NetStreamAppendBytesAction; import flash.net.URLRequest; import flash.net.URLStream; import flash.utils.ByteArray; [SWF(width="1280", height="720")] public class NetStreamAppendBytes extends Sprite { var video:Video; var video_nc:NetConnection; var video_ns:NetStream; var video_stream:URLStream; public function NetStreamAppendBytes() { super(); video_nc = new NetConnection(); video_nc.connect(null); video_ns = new NetStream(video_nc); video_ns.client = this; video_ns.addEventListener(NetStatusEvent.NET_STATUS, ns_statusHandler); video = new Video(1280, 720); video.attachNetStream(video_ns); video.smoothing = true; video_ns.play(null); video_ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN); video_stream = new URLStream(); video_stream.addEventListener(ProgressEvent.PROGRESS, videoStream_progressHandler); video_stream.load(new URLRequest("path_to_flv")); addChild(video); } private function ns_statusHandler(event:NetStatusEvent):void { trace(event.info.code); } private function videoStream_progressHandler(event:ProgressEvent):void { var bytes:ByteArray = new ByteArray(); video_stream.readBytes(bytes); video_ns.appendBytes(bytes); } } } </code></pre> <p>Best of luck!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload