Skip to main content
Known Participant
August 10, 2007
Question

AS2: NetStream playing local file

  • August 10, 2007
  • 1 reply
  • 308 views
To play a FLV file on the local hard disk,
the manual says that one should do

NetStream.play("file://test.flv")

with test.flv being in the same directory with
the SWV movie. But it doesn't work.
In the onStatus info code, it indicates
a failure to locate the file.

Now, it works if I use

NetStream.play("test.flv")

But still, why the prefix "file://" does
not work?

This topic has been closed for replies.

1 reply

David_MokAuthor
Known Participant
August 10, 2007
Here is my actual code. (There is a video,
and a button on the stage. Click the
button, it should play the stream.)

var mediaNS;
playIt.addEventListener("click", PlayMedia);

function PlayMedia() {
mediaNS.onStatus = function(oData:Object) {
trace(oData.code);
}

// mediaNS.play("file://TestStream22.flv");
mediaNS.play("TestStream22.flv");

}


var nc:NetConnection = new NetConnection();
nc.onStatus = function(info) {
switch (info.code) {
case "NetConnection.Connect.Success":
mediaNS = new NetStream(nc);
myVideo.attachVideo(mediaNS);
mediaNS.publish("media");
break;
case "NetConnection.Connect.Failed":
trace("connection failed");
break;
}
//
}

nc.connect(null);

It works for
// mediaNS.play("file://TestStream22.flv");
mediaNS.play("TestStream22.flv");

But fails for
mediaNS.play("file://TestStream22.flv");
// mediaNS.play("TestStream22.flv");