Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing a Wav file

Status
Not open for further replies.

tmcneil

Technical User
Joined
Nov 17, 2000
Messages
294
Location
US
I'm trying to play a wav file with my browser after it has been created. I have an embed tag on my asp page:
Code:
<% AudioFileName = AudioFileRelPath & audioFile %>

<embed src="<%=AudioFileName%>" autostart="false" hidden="true" id="sound1" enablejavascript="true" width="144" height="60">

What does this error mean when I get to this line of my javascript:
Code:
Error: Object doesn't support this property or method. Wav file does not play and code crashes.

The javascript function
Code:
function OnPreviewAudio() 
{ 
	document.forms[0].AudioFileName.value =  document.forms[0].AudioFileRelPath.value + document.forms[0].audioFile.value;
   	document.forms[0].sound1.src = document.forms[0].AudioFileName.value;  //sound1.src looks like this: audio\50001.wav
	document.forms[0].sound1.Play();  // Error: Object doesn't support this property or method. Wav file does not play and code crashes.
	document.forms[0].playstate.value = 2;
	return false;
}

Todd
 
I can't say for sure, but it's probably something to do with the fact that wav files have nothing to do with forms, so why you're accessing it through the forms collection is anyones guess.

Try accessing it normally - with getElementById.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top