• Register
Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.

How to keep audio playing as the reader navigates to different pages?

0 votes
Is there a way for your program to play music across pages?
 
I can get it to play on the page which it is load, but when we do a page turn the music stops.
asked Apr 12 in how_to by justin (113,940 points)
    

1 Answer

0 votes
 
Best answer

Attach the following code as a .js file in the Resources section of the in5 dialog (how to attach resources):

stopAllMedia = function (targ) {
 if(!targ) targ = document;
 $(targ).find('audio,video').each(function() {
  var media = $(this)[0], player = media.player || media;
  if($(this).parents('.page').index() == 0) return false;
  try{player.pause(); media.currentTime = 0;}catch(e){}
 });
}
 
This function overwrites the existing stopAllMedia function and allows media on the first page to play continuously.
answered Apr 12 by justin (113,940 points)
...