View Full Version : flash web video-to play videos by html links
I have embedded a flash web video on my page. How can I play a video by html link? I would like to make a list of video files and by clicking the name of the video, I want the embedded player play it.
Thank you in advance.
Here is the code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="240" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=myvideoplayer_files/pallethi&autoPlay=false&autoRewind=false" />
<embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=myvideoplayer_files/pallethi&autoPlay=false&autoRewind=false" quality="high" scale="noscale" width="320" height="240" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Medyman
07-28-2008, 01:15 PM
Use the External API.
LiveDocs: Controlling Flash Video with the External API (http://livedocs.adobe.com/flash/8/main/00001601.html)
I am new to javascrips that can you please help me in defining the var mentioned on the first line of the js? How can I define that flashVideoPlayer variable depending upon my embedded swf code given above?
Thank you very much for your help Medyman
Medyman
07-28-2008, 03:47 PM
Just give your SWF an id of "videoPlayer"
Then, you don't have to change any of the variables.
Hi again medyman,
I have tried giving an id of videoplayer and i have copied the same codes on the page you have submitt the link. But both did not function properly. My codes on my page was:
JAVASCRIPT:
<script language="JavaScript">
// Use a variable to reference the embedded SWF file.
var flashVideoPlayer;
/* When the HTML page loads (through the onLoad event of the <body> tag), it calls the initialize() function. */
function initialize() {
/* Check whether the browser is IE. If so, flashVideoPlayer is
window.videoPlayer. Otherwise, it's document.videoPlayer. The
videoPlayer is the ID assigned to the <object> and <embed> tags. */
var isIE = navigator.appName.indexOf("Microsoft") != -1;
flashVideoPlayer = (isIE) ? window['videoPlayer'] : document['videoPlayer'];
}
/* When the user clicks the play button in the form, update the videoStatus text area, and call the playVideo() function within the SWF file, passing it the URL of the FLV file. */
function callFlashPlayVideo() {
var comboBox = document.forms['videoForm'].videos;
var video = comboBox.options[comboBox.selectedIndex].value;
updateStatus("____" + video + "____");
flashVideoPlayer.playVideo("http://www.hskhidrolik.com/hizmetler/" + video);
}
// Call the pauseResume() function within the SWF file.
function callFlashPlayPauseVideo() {
flashVideoPlayer.pauseResume();
}
/* The updateStatus() function is called from the SWF file from the onStatus() method of the NetStream object. */
function updateStatus(message) {
document.forms['videoForm'].videoStatus.value += message + "\n";
}
</script>
HTML:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="320" height="240" id="VideoPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=myvideoplayer_files/pallethi&autoPlay=false&autoRewind=false" />
<embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=myvideoplayer_files/pallethi&autoPlay=false&autoRewind=false" quality="high" scale="noscale" width="320" height="240" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<form name="videoForm">
Select a video:<br />
<select name="videos">
<option value="myvideoplayer_files/fiberbrdhi.flv">lights1.flv</option>
<option value="myvideoplayer_files/pallethi.flv">clouds2.flv</option>
</select>
<input type="button" name="selectVideo" value="play" onClick="callFlashPlayVideo();" />
<br /><br />
Playback <input type="button" name="playPause" value="play/pause" onClick="callFlashPlayPauseVideo();" />
<br /><br />
Video status messages <br />
<textarea name="videoStatus" cols="50" rows="10"></textarea>
</form>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.