Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
I have been using in5 for some simple iPad-based info kiosks. There's a splash screen and then a button that plays video (going to another state). I was just wondering if there is any way of going back to a previous state automatically after a video finishes or even after a certain amount of time.

I realise this is probably nothing to do with in5 - so apologies if I've overstepped the mark :-) Just wondered if other people here might have faced the same issue. The Adobe forums are just not helping... Thank you.
in how_to by (200 points)
  

1 Answer

0 votes
 
Best answer

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

by (197k points)
selected by