Detecting the end of video using OSMPlayer

I was working on video ads solution using OSMPlayer. So, It was needed to detect video finish event in OSMPlayer …

The Open Standard Media Player (OSMPlayer) is an all-in-one video player. It is open source (MIT) video player for web media, including Red5, Wowza, HTML5, YouTube, Vimeo, Limelight CDN, Kaltura, and Flash.

I have onComplete() method in JavaScript… but I was not sure how to bind video ended event in this JavaScript API …

<script type="text/javascript">
  $(function() {
    $("video").osmplayer({
      width: '100%',
      height: '600px'
    });
  });

$(function() {
        minplayer.get(‘media’, function(media) { 
        media.bind(‘ended’, function() {
       //The video is done!
       alert(“video complete :)”);
});
});
});

</script>

<video src="VIDEO-SOURCE" poster="VIDEO-POSTER-IMAGE"></video>

Thanks to Travis Tidwell