Update: This is now possible with no coding via in5 > Interactive Widgets > Video.
This is one of the strengths of using HTML and in5. You can extend it and add new functionality. :-)
Here's an example of code that will be called when media is done playing:
var player = elem.player || elem;
alert('media has ended');
There is already a prevState function built into the in5 output that you can use to trigger the previous state of an MSO.
You'll need to pass the data-id attribute of the MSO to the prevState function.
Here's sample code that triggers the MSO if the video lives inside the mso (you would use the following code to replace the alert line above):
prevState( $(elem).parents('.mso').attr('data-id') );
More info on extending the output:https://ajarproductions.com/in5course/?lesson=resources