Tuesday, June 9, 2009

Link to a specific video for playing in a web flash video player

You might have found that many video sharing sites like YouTube have the capability of making visitors playing a specific video into a new page, and this capability makes the large number of videos in better order. And if you want to build a video sharing site like YouTube, you have to achieve this functionality on it.

Below is the detailed tutorial to introduce how to make the flash video player generated by Moyea Web Player (it is free) gets the capability of playing a video in a new page on your video sharing site. This tutorial assumes you are building your site with PHP programming language, and it will cover two ways to achieve, one implements with a playlist file, and other one implements without playlist file.

>>>More information about the freeware Moyea Web Player

1. Implement with a playlist file (it is an .xml file generated by Moyea Web Player):

Embed Code (generated by Moyea web player after publish):

<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">Player will show here</div>
<script type="text/javascript">
var so = new SWFObject('mwplayer.swf','player','450','300','9');
so.addParam('wmode','opaque');
so.addParam('quality','high');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('flashvars','playerOpts=playItem*0*i||pauseAtFirstFrame*false*b');
so.write("flashcontent");
</script>

Add JavaScript in blogger (blogspot) post

The red words “playItem*0*I” is the actual video file. When “playerOpts=playItem*0*I”, it means the player is playing the first video in playlist. By analogy, when “playerOpts=playItem*1*I”, it means the player is playing the second video.

2. Implement with no playlsit file:

Embed Code:

<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">Player will show here</div>
<script type="text/javascript">
var so = new SWFObject('mwplayer.swf','player','450','300','9');
so.addParam('wmode','opaque');
so.addParam('quality','high');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('flashvars','playerOpts=playListPath*^^../../videos/Web Player.flv^../../videos/

Web Player.jpg*s||pauseAtFirstFrame*false*b||noWatchBtn*true*b||noPlayListBtn*true*b');
so.write("flashcontent");
</script>

The red words “^../../videos/Web Player.flv^../../videos/Web Player.jpg*s” means the player is playing the video named “Web Player.flv” and its thumbnail is “Web Player.jpg” and, the video and its thumbnail reside in a folder named “videos”.

You could click here to download the original PHP and HTML codes about the above examples for studying.

Source: playerdiy.com

No comments:

Post a Comment