A
Andrew Poulos
While this works on IE 6:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>aiff</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/javascript">
//<![CDATA[
function playMedia() {
document.getElementById("objMedia").Play();
}
//]]>
</script>
</head>
<body>
<object id="objMedia"
style="visibility:hidden;"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
type="application/x-oleobject">
<param name="FileName" value="media/aif_sample.aif">
<param name="AutoStart" value="false">
</object>
<div onclick="playMedia();" style="position:absolute; left:475px;
top:242px; width:89px; height:25px; background-color: #00FFFF;">Play</div>
</body>
</html>
that is when I click the div the audio plays, the following DOM-based
code doesn't:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>aiff</title>
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
var audObj = document.createElement("object");
audObj.setAttribute("id", "objMedia");
audObj.setAttribute("classid"," ...[clipped]... ");
audObj.setAttribute("codebase"," ...[clipped]... " );
audObj.setAttribute("type","application/x-oleobject");
var audParam = document.createElement("param");
audParam.setAttribute("name","FileName");
audParam.setAttribute("value","media/aif_sample.aif");
audObj.appendChild(audParam);
audParam = document.createElement("param");
audParam.setAttribute("name","AutoStart");
audParam.setAttribute("value","false");
audObj.appendChild(audParam);
document.body.appendChild(audObj);
}
function playMedia(med) {
document.getElementById("objMedia").Play();
}
//]]>
</script>
</head>
<body>
<div onclick="playMedia();" style="cursorointer; position:absolute;
left:475px; top:242px; width:89px; height:25px; background-color:
#00FFFF;">Play</div>
</body>
</html>
The page appears as I expect it would. There are no errors returned but
the audio never starts playing. Doing an alert on the id "objMedia"
returns Object.
If I edit the code to reflect settings that MZ would recognise then it
plays in MZ.
Why does IE refuse to start the audio?
Andrew Poulos
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>aiff</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/javascript">
//<![CDATA[
function playMedia() {
document.getElementById("objMedia").Play();
}
//]]>
</script>
</head>
<body>
<object id="objMedia"
style="visibility:hidden;"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
type="application/x-oleobject">
<param name="FileName" value="media/aif_sample.aif">
<param name="AutoStart" value="false">
</object>
<div onclick="playMedia();" style="position:absolute; left:475px;
top:242px; width:89px; height:25px; background-color: #00FFFF;">Play</div>
</body>
</html>
that is when I click the div the audio plays, the following DOM-based
code doesn't:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>aiff</title>
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
var audObj = document.createElement("object");
audObj.setAttribute("id", "objMedia");
audObj.setAttribute("classid"," ...[clipped]... ");
audObj.setAttribute("codebase"," ...[clipped]... " );
audObj.setAttribute("type","application/x-oleobject");
var audParam = document.createElement("param");
audParam.setAttribute("name","FileName");
audParam.setAttribute("value","media/aif_sample.aif");
audObj.appendChild(audParam);
audParam = document.createElement("param");
audParam.setAttribute("name","AutoStart");
audParam.setAttribute("value","false");
audObj.appendChild(audParam);
document.body.appendChild(audObj);
}
function playMedia(med) {
document.getElementById("objMedia").Play();
}
//]]>
</script>
</head>
<body>
<div onclick="playMedia();" style="cursorointer; position:absolute;
left:475px; top:242px; width:89px; height:25px; background-color:
#00FFFF;">Play</div>
</body>
</html>
The page appears as I expect it would. There are no errors returned but
the audio never starts playing. Doing an alert on the id "objMedia"
returns Object.
If I edit the code to reflect settings that MZ would recognise then it
plays in MZ.
Why does IE refuse to start the audio?
Andrew Poulos