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 Link to comment https://forums.phpfreaks.com/topic/124022-audio-stream-paly-time/ 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. Link to comment https://forums.phpfreaks.com/topic/124022-audio-stream-paly-time/#findComment-643524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.