473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

howto change quicktime src with javascript?

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

<html><body>
<script language="JavaS cript">
function Exchange()
{
document.qtvr.s rc = "sample2.pa no";
document.embeds["mov"].src = "sample2.mo v";
}
</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="controlle r" value="true">
<param name="pluginspa ge"
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.mo v" width="600" height="400" autoplay="true"
controller="tru e" border="0"
pluginspage="ht tp://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

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

but IE said that "document.embed s.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 7551
Encapsulin wrote:
Hello everybody.
I'm trying to change src of quicktime embedded object with javascript:

<html><body>
<script language="JavaS cript">
function Exchange()
{
document.qtvr.s rc = "sample2.pa no";
document.embeds["mov"].src = "sample2.mo v";
}
</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="controlle r" value="true">
<param name="pluginspa ge"
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.mo v" width="600" height="400" autoplay="true"
controller="tru e" border="0"
pluginspage="ht tp://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

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

but IE said that "document.embed s.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.getEle mentById("qtvr" ).SetURL("sampl e2.mov");

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="controlle r" value="true">
<param name="pluginspa ge"
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.mo v" width="600" height="400" autoplay="true"
controller="tru e" border="0"
pluginspage="ht tp://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

<a href="#" onclick="javasc ript: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="Exchan ge();'
+ ' return false;">exchang e<\/a>');
</script>
</body></html>

but IE said that "document.embed s.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.getEle mentById("qtvr" ).SetURL("sampl e2.mov");


document.applet s["qtvr"].SetURL("sample 2.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.applet s["qtvr"].data = "sample2.mo v";

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#ed ef-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.or g/>
PointedEars
Dec 28 '05 #3
Thomas 'PointedEars' Lahn wrote:
<a href="#" onclick="javasc ript: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="Exchan ge();'
+ ' return false;">exchang e<\/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.applet s["qtvr"].data = "sample2.mo v";

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#ed ef-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="JavaS cript">
function Exchange()
{
document.qtvr.s rc = "sample2.pa no";
document.embeds["mov"].src = "sample2.mo v";
}
</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="controlle r" value="true">
<param name="pluginspa ge"
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.mo v" width="600" height="400" autoplay="true"
controller="tru e" border="0"
pluginspage="ht tp://www.apple.com/quicktime/download/indext.html"
target="myself" type="video/quicktime" name="mov"></embed>
</object>

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

but IE said that "document.embed s.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="Exchan ge();return false">exchange </a>
or at least:
<a href="javascrip t:Exchange()">e xchange</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.applet s["qtvr"].data = "sample2.mo v";

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#ed ef-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="javasc ript: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="Exchan ge();'
+ ' return false;">exchang e<\/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.applet s["qtvr"].data = "sample2.mo v";

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#ed ef-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><embe d src="sample2.mo v"></object>

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

WHY?

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

this code is ok:
<object><embe d src="sample2.mo v" id="gtvr"></object>
<SCRIPT language="JavaS cript">
document.getEle mentById("qtvr" ).SetURL("sampl e1.mov");
</SCRIPT>

but problem with the following code:
<object><embe d src="../samples/sample2.mov" id="gtvr"></object>
<SCRIPT language="JavaS cript">
document.getEle mentById("qtvr" ).SetURL("../samples/sample1.mov");
</SCRIPT>

Dec 28 '05 #10

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

Similar topics

0
2141
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 to simulate a large-scale, low resolution media facade using individuell video pixels to control lamps mounted into the facade.
1
2207
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 code for doing this, and was wondering if this is not an easy thing to do. Is there some special code needed for detecting Netscape Quicktime plugins, and what about IE?
2
9029
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. ------------------------------------------------------------------------------------ Hi All, I have some AVI files and i want to create a program which will open an AVI file from the hard disk at runtime and run that Video. But here i want
3
5373
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 to false. Here is a code snippet: <EMBED width="100%" height="100%" TYPE="video/quicktime" PLUGINSPAGE="www.apple.com/quicktime/download"
6
4325
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: <script language="javascript"> function _hide_(){ ??? }
1
1794
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. <html> <body> <OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"
1
2470
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 help is appreciated. <html> <head> <title>Sample Page</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <style type="text/css"> <!-- #overlay{position:absolute; left:100px; top: 100px; padding: 5px;...
1
1460
by: raphe | last post by:
hi Java folks, I've checked out this page: http://developer.apple.com/documentation/QuickTime/Conceptual/QTScripting_JavaScript/bQTScripting_JavaScri_Document/chapter_1000_section_6.html#//apple_ref/doc/uid/TP40001526-CH001-SW6 ..about how to control Quicktime movies using javascript. For some reason I can't even get the examples to work when I copy/paste them (changing only the .mov path to an actual movie). anyhow -- could someone...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.