I’m having trouble with NetStream in AS3. The project I am working on allows users to browse a video (locally) and play it back. The issue I am having is that netStream.seek(0);
from what I can tell it doesn’t do anything, although I get inside a NetStatusEvent function and NetStream.Seek.Notify
is triggered. I’m using NativeProcess and the following function is this makes any difference.
public function ProgressEventOutputHandler(e:ProgressEvent):void {
videoByteArray = new ByteArray();
nativeProcess.standardOutput.readBytes(videoByteArray, 0, nativeProcess.standardOutput.bytesAvailable);
netStream.appendBytes(videoByteArray);
}
Am I missing something here? I am pausing netStream before using netStream.seek(0);
.
EDIT:
In an attempt to fix this issue I’ve tried the following (following advise of using 2 byte arrays):
-
Moved videoByteArray = new ByteArray(); to my init function and also created tempVideoByteArray = new ByteArray(); in this function.
-
Update my ProgressEventOutputHandler function so that it no longer
created a new ByteArray for videoByteArray and changed this line -nativeProcess.standardOutput.readBytes(videoByteArray, videoByteArray.length, nativeProcess.standardOutput.bytesAvailable);
I have changed nothing else and now the video will not load. If I allow a new ByteArray to be created inside the ProgressEventOutputHandler function the video does load again.