• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

RTMP basics

Contributor ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

Hello, I'm a seasoned ActionScript programmer, yet fairly new to Flash video, FMS, and RTMP.

I've been developing a custom Flash video player, and we now need it to use RTMP with FMS.  Despite my attempts, it is not working. 

Is it required that I use the FLVPlayback component to use RTMP?

I'm using SWFObject to pass parameters into the video player, including the URL to the video.  It works just fine with HTTP requests, but does not work with RTMP:

flashvars.videoPath_100 = "rtmp://e1f1.simplecdn.net/play/_definst_/video/test1.flv";

Is this a correct use of RTMP?  I read something somewhere that vaguely stated you do not use ".flv" at the end of the RTMP call.  Is that correct?

Also, what if I am using mp4 files, is it then like this:

flashvars.videoPath_100 = "rtmp://e1f1.simplecdn.net/play/_definst_/video/test2.mp4";

We are on a tight deadline, and need to get this working asap.  Any insights offered will be greatly appreciated.

Thanks

Views

7.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

You just need to put the instance name so if you have an instance called 'test' it would be rtmp://e1f1.simplecdn.net/test/test1.flv

there is no need to put the sub directories of the instance.

so in your case it should just be:

rtmp://e1f1.simplecdn.net/play/test1.flv

Paul

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

I tried this:

rtmp://e1f1.simplecdn.net/play/test1.flv

But the video still does not load (cannot be found).

I am using http://www.simplecdn.com StormFront service.  According to the account specification, the RTMP URL should look something like this:

rtmp://e1f1.simplecdn.net/play/_definst_/video/<<path_to_your_file>>

Which in my case, would be:

rtmp://e1f1.simplecdn.net/play/_definst_/video/test1.flv

The "video" is the name of the bucket that I set up for the account to hold the video files.

I am interested in what you are saying.  Do you have any more insight into this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

Just try removing .flv and see if it works.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

I tried it without ".flv", and it does not work:

rtmp://e1f1.simplecdn.net/play/_definst_/video/test1

And actually, we are working with MP4s, so might as well treat the issue with MP4.

Although, I do have an FLV file in place for testing.

(that is a different question and issue: what is better to use, MP4 or FLV?)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

You first need to connect to FMS application and then issue play. I am assuming you are doing that.

Say you an have an application named "test" on your FMS and media file named "sample.flv" in streams/_definst_ of "test" application.So in this case you have

flashvars.videoPath_100 = "rtmp://e1f1.simplecdn.net/test/_definst_/sample.flv";.

Now you have to extract ""rtmp://e1f1.simplecdn.net/test" as connection URL and "sample" as stream name for issuing NetStream.play.Also issue NetStream.play with correct parameters(0 for recorded files and -1 for live - as second paramatere) . You are right about thing you say about playign FLV files, you have to skip specifying extension , you just give file name without extension. When you playing mp4, you need to give stream name as "mp4:sample.mp4" if file extension is mp4 or "mp4:sample.f4v" is file extension is f4v (in case if file does not have any extension you just specify "mp4:sample" as stream name.

So in above case if you had "sample.f4v" in streams/_definst_ of "test" application

flashvars.videoPath_100 = "rtmp://e1f1.simplecdn.net/test/_definst_/mp4:sample.f4v";.

Now if your were conecting to different instance say "room" and your file was present under "streams/room/video" then

flashvars.videoPath_100 = "rtmp://e1f1.simplecdn.net/test/room/video/mp4:sample.f4v";. where you should use ""rtmp://e1f1.simplecdn.net/test/room" as your connection url and "video/mp4:sample.f4v" as your stream name.

Hope this answers your question.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

So I need to have the custom video player make a special request to FMS before making this RTMP call?  That might be the issue! I don't know much about FMS.

The code is simply setting up a NetConnection and a NetStream:

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.bufferTime = videoBufferTime;

ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);

var meta:Object = new Object();

ns.client = meta;

video.attachNetStream(ns);

And then when the user clicks "PLAY":

ns.play(currentVideoURL);

Which is the URL we are passing thru SWFObject.

So is there something else that needs to be established with FMS?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 02, 2009 Jul 02, 2009

Copy link to clipboard

Copied

Okay ... after reading the rest of your message, I will go research "NetStream.play" ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

This is great info, and at least pointed me in the right direction, yet I am still not able to get this to work. Here is what I have now:

var nc:NetConnection = new NetConnection();

nc.connect("rtmp://e1f1.simplecdn.net/play/");

// alternately, I've tried this too, as SimpleCDN says that you may or may not need "_definst_" depending on the Flash methods:

// nc.connect("rtmp://e1f1.simplecdn.net/play/_definst_/video");

var ns:NetStream = new NetStream(nc);

ns.bufferTime = videoBufferTime;

ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);

var meta:Object = new Object();

ns.client = meta;

video.attachNetStream(ns);

var st:SoundTransform = new SoundTransform();

ns.soundTransform = st;

// and then later ...

ns.play("video/mp4:test2.mp4");

I get an error when producing the SWF locally:

ArgumentError: Error #2126: NetConnection object must be connected.

(I did not get this error before when doing a (null) connection, and then calling the entire URL for progressive downloading).

When I run it off my web server, the video player acts as if it is broken (probably from having no connection.

I don't get it. Why is a connection not being made?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

FYI - this is actually a connection attempt to the Wowza Server, not strictly FMS.  Should be the same methods, I believe.  Is there any difference?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 03, 2009 Jul 03, 2009

Copy link to clipboard

Copied

Found this little bit of info for Wowza differences:

var wowzaURL:String = "rtmp://localhost/myapplication";
wowza_conn = new NetConnection2();
wowza_conn.objectEncoding = ObjectEncoding.AMF0; 
wowza_conn.connect(wowzaURL);

From this link: http://www.wowzamedia.com/forums/showthread.php?t=257

NetConnection2 ???!!!  What's that?!  I did a web search, and found nothing on it!

Is this true?
Anyway, I tried this with NetConnection, and nothing changed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 04, 2009 Jul 04, 2009

Copy link to clipboard

Copied

Anyone?  Anyone have an insight into this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 04, 2009 Jul 04, 2009

Copy link to clipboard

Copied

Hi miquael,

You were on the right track in seeking (and finding) support at wowzamedia.com/forums/

( Wowza != Adobe ) && ( "Wowza Media Server" != "Flash Media Server" )

These forums are provided by Adobe for support of Adobe products.  And questions posted here (on the "Flash Media Server" forum), are most likely to get answers when ... they are related to applications connecting to Flash Media Servers!  🙂

Best of luck in your development efforts.

g

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 04, 2009 Jul 04, 2009

Copy link to clipboard

Copied

True.  However, since I actually do not know the nature of the problem, which could mean that it might have something do with the actual ActionScript method I'm using, or proper STMP syntax (all of which is Adobe), I am seeking assistance from multiple vantages.

Perhaps I will post this in the ActionScript forum ...

Also, I actually did not find out until yesterday that we are using Wowza and not FMS (although as I understand it, they operate and function very similarly).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 09, 2009 Jul 09, 2009

Copy link to clipboard

Copied

LATEST

I found the solution!  It had primarily to do with using onStatus and/or Event handler controls for both the NetConnection and the NetStream.

It is essential to NOT create the NetStream before the NetConnection is made.  Since the NetConnection can take a few seconds to establish, the NetStream initiation needs to be triggered by a function of onStatus or Event handler of the NetConnection.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines