Quote:
Originally Posted by eimermusic
Hi,
I can usually find the answers to html-related questions either via google or the forum search. This time I am stumped. I would appreciate any tricks that can fix the following.
I need to embed video and audio on a page. That is it. Or rather, how can I embed a file and let the browser choose the plugin? I can't seem to find any reference to any tag that will do this in the current versions of html.
The EMBED tag used to do this back in the bad old days. Nowadays all I find are convoluted variations of object tags. All those workarounds require that I (the developer of the page) decide which plugin the visitor should use to best display a certain file format. There are several plugins for various browsers that all handle mpeg4, 3gpp, mp3. Even pdf can be viewed by more than one plugin. I can't (and frankly wouldn't want to) know which plugin the visitor prefers.
How can I embed an "object" at /path/to/file which is of the type some/media and let the browser choose the plugin? Is that still an utopia after all these years? I haven't dealt with this in a few years and I am honestly surprised I can't find any solid example.
thanks in advance.
/Martin
|
The JW FLV Media player (
http://www.longtailvideo.com/players/jw-flv-player/) is a very popular option as it plays a number of popular filetypes (FLV, MP4, MP3, AAC, JPG, PNG and GIF). It also supports playlists, which is very nice. According to the website it supports "RTMP, HTTP, live streaming, various playlists formats".
It's a free download for personal use (I believe a "donation" is suggested for commercial use) and it has pretty good online support (also boasts an online setup wizard here:
http://www.longtailvideo.com/support...r-setup-wizard) if you get lost in the installation or customization -- yes, it can be skinned. It is javascript-based and there are limitations of course (for example, it won't play WMV or WMA files), but there is a reason that this player is so popular... Besides, any user who is open to playing online A/V content is probably not the sort of user who has javascript disabled -- just food for thought.
Anyway, this doesn't use embed or object tags at all. Once the base code is included in the header with a <link> tag the in-page script call is done like so:
Code:
<script type='text/javascript' src='/embed/swfobject.js'></script>
<div id='mediaspace'>This div will be replaced</div>
<script type='text/javascript'>
var s1 = new SWFObject('/jw/embed/player.swf','ply','470','320','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addParam('flashvars','file=http://content.bitsontherun.com/videos/3ta6fhJQ.flv');
s1.write('mediaspace');
</script>
That's it. The media player appears inside of the "mediaspace" div in this case. The existing text is overwritten with the player.