473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

howto change quicktime src with javascript?

Hello everybody.
I'm trying to change src of quicktime embedded object with javascript:

<html><body>
<script language="JavaScript">
function Exchange()
{
document.qtvr.src = "sample2.pano";
document.embeds["mov"].src = "sample2.mov";
}
</script>

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="600" height="400"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qtvr">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="pluginspage"
value="http://www.apple.com/quicktime/download/indext.html">
<param name="target" value="myself">
<param name="type" value="video/quicktime">
<param name="src" value="sample1.pano">
<embed src="sample1.mov" width="600" height="400" autoplay="true"
controller="true" border="0"
pluginspage="http://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

<a href="#" onclick="javascript:Exchange()">exchange</a>
</body></html>

but IE said that "document.embeds.mov.src is not object", and image
isn't changed ( IE,Mozilla) when user click on the link "exchange".
What is wrong, how to do this correctly?
Thank in advance.

Dec 27 '05 #1
15 7530
Encapsulin wrote:
Hello everybody.
I'm trying to change src of quicktime embedded object with javascript:

<html><body>
<script language="JavaScript">
function Exchange()
{
document.qtvr.src = "sample2.pano";
document.embeds["mov"].src = "sample2.mov";
}
</script>

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="600" height="400"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qtvr">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="pluginspage"
value="http://www.apple.com/quicktime/download/indext.html">
<param name="target" value="myself">
<param name="type" value="video/quicktime">
<param name="src" value="sample1.pano">
<embed src="sample1.mov" width="600" height="400" autoplay="true"
controller="true" border="0"
pluginspage="http://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

<a href="#" onclick="javascript:Exchange()">exchange</a>
</body></html>

but IE said that "document.embeds.mov.src is not object", and image
isn't changed ( IE,Mozilla) when user click on the link "exchange".
What is wrong, how to do this correctly?
Thank in advance.

To change the source of a QT movie you use the SetURL method like so,
document.getElementById("qtvr").SetURL("sample2.mo v");

Though the sample code you've included above contains deprecated
features and mistakes which I have to leave to someone else to fix.

Andrew Poulos
Dec 28 '05 #2
Andrew Poulos wrote:
Encapsulin wrote:
[...]
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="600" height="400"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qtvr">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="pluginspage"
value="http://www.apple.com/quicktime/download/indext.html">
<param name="target" value="myself">
<param name="type" value="video/quicktime">
<param name="src" value="sample1.pano">
<embed src="sample1.mov" width="600" height="400" autoplay="true"
controller="true" border="0"
pluginspage="http://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

<a href="#" onclick="javascript:Exchange()">exchange</a>
`javascript:' does not belong into intrinsic event handlers. Declare
the default scripting language for event handler attributes in the `head'
element instead:

<meta http-equiv="Content-Script-Type" content="text/javascript">

The `click' event should be canceled properly, and the script-only link
should be written via script:

<script type="text/javascript">
document.write('<a href="#" onclick="Exchange();'
+ ' return false;">exchange<\/a>');
</script>
</body></html>

but IE said that "document.embeds.mov.src is not object", and image
isn't changed ( IE,Mozilla) when user click on the link "exchange".
What is wrong, how to do this correctly?
Thank in advance.
To change the source of a QT movie you use the SetURL method like so,
document.getElementById("qtvr").SetURL("sample2.mo v");


document.applets["qtvr"].SetURL("sample2.mov");

should suffice. However, it is error-prone to assume that the QuickTime
plugin would always be used for displaying this object and so a SetURL()
method would be available; `param' elements' values need not to be
followed, the `data' attribute is missing and the codebase is in a format
that would not be understood on non-Windows systems. Here in Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.8) Gecko/20051224 Debian/1.5.dfsg-3
Firefox/1.5 Mnenhy/0.7.3.0 that is likely to trigger the assigned mplayer
plugin instead.

Therefore, I would refrain from calling SetURL() but instead use the `data'
attribute in the first place and attempt to change the value of that
attribute via its representative property:

document.applets["qtvr"].data = "sample2.mov";

See also
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177>
<URL:http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT>

However, that is untested as well.
Though the sample code you've included above contains deprecated
features and mistakes which I have to leave to someone else to fix.


<URL:http://validator.w3.org/>
PointedEars
Dec 28 '05 #3
Thomas 'PointedEars' Lahn wrote:
<a href="#" onclick="javascript:Exchange()">exchange</a>


`javascript:' does not belong into intrinsic event handlers. Declare
the default scripting language for event handler attributes in the `head'
element instead:

<meta http-equiv="Content-Script-Type" content="text/javascript">

The `click' event should be canceled properly, and the script-only link
should be written via script:

<script type="text/javascript">
document.write('<a href="#" onclick="Exchange();'
+ ' return false;">exchange<\/a>');
</script>


Sorry but I don't understand why code created dynamically is "correct"
whereas the the same code written directly in the page is "wrong"?
Therefore, I would refrain from calling SetURL() but instead use the `data'
attribute in the first place and attempt to change the value of that
attribute via its representative property:

document.applets["qtvr"].data = "sample2.mov";

See also
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177>
<URL:http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT>

However, that is untested as well.


I tested doc.applets, as opposed to using SetURL, and couldn't get it to
work.

Andrew Poulos
Dec 28 '05 #4
VK

Encapsulin wrote:
Hello everybody.
I'm trying to change src of quicktime embedded object with javascript:

<html><body>
<script language="JavaScript">
function Exchange()
{
document.qtvr.src = "sample2.pano";
document.embeds["mov"].src = "sample2.mov";
}
</script>

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
width="600" height="400"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qtvr">
<param name="autoplay" value="true">
<param name="controller" value="true">
<param name="pluginspage"
value="http://www.apple.com/quicktime/download/indext.html">
<param name="target" value="myself">
<param name="type" value="video/quicktime">
<param name="src" value="sample1.pano">
<embed src="sample1.mov" width="600" height="400" autoplay="true"
controller="true" border="0"
pluginspage="http://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

<a href="#" onclick="javascript:Exchange()">exchange</a>
</body></html>

but IE said that "document.embeds.mov.src is not object", and image
isn't changed ( IE,Mozilla) when user click on the link "exchange".
What is wrong, how to do this correctly?


Of course it says that:

The <object><embed></embed></object> structure was used in the past to
cover browsers with object or embed support (but not both).
Thus if browser understands <object> it will *ignore* internal <embed>.
And if it doesn't understand <object> then it will skip on it and use
internal <embed> instead. As all known to me modern browsers do
understand <object> tag - your <embed> is never parsed so no use to
address it.

Also please note an erroneus link syntacs which will work for a *very
tolerant* browser only:
javascript: psi-protocol can be indicated in the href attribute only,
not in event handlers. The correct way would be:
<a href="noscript.html" onclick="Exchange();return false">exchange</a>
or at least:
<a href="javascript:Exchange()">exchange</a> (problems prone)

Dec 28 '05 #5

Andrew Poulos napisal(a):
Thomas 'PointedEars' Lahn wrote:
Therefore, I would refrain from calling SetURL() but instead use the `data'
attribute in the first place and attempt to change the value of that
attribute via its representative property:

document.applets["qtvr"].data = "sample2.mov";

See also
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177>
<URL:http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT>

However, that is untested as well.


I tested doc.applets, as opposed to using SetURL, and couldn't get it to
work.

Andrew Poulos


I tried a few approaches, I don't know if it was result of my mistakes
or it was simply unsupported, but none of the gentle methods of
replacing data source worked. I used brute force instead:
createElement('object'), set the properties and children, then
replaceNode. Rip the whole player out of the page and replace it with a
new instance of the player with the new movie assigned. Worked.

Dec 28 '05 #6
Andrew Poulos wrote:
Thomas 'PointedEars' Lahn wrote:
<a href="#" onclick="javascript:Exchange()">exchange</a>


`javascript:' does not belong into intrinsic event handlers. Declare
the default scripting language for event handler attributes in the `head'
element instead:

<meta http-equiv="Content-Script-Type" content="text/javascript">

The `click' event should be canceled properly, and the script-only link
should be written via script:

<script type="text/javascript">
document.write('<a href="#" onclick="Exchange();'
+ ' return false;">exchange<\/a>');
</script>


Sorry but I don't understand why code created dynamically is "correct"
whereas the the same code written directly in the page is "wrong"?


It is _not_ the same code. Besides, what makes the former also wrong is
that the link will do nothing without script support; the latter approach
will not generate the link at all without script support, so in that case
there would be nothing that did not do nothing :)
Therefore, I would refrain from calling SetURL() but instead use the
`data' attribute in the first place and attempt to change the value of
that attribute via its representative property:

document.applets["qtvr"].data = "sample2.mov";

See also
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177>
<URL:http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT>

However, that is untested as well.


I tested doc.applets, as opposed to using SetURL, and couldn't get it to
work.


Did you provide the `data' attribute value for the `object' element instead
of using the `param' element?
PointedEars
Dec 28 '05 #7
It works, thank you!!!

Dec 28 '05 #8
oops,problem with Mozilla (but IE is ok):

this is works:
<object><embed src="sample2.mov"></object>

but this isn't works:
<object><embed src="../samples/sample2.mov"></object>

WHY?

Dec 28 '05 #9
sorry, I need to detalize the problem:

this code is ok:
<object><embed src="sample2.mov" id="gtvr"></object>
<SCRIPT language="JavaScript">
document.getElementById("qtvr").SetURL("sample1.mo v");
</SCRIPT>

but problem with the following code:
<object><embed src="../samples/sample2.mov" id="gtvr"></object>
<SCRIPT language="JavaScript">
document.getElementById("qtvr").SetURL("../samples/sample1.mov");
</SCRIPT>

Dec 28 '05 #10
Encapsulin wrote:
sorry, I need to detalize the problem:

this code is ok:
<object><embed src="sample2.mov" id="gtvr"></object>
<SCRIPT language="JavaScript">
document.getElementById("qtvr").SetURL("sample1.mo v");
</SCRIPT>


It is still not OK.
PointedEars
Dec 28 '05 #11
Thomas 'PointedEars' Lahn said the following on 12/28/2005 4:53 PM:
Encapsulin wrote:

sorry, I need to detalize the problem:

this code is ok:
<object><embed src="sample2.mov" id="gtvr"></object>
<SCRIPT language="JavaScript">
document.getElementById("qtvr").SetURL("sample1. mov");
</SCRIPT>

It is still not OK.


More "clues" from the clueless?

"It is still not OK" is about as useless an answer as "It doesnt work"
is a description.

If you have nothing positive to contribute then please stop wasting
peoples time by having them read your garbage.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 28 '05 #12
I'm still not understood, why relative path to the .mov doesn't works.
I have the following html-code:
<OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"

codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="180" height="160"
id="movie" >
<PARAM name="src" value="">
<EMBED width="180" height="160"
src=""
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
name="movie2"
enablejavascript="true">
</EMBED>
</OBJECT>
<br><a
href="javascript:document.movie.SetURL('sample1.mo v');">sample1</a>
<br><a
href="javascript:document.movie.SetURL('sample2.mo v');">sample2</a>
<br><a
href="javascript:document.movie.SetURL('./mov/sample1.mov');">sample1</a>
<br><a
href="javascript:document.movie.SetURL('./mov/sample2.mov');">sample2</a>

The problem is: first 2 jscripts works properly, but last 2 doesn't
works in both IE and Mozilla. Does anybody know why???

Dec 29 '05 #13

Encapsulin napisal(a):
href="javascript:document.movie.SetURL('./mov/sample1.mov');">sample1</a>
<br><a
href="javascript:document.movie.SetURL('./mov/sample2.mov');">sample2</a>

The problem is: first 2 jscripts works properly, but last 2 doesn't
works in both IE and Mozilla. Does anybody know why???


Just a thought: Are you testing it on a real server, or just loading a
file from the disk, on Windows? In this case, you might want to try
'.\mov\sample2.mov' instead. And then fix the path back to
'./mov/sample2.mov' before uploading, because webserver should handle
it correctly.

Dec 29 '05 #14
Encapsulin wrote:
I'm still not understood,
what is expected behavior here? Yes, indeed, alas.

<URL:http://jibbering.com/faq/#FAQ2_3>
why relative path to the .mov doesn't works.
I have the following html-code:
<OBJECT
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"

codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="180" height="160"
id="movie" >
Again, that is not going to work on non-Windows systems or those without
the QuickTime plugin, that includes systems using another application for
QuickTime movies.
<PARAM name="src" value="">
<EMBED width="180" height="160"
src=""
TYPE="video/quicktime"
PLUGINSPAGE="www.apple.com/quicktime/download"
name="movie2"
enablejavascript="true">
</EMBED>
This is the last time I am going to tell you to get rid of that invalid
`embed' element.

news:11*********************@g44g2000cwa.googlegro ups.com
(VK is correct about the obsolete status of that proprietary element)

news:11****************@PointedEars.de

<URL:http://validator.w3.org/>
</OBJECT>
<br><a
href="javascript:document.movie.SetURL('sample1.mo v');">sample1</a>
That is not what was suggested by Andrew. Have you even read what was
posted?
<br><a
href="javascript:document.movie.SetURL('sample2.mo v');">sample2</a>
<br><a
href="javascript:document.movie.SetURL('./mov/sample1.mov');">sample1</a>
<br><a
href="javascript:document.movie.SetURL('./mov/sample2.mov');">sample2</a>
<URL:http://jibbering.com/faq/#FAQ4_24>
The problem is: first 2 jscripts works properly, but last 2 doesn't
works in both IE and Mozilla.
"Does not work" is a useless error description. [psf 4.11]

<URL:http://jibbering.com/faq/#FAQ4_43>
Does anybody know why???


Your Question Mark key is borken.

Possibilities:

1. The path is wrong: there is no `mov/sample1.mov' but a `sample1.mov'.
Check the path by accessing the resource directly (Address Bar etc.)

2. The plugin cannot handle this type of relative paths.
Omit the "./".
HTH

PointedEars
Dec 29 '05 #15
Andrew Poulos wrote:
Thomas 'PointedEars' Lahn wrote:
Therefore, I would refrain from calling SetURL() but instead use the
`data' attribute in the first place and attempt to change the value of
that attribute via its representative property:

document.applets["qtvr"].data = "sample2.mov";

See also
<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-9893177>
<URL:http://www.w3.org/TR/html4/struct/objects.html#edef-OBJECT>

However, that is untested as well.


I tested doc.applets, as opposed to using SetURL, and couldn't get
it to work.


You could not get it to work because I misread the specification.
HTMLDocument::applets applies to `object' elements that refer to
applets and `applet' elements only. We do have an `object' element
here but not one that refers to an applet.

It should work with document.getElementsById('qtvr').data = "sample.mov"
(without the Reference Worm, of course.)
Regards,
PointedEars
Dec 30 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stefan Tietke | last post by:
Hi all, for a realtime simulation of a video installation we want to use Quicktime to read video data from a file or stream and process the data in a realtime Gameblender model. We are trying...
1
by: Creegan | last post by:
I have a webpage with thumbnail images that I want to be able to click on to play associated Quicktime movie files in either IE or Netscape. I'm having difficulty finding any HTML or Javascript...
2
by: Vanga Sasidhar | last post by:
Already posted the same message but the date and time of my machine was set back. and it was listed under the old date. Thats why I am posting the same message again. Please accept this. ...
3
by: ghassett | last post by:
Hello, When I have a Quicktime object embedded in my web page, and I use Javascript to set its URL, the clip always starts playing immediately, even if I have the player's autoplay property set...
6
by: Encapsulin | last post by:
Hello everybody, is it possible to hide qtvr <object...> (or even change its size to 1 pixel rectangle)? I need to hide qtvr from the page dynamically, if .mov source is empty. For example: ...
1
by: Binba | last post by:
I created the simplest embed QT movie page, and for starters, want to get the version. An HREF event works fine, but otherwise I get a fabulous "Unspecified error". I'm using MSIE6 WinXP SP2. ...
1
by: rockva | last post by:
I am facing this problem of DIV layer going behind the quick time player in IE 7 browser. It works good in Firefox. HTML code that i am using is below. Is some IE specific code required here? Any...
1
by: raphe | last post by:
hi Java folks, I've checked out this page: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.