Update: This is now possible with no coding via in5 > Interactive Widgets > Video.
Hi David,
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:
$(window).load(function(){
setTimeout(function(){
$('audio,video').each(function(index,elem){
var player = elem.player || elem;
player.media.addEventListener('ended', function(e){
alert('media has ended');
});
});
}, 2000);
});
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