/    Sign up×
Community /Pin to ProfileBookmark

to load a media file with correct extension.

Hello
I have a script which checks for the type of media player the visitor has(real, windows media, flash etc). Then the script should play the video media file for that player – I have 2 videos in wmf and real media.
Can anyone suggest how to go about this?
I can play a single media file, but how to make the script choose the file and play it, based on the player the visitor has?
Thanks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoOct 07.2005 — You could try something like this.

<i>
</i>&lt;script type="text/javascript"&gt;
var WMPInstalled = detectWindowsMedia();
var numPlugins = navigator.plugins.length;
for (i = 0; i &lt; numPlugins; i++)
{
plugin = navigator.plugins[i];
if (plugin.name.substring(0,10)=="RealPlayer")
{
&lt;a href="realmediafile.rm"&gt;Click here to play file&lt;/a&gt;
//wont appear unless they have the proper plugin installed
}
}

if (WMPInstalled)
{
&lt;a href="windowsmediafile.wmf"&gt;Click here to play file&lt;/a&gt;
//wont appear unless they have the proper plugin installed
}

else
{
You do not have the appropriate plugins to run the file.
Please download either Windows Media Player and/or
RealMedia Player and their plugins and then try again.
}
&lt;/script&gt;
×

Success!

Help @tasneem spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...