Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Embedding flash player for Red5


Hi there,

I've searched through many tutorials, and am having a real problem understanding how to embed a .FLV file onto an HTML page to play through this (or any) swf flash player - using red5 streaming server.

(the red5 server is located in /usr/lib/red5/

My host installed red 5 on a linux , and i've placed the flv i wish to play in the streams folder of the oflaDemo folder.

Currently my embed code looks like:

<embed src="http://www.mydomain/seantest/flv_demo.swf" FlashVars="file=rtmp://127.0.0.1/oflaDemo&id=turningofthetide" quality="high" bgcolor="#ffffff" width="330" height="270" name="turningofthetide" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

What am i doing wrong?

78 Community Answers

JW Player

User  
0 rated :

I have also read the FAQ's.

Sorry for such a newbie question, but any help would be REALLY appreciated!

JW Player

User  
0 rated :

maybe a forum search for [url=http://www.jeroenwijering.com/?search=Red5]red5[/url] have a solution?

JW Player

User  
0 rated :

I can't find anything that helps there.

What really confuses me, is that many of the tutorials tell you how to use the streaming server on your LOCAL machine...

What about real life examples when its installed on a remote server that people on the internet are going to view? How do you reference the flv file thats on a remote server contained within a directory that's not in a public html folder? :s

JW Player

User  
0 rated :

_How do you reference the flv file thats on a remote server contained within a directory that's not in a public html folder?_

im not sure that is possible, for security reasons...

JW Player

User  
0 rated :

So does this mean that the default installation for red5 is wrong?

By default it installs in /usr/lib/red5 on a linux server.

What is the practical use of this, when many people are going to use it to stream flash videos to their website visitors?

JW Player

User  
0 rated :

sorry, i might have misunderstood...
i have no experience with red5, -
but i have noticed that one can not access local files from an online player and vice versa...

JW Player

User  
0 rated :

Ah ok,

So an online website wishing to run red5 to serve video content to their visitors will basically not work?

Is this server just for people wishing to play around with it on their local machine or internal networks, and NOT for real websites?

What is the point of the red5 server then? Seems really weird to me to have such a server that cannot serve outside of the local machine!! :s :$

JW Player

User  
0 rated :

my definite impression is that red5 *can* serve files online for online players, but alas i havent tried...

JW Player

User  
0 rated :

Here are four examples of various online/offline combinations using the Red5 RTMP streaming server.
bc.. <html>

<head>

<title>Sean - Red5 - Online-Offline</title>

</head>

<body>

<h3>Online - Online</h3>
<embed src="http://my.domain.com/php/mediaplayer.swf"
quality="best"
bgcolor="#ffffff"
width="330"
height="270"
name="player"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=rtmp://my.domain.com/oflaDemo&id=videofilename&width=330&height=270"
/>

<h3>Online - Offline</h3>
<embed src="http://my.domain.com/php/mediaplayer.swf"
quality="best"
bgcolor="#ffffff"
width="330"
height="270"
name="player"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=rtmp://127.0.0.1/oflaDemo&id=videofilename&width=330&height=270"
/>

<br />

<h3>Offline - Online</h3>
<embed src="http://127.0.0.1:8085/php/mediaplayer.swf"
quality="best"
bgcolor="#ffffff"
width="330"
height="270"
name="player"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=rtmp://my.domain.com/oflaDemo&id=videofilename&width=330&height=270"
/>

<h3>Offline - Offline</h3>
<embed src="http://127.0.0.1:8085/php/mediaplayer.swf"
quality="best"
bgcolor="#ffffff"
width="330"
height="270"
name="player"
align="middle"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
flashvars="file=rtmp://127.0.0.1/oflaDemo&id=videofilename&width=330&height=270"
/>

</body>

</html>

JW Player

User  
0 rated :

It doesn't work. The demo's that come with red5 play fine through their swf's...

So i just don't get it, why it would not play when i embed the code...

Anyone? 8)

JW Player

User  
0 rated :

Do you have a test stream available?

Have you opened port 1935 for RTMP in your firewall?

I noticed two mistakes in my sample code above.

This line should point to your media player:
bc.. <embed src="http://127.0.0.1:8085/php/mediaplayer.swf"


Something like this:
bc.. <embed src="http://127.0.0.1/path-to-file/mediaplayer.swf"


Or this:
bc.. <embed src="http://my.domain.com/path-to-file/mediaplayer.swf"



The Red5 server works fine both online and offline, so there is something in your configuration that needs changing.

JW Player

User  
0 rated :

I've figured it was a falty configured swf player, rather than pointing to it.

However, as a security precaution is there a way of only accessing the .flv file via localhost in the address in flashvars, rather than putting in the ip/hostname?

I've noticed that i can copy the embed code and put it onto another website and it will play the swf and flv file that sits on my red5 server. Obviously this is giving people the opportunity to steal bandwidth and video's which i only want to play on the site.

Do you know where i'd look to configure that?

JW Player

User  
0 rated :


"I've searched through many tutorials, and am having a real problem understanding how to embed a .FLV file onto an HTML page to play through this (or any) swf flash player - using red5 streaming server."

the idea of streaming a file is to watch while you download you shouldnt embed the flv (also i think is not posible to embed an flv using rtmp) , you should get the flv throught red5 and flash using NetConnection object.

JW Player

User  
0 rated :

You should try reading basic red5 application with Flash to get idea over this problem. Try here

http://sunil-gupta.blogspot.com

JW Player

User  
0 rated :

Hey Sean,

I am having the same problem of accessing my red5 application outside of the localhost. I have been reading and searching but found no answer.

Is it possible to reference my application???

my server is for example: 123.456.22.22

in my localhost I can simply do : http://123.456.22.22/oflaDemo or http://localhost/oflaDemo or rtmp://123.456.22.22/oflaDemo

... and from a different server I cannot do any of the above.. I trie changing the virtual hosts for oflaDemo and nothing!!! I really need a solution.

JW Player

User  
0 rated :

Make sure that port 1935 for the RTMP is open in your firewall.

If you are using Red5 to serve the HTML, SWF, XML, etc. on port 5080 (the default), make sure that port is open in yur firewall.

JW Player

User  
0 rated :

Here are 10 quick reason of why to choose Red5 over FMS.

http://red5flashserver.blogspot.com/2008/04/10-quick-reasons-of-why-to-choose-red5.html

JW Player

User  
0 rated :

Hi,
i have check this code but here is not run in my script. here is using my code below

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="<? echo $gamewidth;?>" height="<? echo $gameheight;?>" id="FlashContent">
<param name="movie" value="<?=$gamefile;?>" />
<param name="quality" value="high" />
<param name="AllowScriptAccess" value="never" />
<param name="wmode" value="opaque" />
<embed width="<?=$gamewidth;?>" height="<?=$gameheight;?>" src="<?=$gamefile;?>" quality="high" name="FlashContent" allowscriptaccess="never" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque"></embed>
</object>

JW Player

User  
0 rated :

Hi,

I have tried embedding a flv that I recorded to the Red5 server. The ones that are pre-recorded examples i.e. IronMan, Spiderman etc. play fine with the code but the ones I have captured using the webcam with flex don't play video they only play sound. I am trying to understand what the difference is between the two files that prevents the one that is being saved to the server via webcam from playing properly.

This is my code:

<embed src="http://mysite/player.swf" bgcolor="#ffffff" width="330" height="270" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=rtmp://mysite/myvideo.flv&width=330&height=270"/>

Is there a flashvar that can be set? Or am I not capturing the adaquate data when I save the file to the server for it to be played back by the flash player?

Please help!

Thanks,

Sarah

JW Player

User  
0 rated :

hi i am new to red5 i need how to embedd flv video on html for streaming
i tried above but it is not working
can any one help me out from this
Thanks

JW Player

User  
0 rated :

@Girish,

Post your player code so someone can help you further.

JW Player

User  
0 rated :

this is my player code

<embed type="application/x-shockwave-flash" src="http://www.jeroenwijering.com/upload/player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="rtmp://localhost/oflaDemo/DarkKnight.flv" width="420" height="250"/>

JW Player

User  
0 rated :

Hi KLink

Thank you very much

it is working well

JW Player

User  
0 rated :

Hi kLink

How to get best performance for streaming videos in red5 server

I greatly appreciate your time

Thanks in advance

JW Player

User  
0 rated :

Encode the video at the same size as you want to display in the player; for example 320x240.

Encode at a reasonable bitrate for "good enough" quality; probably about 512kbps.

Encode at a sensible framerate; about 20fps.

Don't make too many keyframes; one every 3-5 seconds is usually enough.

In general, don't make the video stream so large that it overloads the available bandwidth and don't ever re-size on the client.

As soon as Red5 with MP4/H.264 streaming is available (probably v.9 early 2009), start using MP4s encoded with H.264 video.

JW Player

User  
0 rated :

Thank you very much

JW Player

User  
0 rated :

After installing Red5 server when I visit the URL(http://localhost:5080/), I get following error

"HTTP ERROR: 404NOT_FOUND
RequestURI=/
Powered by jetty://"

I'm facing this issue only in one pc. Its working fine in other pcs. I re-installed the red5 server couple of times but it did not help.


I greatly appreciate your time

Thanks in advance

JW Player

User  
0 rated :

Hi
kLink

is it possible to stream from subdirectories other than from a fixed root path? We have a file structure with different directories and want to stream based on the path passed to the application from the client

Thanks in advance

JW Player

User  
0 rated :

You can easily stream from subdirectories of oflaDemo/streams, like oflaDemo/streams/Movies or oflaDemo/streams/Videos.

bc.. 'streamer':'rtmp://www.mydomain.com/oflaDemo',
'file':'Movies/TheLastSon.flv',
OR
'file':'Videos/TheFunnyMoment.flv',




JW Player

User  
0 rated :

Hi kLink

Thanks a lot

JW Player

User  
0 rated :

Hi kLink

i am facing problem in embedding a flash video
your code is working in firefox but in ie6 all other browsers not working

JW Player

User  
0 rated :

Please provide a link to the test page that doesn't work in IE6 and all other browsers.

JW Player

User  
0 rated :

Hi kLink

this is my code to embedd flash player

<object type="application/x-shockwave-flash" data="player.swf"/> <param name="quality" value="high">
<param name="wmode" value="opaque"> <param name="flashvars" value="streamer=rtmp://localhost/jym/&file=">"

this code displays flash player in all browsers except in IE
flash player is not visible in IE

JW Player

User  
0 rated :

IE needs a different form of the object code, often referred to as double-object code. You cna see examples here:

*http://code.google.com/p/swfobject/wiki/documentation*

deano posted a form of the object code that works in all browsers here:

*http://www.longtailvideo.com/support/forum/Setup-Problems/3615/XHTML-Validation#msg93251*

JW Player

User  
0 rated :

I am using same code used by the deano

*http://www.longtailvideo.com/support/forum/Setup-Problems/3615/XHTML-Validation#msg93251*

i am unable to view the player in IE

if i right click on the place where embed the player
it is displaying *movie not loaded..* ,*About Adobe Flash Player 10 .. *

JW Player

User  
0 rated :

The object/embed code is very problematic. I would suggest that you use swfobject v2 and JavaScript to embed your Flash Player.

JW Player

User  
0 rated :

But i need to embedd code in javascript only ...is it possible to call this function from javasript file then how

Thanks

JW Player

User  
0 rated :

@Girish,

Sorry, I can't understand your question.bc.. "But i need to embedd code in javascript only ...is it possible to call this function from javasript file then how"
Please explain, in greater detail, what you want to do.

JW Player

User  
0 rated :

now in my website using javascript i am embedding flash player code dynimically for each thumbnail to streaming their corresponding video

JW Player

User  
0 rated :

@Girish,

Can you post a link to your website?

It would be helpful if I could see just where you are and what the difficulty is.

JW Player

User  
0 rated :

Hi kLink
That problem is solved

JW Player

User  
0 rated :

In youtube streaming , video buffers then playing
In youtube once video buffers we can play video in many times with intruption

what my question is

*How can we stream video like youtube *
*Is this flash player feature or we have to write program in red5 server*

JW Player

User  
0 rated :

Youtube uses LightTPD servers, probably with highly optimized mod_xxxx_streaming modules.

So install LightTPD and then hire lots of developers.

If you are running *nix on your servers, the LightTPD mod_h264_streaming works well, it will be available for Windows soon.

JW Player

User  
0 rated :

Hi kLink

can you tell me how to achieve buffering in red5 server

Thanks

JW Player

User  
0 rated :

Hi kLink

can you tell me how to achieve buffer streaming in red5 server

Thanks

JW Player

User  
0 rated :

Hi,

Is it possible to buffer video stream on client side player, when it is being streamed by Red5 Media Server, like YouTube does... If yes, how can we do it...


Thanks In Advance,
Girish

JW Player

User  
0 rated :

Hi Girish

I would just like to know how you solved your problem with

"now in my website using javascript i am embedding flash player code dynimically for each thumbnail to streaming their corresponding video"

I am having that same problem now...

Thanks

JW Player

User  
0 rated :

Also does anyone know if remote storage is possible with red5?

What i mean is, is it possible to separate the flv files with the red5 server?

Instead of placing the videos on

C:\ProgramFiles\Red5\webapps\oflaDemo\streams it would be place on another server? would still be possible to stream those files with red5?

JW Player

User  
0 rated :

Hi,
I have correctly installed red5 and it is working;

I have 4 web-cam that play their output using Zoneminder and Cambozola;

I am interested to understand how to play that real time streaming video into a flash website .swf

Help me please.

Thank you in advance.

JW Player

User  
0 rated :

Hi Guys,

Thanks for your valuable inputs and I was able to make it work on IE6 and Firefox. However only one works at a time, the second one buffers and waits at 39.

Once you stop the first, restart the second it works.

Is it single threaded?

Appreciate your help.

- Soum.

JW Player

User  
0 rated :

Hi, im new in this i have sucessfully installed red5 and java on my local machine...

My demos are working fine, but i tried to embed flash player to stream a video... but it gives me a message: Server not found: rtmp://localhost:5080/demos/


The code i'm using is


bc.. <embed type="application/x-shockwave-flash" src="player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost:5080/demos/&file=video.flv" width="420" height="250"/>

JW Player

User  
0 rated :

For Red5 RTMP, the streamer application is:bc.. streamer=rtmp://localhost/oflaDemos



No port number is needed, the player will use 1935 for RTMP, so make sure that 1935 in open in your firewall if you want to stream to the Internet.

Your media files should be placed in *oflaDemo/streams* or subdirectories of *streams*

Red5 uses port 5080 to serve HTML, XML, images, basically everything except the RTMP stream.

JW Player

User  
0 rated :

Thanks for the reply...

I have change but the error is the same :


bc.. <embed type="application/x-shockwave-flash" src="player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost/oflaDemos/&file=video.flv" width="420" height="250"/>


i'm calling the html file like this : http://localhost:5080/demos/test.html

the file test.html is located in red5/webapps/root/demos/

and all the ports used are ok...

JW Player

User  
0 rated :

Have you tried one of the Red5 demo applications to see if it streams via the RTMP protocol?

Sometimes, the localhost doesn't work, you might try 127.0.0.1 or 192.168.0.nnn if you are on a LAN.

Look in the streams directory to see if Red5 created the medadata file; it should be named *video.flv.meta*

In your code, you use *oflaDemos* with an "s" at the end. On my Red5 installation the directory is named *oflaDemo* with no "s". Check yours.

JW Player

User  
0 rated :

How about if i embed video playlist with red5 as the server?

JW Player

User  
0 rated :

You can use links to a Red5 RTMP server in a playlist.

Post a link to your test page or at the *_VERY_* least your player code & playlist, if you're stuck.

JW Player

User  
0 rated :

Anybody got an example of how to embed a live Red5 stream into HTML page?

JW Player

User  
0 rated :


@Puzzled,

I've posted many examples of Red5 livestreaming here:

*http://www.longtailvideo.com/jw/?search=rtmp+publish*

This thread is probably the most current:

*http://www.longtailvideo.com/support/forum/General-Chat/16066/How-to-stream-live-to-red5-#msg123314*

Using FME as the publisher is also covered in the referenced thread. You can also use the Red5 Publisher demo or a JW FLV player (up to v4.2.207) as publishers.

JW Player

User  
0 rated :

Hey guys I finally got thing baby to work even treaming to my page...one little thing .How can I get a better clearer video specially when I do live ? I notice "quality only go to 100 then if i increase it more then that "1" video slow down I go 10 i only hear video frozen. can any one help please.

JW Player

User  
0 rated :

KNOWLEDGE SHOULD BE FOR IMPROVEMENT NOT SUBVERSION

JW Player

User  
0 rated :

Hey can any help me setup the red5 and flv player please. my mail is patidar16@yahoo.com. If money makes you happy by helping me I will be glad to pay

JW Player

User  
0 rated :

I am also having trouble adding my flash video recorder and player to my website.
1. My recorder does not always detect my camera like it should and
2. My database may not be set up correct
3. I do not understand how to use Red5

I really need help.

JW Player

User  
0 rated :

I'd be happy to help.

What are the specific issues??

John

JW Player

User  
0 rated :

bc.. <embed type="application/x-shockwave-flash" src="http://www.jeroenwijering.com/upload/player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost/oflaDemo/&file=DarkKnight.flv" width="420" height="250"/>
You need to specify the stream source for the *streamer* flashvar and the file name for the *file* flashvar.

Please review the v4.x player supported flashvars here: *http://code.jeroenwijering.com/trac/wiki/FlashVars*

JW Player

User  
0 rated :

embed type="application/x-shockwave-flash" src="player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost/oflaDemos&file=video.flv" width="420" height="250"/>

never use backslash at the end of oflademos and it will solve the problem

JW Player

User  
0 rated :

embed type="application/x-shockwave-flash" src="player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost/oflaDemos&file=video.flv" width="420" height="250"/>

The streamer value should be "oflaDemo", not "oflaDemos" (the 's' needs to be removed)

embed type="application/x-shockwave-flash" src="player.swf" style="" id="pl2" name="pl2" bgcolor="#ffffff" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="streamer=rtmp://localhost/oflaDemo&file=video.flv" width="420" height="250"/>

JW Player

User  
0 rated :

Hello this is my website http://www.picasachat.com , i am getting error of Server not found due to Red5 is not installed. how to install red5 is there any installation file?


i am facing this problem when user logging in to my website. please help

JW Player

User  
0 rated :

Here is my code of test.html page
Red 5 is running on localhost I have checked by opening a browser http://localhost:5080/demos/ofla_demo.html

But this code has not worked.Any help would be appreciated.
The default Demo application has 4 files in its streams directory
named
avatar.flv
avatar-vp6.flv
toystory3.flv
toystory3-vp6.flv



<html>
<head>
</head>
<body>


<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->

<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
<param name="movie" value="player.swf" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="provider=rtmp" />
<param name="flashvars" value="streamer=rtmp://localhost/oflaDemo" />
<param name="flashvars" value="file=avatar.flv" />
<embed
type="application/x-shockwave-flash"
id="player2"
name="player2"
src="player.swf"
allowscriptaccess="always"
allowfullscreen="true"
wmode="opaque"
flashvars="streamer=rtmp://localhost/oflaDemo/&file=avatar.flv"
width="400"
height="315"
/>
</object>

<!-- END OF THE PLAYER EMBEDDING -->


</body>
</html>

But this code snippet has not worked.

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you please put the page up somewhere? (not localhost). Thanks!

JW Player

User  
0 rated :

I have checked a Remote Server on LAN if not localhost I replaced localhost by the IP of the server and still that did not worked.

JW Player

User  
0 rated :

I read documentation given here
http://www.longtailvideo.com/support/jw-player/13/embedding-flash

http://builddocs.com/server_os_builds/streaming-video-with-red5-oflademo-app/


and

http://www.longtailvideo.com/support/jw-player/13/embedding-flash
and the swfobject.js and player.swf are on same directory where the test.html page I created is present.

Ethan Feldman

JW Player Support Agent  
0 rated :

@Tapas Mishra – Again, Can you please put the page up somewhere? (not localhost). We can’t blindly guess at why it is not working for you without seeing it.

Ethan Feldman

JW Player Support Agent  
0 rated :

@Tapas Mishra – Again, Can you please put the page up somewhere? (not localhost). We can’t blindly guess at why it is not working for you without seeing it.

JW Player

User  
0 rated :

I'm running into the same problems but mine isn't in regards to streaming video it's setting up a game server. I am using Apache as my htp server on port 80. I have Red5 installed and allowing access to the ports on my router and firewall how can I embed web-based flv games and access Red5 to run them? Red5 runs it just fine locally but not remotely over the internet and there is absolutely no documentation anywhere to guide you through this. Seems like the developers of Red5 are relying on the users to just guess on how to set it up.

JW Player

User  
0 rated :

Hi, I got every thing working and resolved.

The code on the first post of mine I have not kept it in Document Root of the webserver.
That was the only thing that was stopping things.
I had made all the html code in my home directory.

JW Player

User  
0 rated :

Also in the line

flashvars="streamer=rtmp://localhost/oflaDemo/&file=avatar.flv"

note above oflaDemo should not end with a / so above is wrong and the correct line is

flashvars="streamer=rtmp://localhost/oflaDemo&file=avatar.flv"

JW Player

User  
0 rated :

Well even I faced that problem of documentation for Red5 but I hope it will improve in future.

Ethan Feldman

JW Player Support Agent  
0 rated :

Good, glad you got it working! :-)

This question has received the maximum number of answers.