How to add Streaming Video in your website 2 – embed Flash Video Player

Note: This instruction requires you to have basic skills and ideas how to upload data to your website and access them in the browser. And basic knowledge in HTML. I am currently preparing WordPress plugin for FLV player. So come back later if you are interested.

Now that I have converted my old video files into Flash Video files, what do I need to do to add them in my website? I wondered.

The answer: You will need to have the Flash swf component that will play your FLV video files which will be embeded in your web page. And install or save it in your website. And add addtional javascript or embed elements in your webpage. See Wikipedia page for more information.

So I spent some time googling and tried to find free or open source (So I can probably improve it after I learn Flash :) ) FLV flash player. In this Wikipedia Flash Video page, there are several players listed.

Also another player , JW Media Player is well-known but it is also free only for non-commercial. According to the website, you should buy commercial liscence if you have ads in your website such as Adsense or display banners. So basically this is not a solution for me at least.

And I do not like such limitation. Free for all cases is what I would really want. So I choose FlowPlayer and OS FLV as they are under GPL licenses.

Flow Player

Flow Player is in fact very mature and has very nice advanced features that other players do not have – such as playing muliple flv vides at once and javascript functions to control the player functions. I haven’t had the time to check out the advanced features yet, but I will write another article on that when I have the chance.

1. Download the zip file from here and unzip and upload the files into your website.

2. I have uploaded directly into the HTML document root path so the URL of the path is http://www.neox.net/flowplayer.

3. Now open the exmple file by accessing http://yourwebsite.com/flowplayer/html/example.html. And view the pages HTML source.
I have restructured the code layout so only absolutely need parts are showing below example.

<script type="text/javascript" src="http://www.neox.net/flowplayer/html/flashembed.min.js"></script>
 
<div id="flow_example"></div>
<script type="text/javascript">
//window.onload = function() {  
    flashembed("flow_example",
      {
         src:'http://www.neox.net/flowplayer/FlowPlayerDark.swf',
                        width: 400,
                        height: 300
      },
      {config: {
                        videoFile: 'http://www.neox.net/video/babyhana.flv',
                        autoPlay: false,
                        initialScale: 'fit',
                        loop: false,
                        autoRewind: true,
                        autoBuffering: true
      }}
   );
//}
</script>

4. As you can see, it is pretty straight forward. You will need to change javascript source file path, flash player path and videoFile path. Additionally, you can play around with various option such width and height of the player.

Some more explanation;

  • autoPlay: Setting true will make the player start to play the movie as soon as the web page is loaded.
  • loop: Settig true will make the player replay the movie continuously
  • autoRewind: Move the position back to start after the view
  • autoBuffering: Setting true will preload the movie file.

If you are concerned with your website’s bandwidth usage , you should not set autoPlay to true. By setting autoPlay to true, whenever a user visits your webpage, the movie file is automatically downloaded to the client’s computer consuming the bandwidth. Also, you should set autoBuffering to false since it automatically downloads the file to client’ computer too.

But if you want the users to see the still image of the movie file but dont’ want the client to preload or pre-down the whole movie file, there is another option splashImageFile. You can define URL or absolute or relative path of a JPEG image file. (The website says only JPEG is supported) and when defined only the image file will be downloaded and shown in the player.

See below for the usage example.

  {config: {
                        videoFile: 'http://yourwebsite/video/test.flv',
                        autoPlay: false,
                        initialScale: 'fit',
                        loop: false,
                        autoRewind: true,
                        autoBuffering: true,
                        splashImageFile: 'http://yourwebsite.com/image.jpg'
 
      }}

If you want simpler way to generate the code, you can use below simple code generator for your conveniences. You can just copy and paste output from the textarea into your html.

FlowPlayer HTML codes generator ;)

Your flowplayer path : can be URL or absolute or relative path. I would use absolute path.
In the above example, I used http://www.neox.net/flowplayer

The movie file: same as the above. absolute path would be great.


OS FLV player

Now, OS FLV is another promissing player. It is under GPL lisence and open source. I admit that this one is not stable as FlowPlayer but it is nice to try other player.

1. Download the zip file from here and unzip and upload the files into your website.

2. I have changed the default folder name ‘player2′ to ‘flv’ to easy recognize what it is. I uploaded directly into the HTML document root path so the URL of the path is http://www.neox.net/flv.

3. Now open the exmple file by accessing http://yourwebsite.com/flv/Firefox%20codegenerator.html. It is basically an embed code generator you can start to use it right away. This script only runs with Firefox browser.

But this generator has a little problem. You can not use this script if the calling webpage does not reside within the same folder where the SWF player is located. (For my example, ‘/flv’ folder)

So I have fixed and added a new input field to define the OS FLV folder. So the embed output can be used with any webpages.

  • Width and Height: width and height of the player
  • Autoplay: will play the video automatically when the webpage is loaded
  • Autoload: will preload the flv file
  • Autorewind: will rewind the video and put the position back to start
  • Loop: will continuously replay

As I mentioned on the bandwidth usage, if you are concerned on too much bandwidth usage, you should not check the autoplay and autoload option. But disable these features make the player’s initial screen empty black. If you would like to show the still image of the video (just like YouTube) , you will need to enable autoload. But it will make the client to download the full file which will consume the bandwidth. There is no other options to resolve this issue at this moment.

See below for the example embed code output.

<script src='/flv/AC_RunActiveContent.js' language='javascript'></script>
<script language='javascript'>
 AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 
 	'width', '400', 'height', '300', 'src', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? '/flv/player8' : '/flv/player'),
 	'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'id', 'flvPlayer', 'allowFullScreen', 'true', 
 	'movie', ((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? '/flv/player8' : '/flv/player'), 'FlashVars', 
 	'movie=/video/babyhana.flv&bgcolor=0x051615&fgcolor=0x13ABEC&volume=&autoload=off&autorewind=on&clickurl=&clicktarget=');
</script>
<noscript>
 <object width='400' height='300' id='flvPlayer'>
  <param name='allowFullScreen' value='true'>
  <param name='movie' value='/flv/player.swf?movie=/video/babayhana.flv&bgcolor=0x051615&fgcolor=0x13ABEC&volume=&autoload=on&autorewind=on&clickurl=&clicktarget='>
  <embed src='/flv/player.swf?movie=/video/babayhana.flv&bgcolor=0x051615&fgcolor=0x13ABEC&volume=&autoload=on&autorewind=on&clickurl=&clicktarget=' width='400' height='300' allowFullScreen='true' type='application/x-shockwave-flash'>
 </object>
</noscript>

Conclusion

There are many Flash embedable player out there, but I introduced only the GPL license and opensource ones for you can use for any purpose non-commercial or commercial. Flowplayer is stable and feature rich player and OSFLV player is simple and comes with an easy-to-use embed code generator. But you can also create the embed codes for Flowplayer using my simple form above, too.

Personally I like FlowPlayer and will spend some more time finding out the advanced features.

Have a nice day.

Previous: How to add Streaming Video in your website 1 – create a Flash Video FLV

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MySpace
  • Reddit
  • Technorati
  • Twitter

, ,

My favorite listmania

Must Own PC Games-ALL TYPES

$19.47
Grand Theft Auto IV - This game works great on my PC (pentium d 3.4ghz, 512mb 9600gt, 2gb ram) - I got it as part of the Steam sale for a measly $6.75. It's the best deal I've ever gotten for a game - about 30 hours of pla...
$15.90
BioShock - For those who love a great story-line-driven, single-player experience, you can't do better than this. Evocative, engaging and thought-provoking, all at the same time. Truly brilliant art design, with...
$27.47
Dead Space - ***Please note that this review addresses the content and gameplay of EA's Dead Space for the PC, and does not address the issue of DRM/Securom. I will not condemn nor praise this game solely based o...
$19.99
Left 4 Dead - The game requires an internet connection to connect to Steam in order to install the game, but this fact does not seem to be mentioned anywhere.
$27.99
The Orange Box - The Orange Box provided me with hours upon hours of entertainment. Playing through Half Life 2 was the best fifteen hours of my life!!! Portal also provides several hours of fun puzzle solving. The So...
$30.00
Call of Duty 4: Modern Warfare - This is a very good game, kinda short, but worth it. Multiplayer action is really neat.
$35.60
Call of Duty: World at War - The graphics are great, and realism is pretty good, but overall this game is downright irritating.
1. Although the game offers a "save" option, it really doesn't save where you want it to. Reopn...
$17.79
Crysis - I am a FPS fanatic. I have played just about every game for Windows. I love the new generation of games always looking for a unique angle (Bioshock, FEAR, etc). Crysis is a very entertaining shooter w...
$29.92
Crysis Warhead - I bought Spore before I knew about the DRM. After finding out all the negatives involved with the DRM and the purpose/uselessness of it's installation not to mention the potential threat to my brand ...
$19.99
Far Cry 2 - This game is good for about five hours than you begin to repeat the same missions over and over again. Story line seems very segmented. Too many side missions. This game is nothing like the first on...
$55.48
Gears of War - Gears of War PC

I finally had the opportunity to play through Gears of War and saw how the game essentially set the standard for using cover. The controls made sense and I was easily imme...
$17.75
Best Seller Series: Starcraft - This game is AWESOME. If you get this then if you go make a battle net account you can get the expansion for free. It's great
$3.17
Warhammer 40,000: Dawn of War - For fans of real time strategy games, this game is a must have. I have heard a lot about it, but just finally got around to getting it. There are always players online to get a game going with. The...
$3.99
Warhammer 40,000: Dawn of War -- Dark Crusade - This is a good game - I like many aspects of it - morale, the concept of cover (protective terrain), stacking of victory conditions. There are a number of races to play, and they're interesting and s...
$1.22
Far Cry - Great fun to play. I really wish the sequel didn't throw away so many of this games mechanics.
$24.49
Hitman: Blood Money for PC - I am a big fan of the Hitman games, with Hitman 2 being one of top-10 favorite games of all time. So when I claim that Blood Money is the best Hitman yet, that's a big statement for me. The developers...
$25.00
F.E.A.R.: First Encounter Assault Recon - Unfortunately I can't review this game because I never received it from the company I ordered it from. The company was THE BOOKGROVE. I ordered this game on January 15, 2010 and it's now February 20,...
$49.00
F.E.A.R. Extraction Point - I ordered the "Expansion Pack - Fear Extraction Point" thinking it was the whole game - what a surprise when I tried to install it and found I needed to have Fear installed first. To make a long stor...
$9.99
Battlefield 1942: The Complete Collection - I suffer with pain in my leg and this game is a perfect distraction. It uses both the mental and physical and it really doesn't matter if I win or lose.
$7.98
Battlefield 2 - I play it more than any other game I have purchased!......even more than "call of duty"!

Battlefield 2 is great!
$19.94
Battlefield 2: Special Forces Expansion Pack - The Battlefield 2 series on PC is just one word - Outstanding! I still play the original with my buddies most evenings especially on weekends. After a hard days work there nothing better than shooting...
$27.75
Battlefield 2 Booster Pack Collection (Euro Force & Armored Fury) - On Sep 1st, 2009, both Euro Forces and Armored Fury will be included FREE for all BF2 players in September 2009 in a patch 1.50 from EA/DICE.
$99.99
Doom Collector's Edition - totally an awsome game music sounds cool like the music in the snes version totally an awsome game.
if you guy wanted to play doom 1 and doom 2 then this game pack is for you
$3.79
Company of Heroes - Dream come true! Great graphics, sound effect and game play. Bought it at Amazon.com
$16.54
Company Of Heroes: Opposing Fronts - I see a lot of review saying how terrible it is to patch the game, but I bought it a year or so after its release and have had no problems. I would recommend buying it on steam, because it patches au...
$19.66
Counter-Strike: Source - This is probably one of the greatest game ever. IF you like a game that gives you a challenge to play then this is perfect. IF you thinking about getting it just get it. well worth the money.
$32.99
SWAT 4: Special Weapons and Tactics - One thing I didn't like was being penalized for shooting a fleeing armed suspect.Is this true for real cops?Otherwise a great game that should have had save checkpoints.
$8.50
Quake 4 - one of the standards, gotta have it if you like shooting things and being attacked by creatures
$165.00
Star Wars Jedi Knight 2: Jedi Outcast Collectors Edition - While the individual games are great, putting JK2, JK & the original DF together in a single bundle doesn't maximize your gaming experience. But first, a summary:

The games are part of a...
$16.89
Star Wars Jedi Knight: Jedi Academy - This product is tons of fun to play.The company from which I ordered was excellent,the game arrived earlier than amazon had estimated.
I highly reccommend this PC game.I own others in the Starwa...
$2.44
Max Payne - I like this game. But, it has a problem...a couple actually...well, maybe they are not problems, they are just facts. First, the graphics (if you compare them to todays standards and to the second gam...
$33.00
Max Payne 2: The Fall of Max Payne - This is just another sad story of how another title of the same series often turns out to be bad. The story, by all means, is the most pathetic one I have ever heard of. There are just way too many be...
$15.97
Tiger Woods PGA Tour 06 - This game has gotten so much better over the years. There is a new battle mode where you try to beat the best ever with your created character. But you had better have a lot of time on your hands. The...
  1. #1 by Flo at May 29th, 2008

    Here’s another FLV Player under GPL:
    http://www.video-flash.de/flv-flash-fullscreen-video-player/

  2. #2 by |--A--| at September 16th, 2008

    Thx a lot for this blog. I have been looking for the free flv player for commercial use but couldn’t find. Your blog sure have helped me a lot. Thx again. :-)

  3. #3 by |--A--| at September 16th, 2008

    I’m having a problem with OS Flv player. Can you please help me out. When I play the movie the slider just disappears & once the movie starts playing I can’t go back. Hence there’s no slider as soon as I click on play but b4 playing it shows a slider.

    http://3gwrestling.com/index.php?option=com_content&view=section&layout=blog&id=9&Itemid=57

    You can see here what I’m talking about. I cant see a particular part of the video I want. If I click on the buffering bar. It just goes to the beginning of the video. Help me out please. Thanks in advance. :-)

  4. #4 by HanaDaddy at September 16th, 2008

    I do not know why that’s happening.Usually once the web browser fully download the movie, the user will be able to move cursor freely. Also, you need to use streaming server or other PHP streaming solution in order to play back any part without complete donwloading of the flv file. Using just Player with the static flv file won’t let user to move the cursor freely. I have not quite gather information on streaming solution, yet. But I will try to come up with a blog soon.

  5. #5 by |--A--| at September 16th, 2008

    Hey, Thanks a lot. Yes you were right when the video fully buffered it gave the option to move cursor around any part of the video. I don’t really use any streaming server or any php streaming. Actually I’m not quite aware of it. So I’m gonna follow your next blog about streaming for sure. Can’t wait for it. Thanks once again.

  6. #6 by Chuck at November 18th, 2008

    I would like to embed a FLV player into my web site to play the samples. I can convert the videos to FLV, however I do not know HTML programing. I used Web Easy Pro 7 to create the site. Could you give me some directions. The FLV files are much smaller than the way I am doing it now. Thanks for any help. Chuck

  7. #7 by Siva G at July 29th, 2009

    Gr8 blog, Good job,

    I have become a fan of yours now :) , It is really informative, a step by step guide.

    Thnx again .

    Cheers
    Siva G

  8. #8 by HanaDaddy at July 30th, 2009

    Thank you for the comment Siva. I tried to provide as much information as possible.

(will not be published)
Quick Coupons!
Abe's of Maine: Actually , if you buy a product more than $75, you can use FRIEND10 coupon code to get extra $10 off!