Click to See Complete Forum and Search --> : Why Does QuickTime exclusively play "embed tag" wav files on my computer?
MarcMiller
11-29-2006, 01:36 PM
Hi
the code below uses the embed tag with the help of JavaScript to play a small click sound on my XP computer. This happens when I click the link. It always brings up the QuickTime plug-in to play the sound. It does this even when I change the file associated with the wav format to say the real player or Windows media player. It just doesn't matter its always the QuickTime plug-in that comes up and plays the sound on my computer. So I am wondering is the QuickTime plug-in essential for the script below to work? Will this script works on people's computers who do not have QuickTime installed but do have one of the numerous other plug-ins capable of playing wav files? Can anyone help me understand why it's always QuickTime on my computer?
Sincerely
Marc
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Eembed Tag Sound</title>
<meta content="text/html; charset=us-ascii" http-equiv="Content-Type" />
<link href="testimonials.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function onClickSound () {
var thissound=document.getElementById("sound1");
thissound.Play();
}
window.onload = function () {
document.getElementById("a").onclick=onClickSound;
}
</script>
</head>
<body>
<a id="a" href="#">play sound</a>
<embed src="click_x.wav" autostart=false id="sound1"
enablejavascript="true" volume="30">
</body>
</html>
toicontien
11-29-2006, 01:44 PM
QuickTime might be the media player set to handle WAV files. This would be a setting in the QuickTime options. How are you trying to use RealPlayer or Windows Media? Usually the browser will use whichever helper program is set to handle the given sound format. Quicktime might not be used on all computers.
MarcMiller
11-29-2006, 05:44 PM
OK
perhaps I should get to to the heart of what I am trying to figure out. I have read that the script in, this case the metmod "play()," which allows you to turn on the sound in a plugging is a method of the plug-in and not JavaScript. If the settings of your plug-ins determine which plugging is the default plug-in for wav files will the embed tag seek the plug and with an appropriate "play ()" method in irrespect of of what plug-in settings a user has as their default wav file. And if this is so is this unlike what is accomplished with the object tag instead of the embed tag. I have found a link (http://wiki.dreamhost.com/index.php/Object_Embedding) referred to me by the "The Web Standards Project" (http://www.webstandards.org/2006/08/15/valid-flash-video-and-audio-embed-object-markup/) in this link they use object tags nested in another object tag with conditional comments around the inner object tag to create valid audio. However this link also shows the audio player explicitly stated with the object tag XHTML code it shows. So is that the state of affairs with present web page technology. If you can answer this question you would be helping me out on something I have been trying figure out for more than a week. So please tell me what you know if you get me any further along on figuring this out I would certainly appreciate it.
Marc
toicontien
11-29-2006, 05:57 PM
I have read that the script in, this case the metmod "play()," which allows you to turn on the sound in a plugging is a method of the plug-in and not JavaScript. If the settings of your plug-ins determine which plugging is the default plug-in for wav files will the embed tag seek the plug and with an appropriate "play ()" method in irrespect of of what plug-in settings a user has as their default wav file.
That sounds right. The Play() function is an API function call to the plugin. I suppose if the windows media function to play the sound is called play() -- with a lower-case 'p' -- then the sound might not play for users who do not have QuickTime installed. I'm admittedly shooting in the dark here a little. If you use the Play() function and someone has QuickTime and Windows Media, perhaps the Play() function is specific to QuickTime and the browser then uses QuickTime. I'm not entirely sure, but it sounds logical.
And if this is so is this unlike what is accomplished with the object tag instead of the embed tag. I have found a link (http://wiki.dreamhost.com/index.php/Object_Embedding) referred to me by the "The Web Standards Project" (http://www.webstandards.org/2006/08/15/valid-flash-video-and-audio-embed-object-markup/) in this link they use object tags nested in another object tag with conditional comments around the inner object tag to create valid audio.
The OBJECT element is meant to replace the EMBED element. EMBED was created by Netscape and is a proprietary element, although most non Internet Explorer browsers support it. A relic from the old days.
However this link also shows the audio player explicitly stated with the object tag XHTML code it shows.
In order for things to work in Internet Explorer, you've got to use ActiveX. The classid narrows it down to one program, so in that sense yes, you are specifying the application to use. In the Standards Method, you specify the mime type. Then any application you choose to support that type of file will be embedded in the browser. Conceivably, you could personally set Real Player to play Windows Media files (if Real supports WM files), in which case Real Player would be embedded on the page and play the Windows Media sound file.
So is that the state of affairs with present web page technology.
Unfortunately this is the hand we've been dealt :( Internet Explorer is the Ace up our sleeve that turns out to be a 2.
MarcMiller
11-29-2006, 10:47 PM
Thank you for that rather lengthy response. It does however bring up still more questions in my mind. There is a site (http://www.richinstyle.com/guides/objects4.html#declared) I know which has an explanation of objects I rather like. On this site part of the explanation of objects includes the following code.
<OBJECT id="useme" declare data="video.mpeg">
</OBJECT>
<A href="#useme">Click to show video</A>
Well that code directly above is not explicitly declaring what mpeg player to play the video. It is also using a kind of onclick event without the "play()" method, but perhaps the play method would work their. I assumed this would work the way you perceive other than Internet Explorer browsers working with the object tag I asked you about.
Using the play method is imperative to me since my href attribute is taken up by a new location which must be delayed and have the play method be called before the new location takes effect to give my little click sound time to play. I am creating a little click sound for all my links and already have script that delays new location then evokes the click sound using the play method. It uses the embed tag at this time.
Looking at code from the standard compliant link (http://wiki.dreamhost.com/index.php/Object_Embedding)for audio XHTML code I see this.
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="200" height="16">
<param name="src" value="audio.mp3" />
<param name="autoplay" value="true" />
<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />
<param name="controller" value="true" />
<!--[if !IE]> <-->
<object data="audio.mp3" width="200" height="16" type="video/quicktime">
<param name="pluginurl" value="http://www.apple.com/quicktime/download/" />
<param name="controller" value="true" />
</object>
<!--> <![endif]-->
</object>
It appears that the outer object tag is explicitly declaring the application as shown in the code marked in orange above. From what you have said and the link I have given at the top of this posting I think that is unnecessary. In the quoted code above the inner object tag has that "type" equaling "video/QuickTime" is that what you mean by the "mime type". If that is the "mind type" is a possible to set that mime type to disagree with what your user has set on his/her computer. And if so would they still be an advantage to fooling a validator into letting you use the embed tag and using conditional comments. I mean does the embed tag some how let your computer do its own thing while the object tag and Internet Explorer does not. Admittedly I am confused. Your further comments would be appreciated.
Marc
toicontien
11-30-2006, 10:33 AM
The outer OBJECT specifies an ActiveX object, which is for Internet Explorer. Other browsers will fail this, and try the inner OBJECT instead, which is coded for standards browsers. The "<!--[if !IE]> <-->" stuff is there to hide the inner OBJECT from Internet Explorer because it doesn't implement the OBJECT element correctly. The mime type of a file in this case is in the type attribute of the inner OBJECT tag. The mimetype doesn't specify what application should be used, it describes what the file is to be interpreted as. Since all data a computer downloads is binary, the mime type tells the computer how it should read that data, as plain text, HTML, MP3, WAV, video, etc. Regardless of what you used to save a file, it's all 1's and 0's to a computer.
Then, the user specifies which application should handle files with certain mime types. It isn't the mime type that determines the application. The mime type determines the data. The data is then handled by an application set to handle that data file's mime type.
The only functional difference between OBJECT and EMBED is that one is deprecated :) They both accomplish the same thing. OBJECT gives you more control over the embedded data than EMBED does. I guess if either play() or Play() would work, you can use an if-else construct in JavaScript to use either one:
if (mysound.play) {
mysound.play();
} else if (mysound.Play) {
mysound.Play();
}
MarcMiller
11-30-2006, 01:48 PM
Originally Posted by toicontien
In order for things to work in Internet Explorer, you've got to use ActiveX. The classid narrows it down to one program, so in that sense yes, you are specifying the application to use.
OK-does that mean this "classid" is something that is Internet Explorer specific and other browsers will ignore this "classid". And if so could you give me or point me to some sort of "classid" if statement which would be good for wav files. And in general are there other threads or tutorials which I might find for future use to say create if "classid" statements for videos, other forms of media etc., which would explain about this "classid" if statement stuff. I would not even know how to set up a Google search to find such information.
toicontien
11-30-2006, 02:06 PM
The classid is specific to Internet Explorer. That identifies which active x component should be loaded. In short, it identifies which application should open the file to be embedded. So in Internet Explorer, you do specify the program that plays the wav file. Since other browsers need the inner OBJECT tag, which has the mime type, other browsers will look to the user's preferences as to which application should play the wav file.
Since a WAV file is a format universally accepted by any media player, you don't need to tell which application should open it up, even though Internet Explorer requires you to do so. For your purpose, it doesn't matter what the user has for a media player, something will play it. It all really has to do with what function call needs to be made.
The OBJECT tags you need to use are an outter one that tells IE-Win to use Windows Media. The inner OBJECT, for all other browsers, will just have the mime type and then use whatever the user has chosen to handle WAV files. The only catching point is what function call is used to get the sound to play. That MIGHT depend on the media player available. It might be universally accepted that play() plays the sound. You won't know until you try it :)
Put up a test page online to see how various computers handle it. Sometimes you've just got to go in blind and address problems as they come up if you don't have access to multiple computers. You can also uninstall Quicktime from your computer and see how it behaves. Basically, just play around with it.