By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Dynamic Object tag works in MZ but not FF

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Andrew Poulos wrote:
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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
Andrew Poulos wrote:
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).
Jul 23 '05 #3

P: n/a
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 :-(
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.


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

Andrew Poulos
Jul 23 '05 #4

P: n/a


Andrew Poulos wrote:

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).


I have filed a bug on bugzilla:
<https://bugzilla.mozilla.org/show_bug.cgi?id=277434>
maybe the behaviour has some reason but maybe it is a bug. If you are
interested on how that is decided you can add yourself to the CC list of
that bug.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.