Skip to main content
Inspiring
December 22, 2009
Question

Connecting To FMS -- What's wrong with this code?

  • December 22, 2009
  • 1 reply
  • 1161 views

Hi, I'm hoping someone here can help me get over this hurdle successfulling streaming video from an FMS.

Here's the code:

// code to link to an FMS
import flash.media.Video;
import flash.media.Video;

var rtmpPath:String="rtmp://142.20.63.76:556/vod/Paediatrics/video0.flv";

// instantiate the video player
var vid:Video = new Video();
addChild(vid);

var vidConnection:NetConnection = new NetConnection();
vidConnection.connect(null);

var vidStream:NetStream = new NetStream(vidConnection);
vid.attachNetStream(vidStream);

// set video location and size
vid.width=240;
vid.height=180;
vid.y = 50;
vid.x = 30;

// Play video stream
vidStream.play(rtmpPath);

Any help will be appreciated, thanks.

    This topic has been closed for replies.

    1 reply

    December 22, 2009

    If I remember correctly, you need to leave off the '.flv' on file path ...

    so, instead of :

    var rtmpPath:String="rtmp://142.20.63.76:556/vod/Paediatrics/video0.flv"

    you want :

    var rtmpPath:String="rtmp://142.20.63.76:556/vod/Paediatrics/video0"

    cheers

    Inspiring
    December 22, 2009

    Thanks, but it didn't work.

    In the publish settings, do I need to switch to "Access network only"?

    Joseph

    Asa_-_FMS
    Adobe Employee
    Adobe Employee
    December 22, 2009

    We're all out of whack here.

    Should be(in crude AS1)

    NetConnection nc = new NetConnection();

    nc.connect("rtmp://server/application/instance")

    NetStream ns = new NetStream(nc);

    ns.play("foo"); // no flv extension

    Asa