JS FLV Video Player works fine in FF but error in IE

  • Thread starter jamesdylangoldstein
  • Start date
J

jamesdylangoldstein

So I tried to do my father a favor and convert his advertisements
to .flv and place them on his website. With Flash being $600, I found
an open-source .flv player and configured it. So today he called and
stated it isn't working with IE.

The script:
<script type="text/javascript" src="http://www.fivestarsuzuki.com/
video/swfobject.js"></script>
<script type="text/javascript">
<!--
/*
* Init and setup FlowPlayer. This example file shows 'advanced'
features like
* playlists and configuring with JavaScript. FlowPlayer.html is a
simpler example.
*/

var flowPlayer1;
function init() {
if (document.getElementById) {
flowPlayer1 = document.getElementById("FlowPlayer");
}
setInitialConfig();
}

// wait for the page to fully load before initializing
window.onload = init;

function setInitialConfig() {
fpConf.playList = clips;
fpConf.autoPlay = false;
fpConf.autoBuffering = false;
flowPlayer1.setConfig(fpConf);
}

/*
* This is the playlist with FLV videos and images. The images can have
a duration property
* and the flv video files can have start and end properties that give
the starting and
* ending positions in seconds. All these attributes (duration, start,
end) are optional.
*
* The start and end attributes really only work with the Flash Media
Server. I have had
* problems when thesting using Red5.
*/
var clips = [
{ name: 'ClickToPlay', url: 'xl7.jpg' },
{ name: 'ACTI', url: 'act1.flv', start: 1, end: 32 },
{ name: 'ACTI', url: 'act2.flv', start: 1, end: 32 },
{ name: 'XL7', url: '14xl7.flv', start: 1, end: 26 }
];

var fpConf = {
showPlayList: false,
baseURL: 'http://www.fivestarsuzuki.com/video',
bufferLength: 20,
loop: false,
videoHeight: 300,
hideControls: false,
showPlayListButtons: true,
progressBarColor1: 0xFF0000,
progressBarColor2: 0xFF0000,
bufferBarColor1: 0x00FF00,
bufferBarColor2: 0x00FF00,
progressBarBorderColor1: 0xAAAAAA,
progressBarBorderColor2: 0xAAAAAA
}

/*
* JavaScript event hanlders:
*/
function clipSelected(clipIndex) {
flowPlayer1.ToClip(clipIndex);
}

function play() {
flowPlayer1.DoPlay();
updateIsPlaying();
}

function pause() {
flowPlayer1.Pause();
updateIsPlaying();
}

function stop() {
flowPlayer1.DoStop();
updateIsPlaying();
}

function updateIsPlaying() {
var field = document.getElementById("playing");
field.value = "Playing: " + flowPlayer1.getIsPlaying() + ", paused : "
+ flowPlayer1.getIsPaused();
}

function seek() {
var seekTimeField = document.getElementById("seekTime");
flowPlayer1.Seek(seekTimeField.value);
}

function getTime() {
var time = flowPlayer1.getTime();
var timeField = document.getElementById("time");
timeField.value = time;
}

function getDuration() {
var value = flowPlayer1.getDuration();
var field = document.getElementById("duration");
field.value = value;
}

function getPercentLoaded() {
var value = flowPlayer1.getPercentLoaded();
var field = document.getElementById("loaded");
field.value = value;
}

function replaceConfig() {
// replace the playlist in our configuration
fpConf.playList = [
{ name: 'ACT1', url: 'act1.flv' } ];
fpConf.autoBuffering = true;
fpConf.autoPlay = true;
flowPlayer1.setConfig(fpConf);
}

/*
* Flash callback handlers. The player calls these on specific events:
*/

function onClipDone(clip) {
addClipEvent("clip done : " + describeClip(clip));
}

function onClipChanged(clip) {
addClipEvent("changed to clip : " + clip.name);
}

function onLoadBegin(clip) {
//addClipEvent("started loading : " + clip.name);
}

function onStreamNotFound(clip) {
addClipEvent("stream not found: " + describeClip(clip));
}

function onPlay(clip) {
addClipEvent("play: " + clip.name);
}

function onStop(clip) {
addClipEvent("stop: " + clip.name);
}

function onPause(clip) {
addClipEvent("paused: " + clip.name);
}

function onResume(clip) {
addClipEvent("resumed: " + clip.name);
}

function onCuePoint(cuePoint) {
addClipEvent("cue point received, time: " + cuePoint.time + ", type '"
+ cuePoint.type + "', thumb: " + cuePoint.thumb + ", parameters: " +
cuePoint.parameters);
}

/*
* Helpers:
*/

function addClipEvent(desc) {
var events = document.getElementById("events");
events.appendChild(document.createTextNode(desc));
events.appendChild(document.createElement("br"));
}

function describeClip(clip) {
return "Name: " + clip.name + ", baseUrl: " + clip.baseUrl + ",
fileName: " + clip.fileName +
", start: " + clip.start + ", end: " + clip.end + ", protected: " +
clip.protected +
", linkUrl: " + clip.linkUrl + ", linkWindow: " + clip.linkWindow + ",
controlEnabled: " +
clip.controlEnabled;
}
-->

</script>

<div id="flowplayerholder" style="width:600px; margin:0 auto; ">
This will be replaced by the player.
</div>

<script type="text/javascript">
// <![CDATA[

var fo = new SWFObject("video/FlowPlayerWhite.swf", "FlowPlayer",
"468", "350", "7", "#ffffff", true);
// need this next line for local testing, it's optional if your swf is
on the same domain as your html page
fo.addParam("allowScriptAccess", "always");
fo.addParam("flashVars", "config={configInject: true}");
fo.write("flowplayerholder");

// ]]>
</script>

<a href="javascript: clipSelected(1)"><b>Play ACTI</b></
a>&nbsp;&nbsp;<a href="javascript: clipSelected(2)"><b>Play ACTII</b></
a>&nbsp;&nbsp;<a href="javascript: clipSelected(3)"><b>Play XL7
Commercial</b></a></td>
Reply With Quote
 
C

cwdjrxyz

So I tried to do my father a favor and convert his advertisements
to .flv and place them on his website. With Flash being $600, I found
an open-source .flv player and configured it. So today he called and
stated it isn't working with IE.
(very long script not included)

I am not certain what you did. First you do not need an open
source .flv player. This is needed only to play a nude .flv without
the .swf container file. If you write proper .flv/.swf code, the free
official flash player on most computers today will play .flv/.swf just
fine and is used by Google, YouTube, MySpace, and many large news
sites. Now an official flash suite that includes an encoder
for .flv/.swf is indeed expensive. However you can buy an encoder that
will encode either .swf old fashioned video or .flv/.swf format video
for about $US 50. If you select to encode as .flv/.swf it will take
most of the usual video file formats as input. After selection of the
usual parameters such as size, bit rate, frame rate etc, it outputs
a .flv(flash video) file and a container .swf file that is quite small
and contains controls, logos, or whatever you need. On your server,
both of these files must be placed in the same directory as your page
using flash. You only refer to the .swf file as usual in the code.
The .flv file is found by the .swf container file automatically, and
you do not even mention it on your web page. After the page is viewed
on a browser, you will find that both the container .swf and .flv
video file have been downloaded to the browser temporary cache.

If you go to my page at http://www.cwdjr.info/video_extreme/VideoZoo.php
you will see a link to a .flv/.swf page. View the page code for this
to see how I use valid object code to make the flash video play both
on IE and most other common recent browsers such as Firefox, Opera,
Netscape, and Seamonkey. These pages are designed to give high
resolution on a good broadband connection, and you likely would encode
at much lower resolution for some ads. Notice this all has not
required any script to play the flash video. I am not for sure exactly
what you intended to do with that very long script you gave, and I am
no sure I would have time to review it in detail, even if I did.
Anyway, a .flv/.swf can be made to play on most recent browsers,
including IE, with valid html using an object approach or even some
invalid html using an embed path for non-IE browsers as often is done.
Hopefully this will help you get your problem with IE solved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top