Jump to content

audio stream paly time


jawainc

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/124022-audio-stream-paly-time/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.