jawainc Posted September 13, 2008 Share Posted September 13, 2008 hi i want to play an audio file in web page and i want play it for 50 seconds, i've searched the web but didn't find any solution; here's my code for palying audio stream: <embed width="192" height="50" style="background-color:#9DFE01" controls="console" src="<?=AUDIO_IMG_DOWN_PATH.$listening_data[$i]['v_file']?>" type="<?=$listening_data[$i]['v_type']?>" autostart="true" loop="false" controller="true" bgcolor="#9DFE01" ></embed> thanks Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 I would suggest using Javascript. Try this: <script type="text/javascript"> function stopAudio(){ document.getElementById('audio').src = ""; } setTimeout("stopAudio()",5000); </script> <embed id="audio" width="192" height="50" style="background-color:#9DFE01" controls="console" src="<?=AUDIO_IMG_DOWN_PATH.$listening_data[$i]['v_file']?>" type="<?=$listening_data[$i]['v_type']?>" autostart="true" loop="false" controller="true" bgcolor="#9DFE01" ></embed> This will just delete the source of the embedded image. You could also easily add a function like startAudio() that re-added the source. Then add start and stop buttons, if ya wanted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.