Basically here is what I need done. I have a HTML5 video player. Right now I have code that after 20 seconds, the div that the video is in dissapears.

I'd like to have it do the following:

If the video is NOT played, then hide the div it is in after 10 seconds. If it is played, I would like the video to dissapear after it is done playing.

Here is the code I currently have which hides the div after 20 seconds or so:

Code JavaScript:
<script type="text/javascript">
$(document).ready(function(){
   setTimeout(function(){
  $("div.mydiv").slideUp("slow", function () {
  $("div.mydiv").remove();
      });
 
}, 22500);
 });
 </script>

Thank you very much for any help!!