1 Reply Latest reply on Aug 9, 2007 10:15 PM by David Mok

    AS2: NetStream playing local file

    David Mok
      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?

        • 1. Re: AS2: NetStream playing local file
          David Mok Level 1
          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");