Re: autoplay MP3
- From: "shank" <shank@xxxxxxxxxxxxxxx>
- Date: Sat, 9 Dec 2006 09:19:27 -0500
Tried this in Internet Explorer. It works but In firefox, it doen't. The----------------------------------
following thing will work in Firefox+Internet Explorer :
--Start----
<html>
<head><Title>Exemple</title>
<script>
var seconds=10;
function showCountDown(){
if(seconds==0){
window.close();
return;
}
if(document.all){
document.getElementById('IdA').innerText=seconds--;
}else{
document.getElementById('IdA').textContent=seconds--;
}
window.setTimeout('showCountDown()',1000);
}
</script>
</head>
<body onload="showCountDown()">
<object id="PlayerObject"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" standby="Loading..."
type="application/x-oleobject">
<param name="fileName" value="PATHOFSONG">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<embed type="application/x-mplayer2" showcontrols="true" src="PATHOFSONG"
autostart="true">
</object>
<span id="IdA"></span>
</body>
</html>
--END-----
Q.) What i changed ??
1. I changed <embed ... .. .. . .> to <object . ... . . . . > .
2. I added an If so that it can detect user browser. If user is using
Firefox then change the property from innerText to textContent because
innerText doesn't work with Firefox.
Q.)What is wrong with Auto-Closing method in Firefox ?
This message in "Tools" >"Error Console" :
"Scripts may not close windows that were not opened by script."
Q.)So how can you make auto-close work in Firefox?
By opening this page from a script by using the [window.open] method.
Q.) What is all that <param> in <object> ?
Those are parameters. Here is the explanation of parameters that i used :
name=fileName : value=The path and File Name of mp3
name=autoStart : value=true or false. If set to true, the song will start
playing
immediately. If set
to false, then you have
to click the play
button.
name=showControls : value=true or false. Try it.
You have to change the parameters value in both <param> tag and in <embed>
tag. Example :
If you want to change the showControls to false then change the param
value :
<param name="showControls" value="false">
and the embed value :
<embed type="application/x-mplayer2" showcontrols="false" src="PATHOFSONG"
autostart="true">
I couldn't get it to work in either browser. All I get is a black box in the
lower left window and no music. I think I'll just dummy it down a bit and go
back to the version with no counter. Thanks!!!
.
- References:
- autoplay MP3
- From: shank
- Re: autoplay MP3
- From: Ayush
- Re: autoplay MP3
- From: shank
- Re: autoplay MP3
- From: Ayush
- Re: autoplay MP3
- From: shank
- Re: autoplay MP3
- From: Ayush
- Re: autoplay MP3
- From: Ayush
- autoplay MP3
- Prev by Date: Re: Automatically Redirect Website Users to there language.
- Next by Date: webservice.htc onLoad in Firefox, Mozilla, and Opera
- Previous by thread: Re: autoplay MP3
- Next by thread: What is the java escape for ' charaters?
- Index(es):