You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Need help configure RTMP Streaming SimpleCDN Created Nov 18, 2009

This thread is solved

Views: 3752     Replies: 4     Last reply Aug 8, 2011  
You must login first before you can use this feature

jb123

Posts: 31

Registered:
Oct 16, 2009

Need help configure RTMP Streaming SimpleCDN

Posted: Nov 18, 2009

Hello everyone,

I recently purchased the commercial version of Flowplayer and currently have it configured fine for progressive download of .flv, mp4 videos and .mp3 audio. I would greatly appreciate some help/advice how to configure RTMP streaming with SimpleCDN.

I submitted the following ticket to simpleCDN - I don't know how long it will take for them to respond. I'll post theire reply here for the benefit of others.

Thanks!

Jerry

++++++++++++++++++++++++++++++++++++++++++++

How to configure RTMP streaming with Flowplayer
Hello,

I tried your CDN service this week. I love it and think you have a terrific service that I will recommend to colleages.

It was "simple" and "fast" to set up and integrate with my web applicaton which currently implements progressive
download with Flowplayer.

It took about 10 minutes including creating my account with simpleCDN and modifiying my exisiting JavaScript and
PHP code to point to simpleCDN for videos, etc. instead of my webserver. Naturally, FTPing all of my content
to simpleCDN took a tad more time :>

I have never implemented RTMP streaming (I only recently began to work with video).

MY PROBLEM
I can't figure out how to modify my existing code (for progresive download) to get RTMP streaming to work.
Your help is greatly appreciated.

I am using the latest commercial version of Flowplayer.

HERE'S MY WORKING CODE FOR PROGRESSIVE DOWNLOAD (I changed my webserver's domain to "example")

Please note that I have downloaded the Flowplayer RTMP Streaming Plugin (flowplayer.rtmp-3.1.3.swf) and I placed it
in the same folder as my Flowplayer (flowplayer.commercial-3.1.5.swf). I also have the Flowplayer Audio plugin installed (flowplayer.audio-3.1.2.swf)

PROGRESSIVE DOWNLOADED VIDEO

THE FOLLOWING CODE WORKS FINE TO DISPLAY PROGRESSIVE DOWNLOADED VIDEOS(.flv, .mp4 and .mp3).

//PHP Page that renders html and video to browser

function playVideo(myVideoUrl) {

flowplayer("player", {src: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.commercial-3.1.5.swf', wmode: 'opaque'}, {

key: 'examplekey#',

clip: {
autoPlay: true,
autoBuffering: true,
baseUrl: 'http://www.example.com/pages/',

//to cloak the url/folder where videos are located we pass the videoID to a PHP page
//to return the complete URL to Flowplayer

url: escape('play.php?vid=' + myVideoUrl),

scaling: 'scale',
}
},

plugins:{
controls:{
autoHide: 'always'
}
},
}
);
}

/http://www.example.com/pages/play.php

$vid = (isset($_GET['vid']))? $_GET['vid'] : '';

//video urls are stored in an xml and file and the path to the video is retrieved from the xml here

$xml = simplexml_load_file("videos.xml");
$video = $xml->xpath("//*[id='$vid']");
$videourl = http://e1.simplecdn.net/exampleuploadbucket/video" . "{$video[0]->videourl}";

//this shows the exploded url that is returned to Flowplayer
//$videourl = http://e1.simplecdn.net/exampleuploadbucket/video/filename.mp4"; // or filename.flv or filename .mp3

#echo $videourl;
header("Location: $videourl");
?>

RTMP STREAMING VIDEO

THE FOLLOWING CODE LOADS THE FLOWPLAYER BUT MY CONFIGURATION IS WRONG BECAUSE FLOWPLAYER DISPLAYS AN ERROR
THAT IT CAN'T FIND MY SPECIFIED VIDEO FILE.
200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] 'play.php?vid=100'
(where 100 is the correct videoID of my specified video I'm trying to stream)

I have reviwed the sample code on Flowplayer.org and and SimpleCDN.com and I can't figure out how to make this work.

I noticed the following line in the SimpleCDN sample code:
'mp4:sfexamples/videos/bbb_640x360_h264.mp4',

I know I am not following that syntax and is this indicating that I will have to preface each video file path by its
file extension? If so, I will have to change the format that I am storing content URLs and then do some work to
generate the correct prefix for each video's path - I don't understand why simpleCDN or Flowplayer would not do this under
the covers if it really needs to be done. Then again, I'm sure there's a "simple" solution that you folks know :>

Thank you in advance for your help.

//PHP Page that renders html and video to browser

function playVideo(myVideoUrl) {

flowplayer("player", {src: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.commercial-3.1.5.swf', wmode: 'opaque'}, {

key: 'examplekey#',

clip: {
autoPlay: true,
autoBuffering: true,
baseUrl: 'http://www.example.com/pages/',

//to cloak the url/folder where videos are located we pass the videoID to a PHP page
//to return the complete URL to Flowplayer

url: escape('play.php?vid=' + myVideoUrl),

//for simpleCDN RTMP streming
provider: 'simplecdn',

scaling: 'scale',
}
},

plugins:{

controls:{
autoHide: 'always'
},

//for simpleCDN RTMP streming
simplecdn: {
url: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.rtmp-3.1.3.swf',
netConnectionUrl: 'rtmpt://e1f1.simplecdn.net/play'
}
},
}
);
}

/http://www.example.com/pages/play.php

$vid = (isset($_GET['vid']))? $_GET['vid'] : '';

//video urls are stored in an xml and file and the path to the video is retrieved from the xml here

$xml = simplexml_load_file("videos.xml");
$video = $xml->xpath("//*[id='$vid']");

//simpleCDN RTMP stream location
$videourl = "rtmp://e1f1.simplecdn.net/play/_definst_/exampleuploadbucket/video" . "{$video[0]->videourl}";

//this shows the exploded url that is returned to Flowplayer
//$videourl = http://e1.simplecdn.net/exampleuploadbucket/video/filename.mp4"; // or filename.flv or filename .mp3";

#echo $videourl;
header("Location: $videourl");
?>

Cheers!

Jerry Bruckner

Christian Ebert
Flowplayer support

Posts: 2803

Registered:
May 27, 2008

» Need help configure RTMP Streaming SimpleCDN

Posted: Nov 18, 2009

Reply to: Need help configure RTMP Streaming SimpleCDN , from jb123
Yes, you have to prefix the url (the path inside your upload bucket) with mp4:, mp3:, or flv:. Probably tells the rtmp server what kind of stream to expect.

Why do you still need to hide the url? I don't think anyone has access to the file except those who also have access to the bucket, and it's not a full uri anyway.

P.S. Could you please write your code inside formatting tags, it's very hard to read. There's a formatting help popping up once you start editing a message. Thanks.

jb123

Posts: 31

Registered:
Oct 16, 2009

» » Need help configure RTMP Streaming SimpleCDN

Posted: Nov 18, 2009

Reply to: » Need help configure RTMP Streaming SimpleCDN , from blacktrash
Thanks Blacktrash for the quick reply.

I forgot to use wrap my code in code tags. Thanks for the reminder to do so.

Ok, I see you say the prefix is what's missing in my code. I'll try a little later today to add the prefix and see if it works.

Thanks!

-JB

........................................................

Hello everyone,

I recently purchased the commercial version of Flowplayer and currently have it configured fine for progressive download of .flv, mp4 videos and .mp3 audio. I would greatly appreciate some help/advice how to configure RTMP streaming with SimpleCDN.

I submitted the following ticket to simpleCDN - I don't know how long it will take for them to respond. I'll post theire reply here for the benefit of others.

Thanks!

Jerry

++++++++++++++++++++++++++++++++++++++++++++

How to configure RTMP streaming with Flowplayer
Hello,

I tried your CDN service this week. I love it and think you have a terrific service that I will recommend to colleages.

It was "simple" and "fast" to set up and integrate with my web applicaton which currently implements progressive
download with Flowplayer.

It took about 10 minutes including creating my account with simpleCDN and modifiying my exisiting JavaScript and
PHP code to point to simpleCDN for videos, etc. instead of my webserver. Naturally, FTPing all of my content
to simpleCDN took a tad more time :>

I have never implemented RTMP streaming (I only recently began to work with video).

MY PROBLEM
I can't figure out how to modify my existing code (for progresive download) to get RTMP streaming to work.
Your help is greatly appreciated.

I am using the latest commercial version of Flowplayer.

HERE'S MY WORKING CODE FOR PROGRESSIVE DOWNLOAD (I changed my webserver's domain to "example")

Please note that I have downloaded the Flowplayer RTMP Streaming Plugin (flowplayer.rtmp-3.1.3.swf) and I placed it
in the same folder as my Flowplayer (flowplayer.commercial-3.1.5.swf). I also have the Flowplayer Audio plugin installed (flowplayer.audio-3.1.2.swf)

PROGRESSIVE DOWNLOADED VIDEO

THE FOLLOWING CODE WORKS FINE TO DISPLAY PROGRESSIVE DOWNLOADED VIDEOS(.flv, .mp4 and .mp3).

//PHP Page that renders html and video to browser

function playVideo(myVideoUrl) { 

flowplayer("player", {src: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.commercial-3.1.5.swf', wmode: 'opaque'}, {

key: 'examplekey#',

clip: {
autoPlay: true,
autoBuffering: true,
baseUrl: 'http://www.example.com/pages/',

//to cloak the url/folder where videos are located we pass the videoID to a PHP page 
//to return the complete URL to Flowplayer

url: escape('play.php?vid=' + myVideoUrl), 

scaling: 'scale', 
} 
},

plugins:{
controls:{
autoHide: 'always'
}
},
}
);
}

/http://www.example.com/pages/play.php 

$vid = (isset($_GET['vid']))? $_GET['vid'] : '';

//video urls are stored in an xml and file and the path to the video is retrieved from the xml here

$xml = simplexml_load_file("videos.xml");
$video = $xml->xpath("//*[id='$vid']");
$videourl = http://e1.simplecdn.net/exampleuploadbucket/video" . "{$video[0]->videourl}";

//this shows the exploded url that is returned to Flowplayer
//$videourl = http://e1.simplecdn.net/exampleuploadbucket/video/filename.mp4"; // or filename.flv or filename .mp3 

#echo $videourl;
header("Location: $videourl");
?>

RTMP STREAMING VIDEO


THE FOLLOWING CODE LOADS THE FLOWPLAYER BUT MY CONFIGURATION IS WRONG BECAUSE FLOWPLAYER DISPLAYS AN ERROR
THAT IT CAN'T FIND MY SPECIFIED VIDEO FILE.

200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] 'play.php?vid=100' 
(where 100 is the correct videoID of my specified video I'm trying to stream)
I have reviwed the sample code on Flowplayer.org and and SimpleCDN.com and I can't figure out how to make this work.

I noticed the following line in the SimpleCDN sample code:

'mp4:sfexamples/videos/bbb_640x360_h264.mp4',

I know I am not following that syntax and is this indicating that I will have to preface each video file path by its
file extension? If so, I will have to change the format that I am storing content URLs and then do some work to
generate the correct prefix for each video's path - I don't understand why simpleCDN or Flowplayer would not do this under
the covers if it really needs to be done. Then again, I'm sure there's a "simple" solution that you folks know :>

Thank you in advance for your help.



//PHP Page that renders html and video to browser

function playVideo(myVideoUrl) { 

flowplayer("player", {src: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.commercial-3.1.5.swf', wmode: 'opaque'}, {

key: 'examplekey#',

clip: {
autoPlay: true,
autoBuffering: true,
baseUrl: 'http://www.example.com/pages/',

//to cloak the url/folder where videos are located we pass the videoID to a PHP page 
//to return the complete URL to Flowplayer

url: escape('play.php?vid=' + myVideoUrl),

//for simpleCDN RTMP streming
provider: 'simplecdn',

scaling: 'scale', 
} 
},

plugins:{

controls:{
autoHide: 'always'
},

//for simpleCDN RTMP streming
simplecdn: { 
url: 'http://e1.simplecdn.net/exampleuploadbucket/video/flowplayer.rtmp-3.1.3.swf',
netConnectionUrl: 'rtmpt://e1f1.simplecdn.net/play' 
} 
},
}
);
}

/http://www.example.com/pages/play.php 

$vid = (isset($_GET['vid']))? $_GET['vid'] : '';

//video urls are stored in an xml and file and the path to the video is retrieved from the xml here

$xml = simplexml_load_file("videos.xml");
$video = $xml->xpath("//*[id='$vid']");

//simpleCDN RTMP stream location
$videourl = "rtmp://e1f1.simplecdn.net/play/_definst_/exampleuploadbucket/video" . "{$video[0]->videourl}";

//this shows the exploded url that is returned to Flowplayer
//$videourl = http://e1.simplecdn.net/exampleuploadbucket/video/filename.mp4"; // or filename.flv or filename .mp3"; 

#echo $videourl;
header("Location: $videourl");
?>
Cheers!

Jerry Bruckner

jb123

Posts: 31

Registered:
Oct 16, 2009

Sample to configure Flowplayer for RTMP Streaming with SimpleCDN

Posted: Nov 19, 2009

Reply to: » » Need help configure RTMP Streaming SimpleCDN , from jb123
Hello Blacktrash,

Adding the appropriate url prefix did the trick and RTMP streaming is now working on my site.

I'm learning step by step how to work with Flowplayer and video.

Now that I have RTMP streaming working I'll take a look at the secure plugin.

I included a sample for the benefit of other folks to show how to configure Flowplayer for RTMP Streaming with SimpleCDN. I decided to use simple JavaScript to handle adding the appropriate URL prefix.

Thanks again for your help!

-JB


//Sample to configure Flowplayer for RTMP Streaming with SimpleCDN

function playVideo(videoUrl) {

	//Different CDN providers have different syntax rules for how 
	//the video URL is passed to them.
	//Sometimes they want the url to contain the file extension 
	//and sometimes they don't.
	//simpleCDN requires the file extension AND also a URL prefix
	//to match the file extension.
	//Examples:
	//	URL = flv:<your upload bucket location>.flv
	//	URL = mp4:<your upload bucket location>.mp4
	//	URL = mp3:<your upload bucket location>.mp3	
	if (videoUrl.match(/.flv/) ) {
		videoUrl = 'flv:<your upload bucket location>' + videoUrl;
	} else if (videoUrl.match(/.mp4/) ) {
		videoUrl = 'mp4:<your upload bucket location>' + videoUrl;
	} else if (videoUrl.match(/.mp3/) ) {
		videoUrl = 'mp3:<your upload bucket location>' + videoUrl;
	} 
	

    flowplayer("player", {src: 'flowplayer.3.1.5.swf', wmode: 'opaque'},{
	
			clip: {
				autoPlay: true,
				autoBuffering: true,					

				provider: 'simplecdn',
				url: videoUrl,

				scaling: 'scale'										
			},
			
			plugins:{
			
				simplecdn: {         
					url: 'flowplayer.rtmp-3.1.3.swf',					
					netConnectionUrl: 'rtmpt://e1f1.simplecdn.net/play' 
				}				
			},			
		}
	);
}