Flash Video player controls revisited
Posted: Wed 10. Nov 2004, 23:07
After some more search in the web I have come to the conclusion that the only way to have player controls for flash movies (i.e. non looping videos in the .swf format) is to add some javascript and control buttons. I have tried Ibis Fernandez' approach with a flash file calling another one, but this did not work out as the videos I had produced did not play in the correct speed, i.e. somehow the speed setting in the flash video got lost due to the embedding in other flash files.
I have thus changed the section on the flash player plugin in the file to add some js script and player buttons. You need to change the following file for this to work out:
include/inc_front/content/cnt9.article.inc.php
You need to replace the existing code in the file:
This change creates three video type player buttons below the flash video, if "controls" is activated. This even works for several videos in the same article, as the $randomID was used to personalize each instance. If controls is not activated the flash file is displayed in the same way as before. I have tested this to work on IE and FireFox, i.e. using the <OBJECT> and the <EMBED> tags.
hope this is helpful to some of you.
regards,
Leone
I have thus changed the section on the flash player plugin in the file to add some js script and player buttons. You need to change the following file for this to work out:
include/inc_front/content/cnt9.article.inc.php
You need to replace the existing code in the file:
Code: Select all
case 3: //Flash Player/Plugin
if($media["media_control"] == "true") {
$controls = "\n<form name='" .$randomId . "form' id='". $randomID . "form' action='#' method='get'>\n<input type='button' value=' > ' onclick='" . $randomID . "play();' />\n<input type='button' value=' || ' onclick='" .$randomID . "stop();' />\n<input type='button' value=' |<< ' onclick='". $randomID . "rewind();' /><br /></form>\n\n";
$js = "\n<script>\n";
$js .= "function " .$randomID . "play()\n";
$js .= "{\n";
$js .= " if (!document.$randomID.IsPlaying())\n";
$js .= " document.$randomID.Play();\n";
$js .= "}\n";
$js .= "function " . $randomID . "stop()\n";
$js .= "{\n";
$js .= " if (document.$randomID.IsPlaying())\n";
$js .= " document.$randomID.StopPlay();\n";
$js .= "}\n";
$js .= "function " . $randomID . "rewind()\n";
$js .= "{\n";
$js .= " if (document.$randomID.IsPlaying())\n";
$js .= " document.$randomID.StopPlay();\n";
$js .= " document.$randomID.Rewind();\n";
$js .= "}\n";
$js .= "</script>\n\n";
}
$media["width"] = ($media["media_width"]) ? "width=\"".$media["media_width"]."\" " : "";
$media["height"] = ($media["media_height"]) ? "height=\"".$media["media_height"]."\" " : "";
$media["code"] = $js . "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
$media["code"] .= $media["width"].$media["height"]." border=\"0\" id=\"$randomID\"";
$media["code"] .= "CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">\n";
$media["code"] .= "<PARAM name=\"movie\" VALUE=\"". $media_controller . $media["source"]."\">\n";
$media["code"] .= "<PARAM name=\"quality\" VALUE=\"high\">\n";
$media["code"] .= "<PARAM name=\"SCALE\" VALUE=\"noborder\">\n";
$media["code"] .= "<PARAM name=\"LOOP\" VALUE=\"true\">\n";
$media["code"] .= "<PARAM name=\"PLAY\" VALUE=\"".$media["media_auto"]."\">\n";
$media["code"] .= "<EMBED SRC=\"". $media_controller . $media["source"]."\" BORDER=\"0\" ";
$media["code"] .= $media["width"].$media["height"]." name=\"" . $randomID ."\"";
$media["code"] .= "TYPE=\"application/x-shockwave-flash\" play=\"".$media["media_auto"]."\" ";
$media["code"] .= "quality=\"high\" scale=\"noborder\" pluginspace=\"http://www.macromedia.com/go/getflashplayer/\"></EMBED>\n";
$media["code"] .= "</OBJECT>\n";
$media["code"] .= $controls;
hope this is helpful to some of you.
regards,
Leone