Jump to content

<object> vs <embed>


SmokingMan

Recommended Posts

I have a page that uses the <embed> tag to play a music file for a slideshow. In trying to convert the page to XHTML 1.0 Strict, I see that the <embed> tag has been deprecated and that I should be using the <object> tag. I've tried looking at all of the references I can find, but I'm having some trouble understanding what attributes to use when referencing the file I want played. Do I use ClassID? Here's the code the way it's currently written:

<embed src="america2.mid" width="0" height="0" autostart="true" loop="false">

How would I use the <object> tag to point to "america2.midi" and only play it once? For some reason I'm a bit thick headed on this one and am having trouble understanding exactly how the <object> tag works.

Link to comment
Share on other sites

The type attribute is optional but some browsers need it as far as I know.
Then would I use type="audio/wav" or type="audio/mp3" respectively depending on the type of media I wanted played?
The embed tag has never been part of any HTML specification by the way.
I know, but when I first started to learn how to code in HTML, I just wanted it to work. Standards, who needed standards? :) I'm now converting everthing to XHTML 1.0 Strict. This particular page was written nearly three years ago before I cared. I'm not in the habit of having background music, so I only used the <embed> tag this one time for slideshow background music.
Link to comment
Share on other sites

I ran into a problem with this. When I went to play the slideshow, it launches Windows Media Player when the page loads. It used to play the music without the media player. I need this music to play in the background while the slideshow plays. And I need it to end when it plays through one time. The slideshow is timed to end at the same time the music ends. Here's the code at this point:

<object data="america2.mid" type="audio/midi" height="0" width="0"></object>

Any suggestions?

Link to comment
Share on other sites

Better use XHTML 1.1. Differences from XHTML 1.0 Strict:No more lang attribute, removed in favor of xml:lang (same thing).No more name attribute, removed in favor of id (same thing, better because shorter).Shorter doctype. Maybe other diffs, but a few.

Only as an XML language, not supported by IE.SmokingMan, that must be because you don't have QuickTime set as the browser plugin to read sound like me... Stupid WMplayer. I don't know what you could do, but there's probably a way around it.
Link to comment
Share on other sites

I could run the slideshow images and soundtrack through my video editor and create a .wmv file that will play in WMP. I only wanted to bring this page up to sandards and let the slideshow play in the page as it already does. If this <object> tag is going to launch a media player seperate from the slideshow, then I either leave the page as is, or redo the show and create the .wmv file. Any suggestions?Here's the URL of the page:http://neverforget.ftwin.com/forgotten/forgotten.html

Link to comment
Share on other sites

  • 4 weeks later...
Guest Snapafun

Got the answer yet ?I'm a complete newbie here but choose to validate as I go but have run into the same problem as posted here.I wish to validate as xhtml1.0 Transitional the following line:<embed src=mamadont.mid style="width:120px;height:25px;" />The result I am after is here: www.snapafun.co.nz/whgrnr.html The above syntax works exactly as I require ~ but of course, not able to validate.This is the last line left to validate but like here, I'm unable to get it to work. I have tried:<objectclassid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="FileName" value="mamadont.mid" /></object>I am trying to get it to render with Firefox, Mozilla, Opera and lastly - IE6.( IE6 is not the priority here.)Any further suggestions anyone ?

Link to comment
Share on other sites

  • 4 weeks later...
Guest mrwhite
<object data="mamadont.mid" type="audio/midi"><param name="audio" value="mamadont.mid" /></object>

This might not work on IE, but as it's not a priority...

I've tried to use that code on an xhtml transitional page, and it doesn't doesn't work in either of my web browsers (IE or Firefox). Does anyone know why?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...