Dynamic Object tag works in MZ but not FF

A

Andrew Poulos

I'm using the following code to dynamically build an OBJECT tag to
display a QuickTime movie:

window.onload = function() {
addParam = function(p,n,v) { /* parent, name, value */
var c = document.createElement("param");
c.name = n;
c.value = v;
p.appendChild(p);
}

// parameters
var vidUrl = "media/sample.mov";
var vidTop = 100;
var vidLeft = 150;
var vidWidth = 320;
var vidHeight = 240;
var vidCont = 17; /* add 17px for the QT controller */

// create a DIV to contain the QT OBJECT
var v = document.createElement("div");
v.setAttribute("id", "videoContainer");
v.style.position = "absolute";
v.style.left = "0px";
v.style.top = "0px";
document.body.appendChild(v);

// QT OBJECT for non IE
var m = document.createElement("object");
m.data = vidUrl;
m.type = "video/quicktime";
m.width = vidWidth;
m.height = vidHeight + vidCont;
m.style.position = "absolute";
m.style.left = vidLeft + "px";
m.style.top = vidTop + "px";
addParam(m,"AutoStart","false");
addParam(m,"Controller","true");
v.appendChild(m);
}

It works (by that I mean the movie with its controller appears and
plays) in MZ but in FF the missing plugin notice appears. Yet if I write
the code directly into my HTML it also plays in FF. How can I get this
to work in FF?

Andrew Poulos
 
M

Martin Honnen

Andrew said:
I'm using the following code to dynamically build an OBJECT tag to
display a QuickTime movie:

window.onload = function() {
addParam = function(p,n,v) { /* parent, name, value */
var c = document.createElement("param");
c.name = n;
c.value = v;
p.appendChild(p);
}

// parameters
var vidUrl = "media/sample.mov";
var vidTop = 100;
var vidLeft = 150;
var vidWidth = 320;
var vidHeight = 240;
var vidCont = 17; /* add 17px for the QT controller */

// create a DIV to contain the QT OBJECT
var v = document.createElement("div");
v.setAttribute("id", "videoContainer");
v.style.position = "absolute";
v.style.left = "0px";
v.style.top = "0px";
document.body.appendChild(v);

// QT OBJECT for non IE
var m = document.createElement("object");
m.data = vidUrl;
m.type = "video/quicktime";
m.width = vidWidth;
m.height = vidHeight + vidCont;
m.style.position = "absolute";
m.style.left = vidLeft + "px";
m.style.top = vidTop + "px";
addParam(m,"AutoStart","false");
addParam(m,"Controller","true");
v.appendChild(m);

Does it improve things if you reorder the appendChild calls to first
build the object with the params, then the div and finally append the
div to the body e.g.

var v = document.createElement("div");
v.setAttribute("id", "videoContainer");
v.style.position = "absolute";
v.style.left = "0px";
v.style.top = "0px";

var m = document.createElement("object");
m.data = vidUrl;
m.type = "video/quicktime";
m.width = vidWidth;
m.height = vidHeight + vidCont;
m.style.position = "absolute";
m.style.left = vidLeft + "px";
m.style.top = vidTop + "px";
addParam(m,"AutoStart","false");
addParam(m,"Controller","true");
v.appendChild(m);

document.body.appendChild(v);




It works (by that I mean the movie with its controller appears and
plays) in MZ but in FF the missing plugin notice appears. Yet if I write
the code directly into my HTML it also plays in FF. How can I get this
to work in FF?

That sounds indeed unusual that it works with Mozilla but not Firefox.
What Mozilla version is that exactly, what Firefox version exactly?
Mozilla 1.7.5 should behave the same as Firefox 1.0.
 
F

Fred Oz

Andrew said:
I'm using the following code to dynamically build an OBJECT tag to
display a QuickTime movie:

window.onload = function() {
addParam = function(p,n,v) { /* parent, name, value */
var c = document.createElement("param");
c.name = n;
c.value = v;
p.appendChild(p);

That should be:

p.appendChild(c);

Works fine for me in FF 1.0 and Mozilla 1.3 (OK, I ditched
Mozilla when FF became good enough so haven't updated).
 
A

Andrew Poulos

Martin Honnen wrote:

[snip]
Does it improve things if you reorder the appendChild calls to first
build the object with the params, then the div and finally append the
div to the body e.g.

var v = document.createElement("div");
v.setAttribute("id", "videoContainer");
v.style.position = "absolute";
v.style.left = "0px";
v.style.top = "0px";

var m = document.createElement("object");
m.data = vidUrl;
m.type = "video/quicktime";
m.width = vidWidth;
m.height = vidHeight + vidCont;
m.style.position = "absolute";
m.style.left = vidLeft + "px";
m.style.top = vidTop + "px";
addParam(m,"AutoStart","false");
addParam(m,"Controller","true");
v.appendChild(m);

document.body.appendChild(v);

Unfortunately, it made no difference. I checked the DOM inspector in FF
and I've found that the attribute type="video/quicktime" has not been
set for the OBJECT tag (it *is* set in MZ). So when I try to play
different types of video files that are compatible with the QT plugin
some work and some don't. For example:
- .AVI doesn't play
- .MOV plays
- .MPG plays

They all work if I code the HTML directly.

I just checked the list of installed plugins in FF and AVI is not listed
so I guess that not being able to set the TYPE attribute and it not
being listed means there's no way to get the QT plugin to play a .avi.

I think this issue has been discussed before but I thought it only
impacted IE. I also think I'm snookered unless there's some way to
define a TYPE attribute dynamically or some other workaround :-(
That sounds indeed unusual that it works with Mozilla but not Firefox.
What Mozilla version is that exactly, what Firefox version exactly?
Mozilla 1.7.5 should behave the same as Firefox 1.0.

I'm testing on MZ 1.7.5 and FF 1.0 (both under WinXP SP1).

Andrew Poulos
 

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,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top