# Detecting when embed object has finished playing

**URL:** <https://forum.kirupa.com/t/detecting-when-embed-object-has-finished-playing/139898>\
**Category:** Uncategorized\
**Created:** [March 6, 2005, 8:11pm UTC](https://forum.kirupa.com/t/detecting-when-embed-object-has-finished-playing/139898 "2005-03-06T20:11:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightshade](https://avatars.discourse-cdn.com/v4/letter/n/41988e/32.png) [@nightshade](https://forum.kirupa.com/u/nightshade)\
**Post date:** [March 6, 2005, 8:11pm UTC](https://forum.kirupa.com/t/detecting-when-embed-object-has-finished-playing/139898/1 "2005-03-06T20:11:34Z")

</div>

I am using the following code:

[size=1]\< embed src=[color=#0000f0]“music/[php code]\<?php echo $src; ?\>.mp3”[/color] width=[color=#0000f0]“300”[/color] height=[color=#0000f0]“45”[/color] autostart=[color=#0000f0]“true”[/color] controls=[color=#0000f0]“smallconsole”[/color]\>\< /embed\>[/size]  
[size=1]  
[/size][size=1][size=1][size=2]to play music on my site.[/size]

Want i want to happen is when the song is finished, a new, random song loads. I can do the random song loading bit but i dont know how to detect when the current song has finished. Any ideas?

thanks,  
[/size]  
[/size]
