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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.