Welcome to the in5 Answer Exchange! This a place to get answers about in5 (InDesign to HTML5) and make requests.
0 votes
Hi. I used the code to have animations created in ID remain static when scrolling back through pages already seen once. Seems to work. I have a number of mp4 animations appearing onPageLoad in my project that I'd like to be static (showing the final frame) when repeating page views as well. Can a similar code be used to stop the video autoplay from replaying? Thanks! MC
in how_to by (610 points)
  

1 Answer

0 votes

Justin sent me the following code that should work like the code at the end of this post that

  • Lets the video play
  • Allows a user to advance to the next page without the video needing to finish
  • Lets the user return to the page to see the completed video

but he said he hasn't tested it:

$(document).on('pageRendered', function (e) {
$('.activePage').find('audio,video').filter('[data-autoplay]').removeAttr('data-autoplay');
});
by (29.9k points)
Thank you both! I will test it and let you know what happens.

Do I save it as a separate .js and append that along with the other code that's already appended?

You can copy the code, go to the Resources section of the Export HTML5 with in5 dialog (in5 > Export HTML5 with in5...), click the + button to the right of the JavaScript portion, and in the Add Resource dialog that appears, click Paste code... You can have it append to other code that you've already added or make it a separate .js file. If you have other .js files, just make sure that this one has a unique name, such as resource-2.js.

Hi Myra. The new code does seem to disable the autoplay on repeated page loads. However, the videos are rewound to the FIRST frame, not parked on the FINAL frame. The FINAL frame would be more desirable as one scrolls back through the pages. Then I could include a "review" button if the user wants to rerun the video (graph build). But at least the fully-built graph will be visible. Is this possible? Thank you. MC

In the Video Widget, uncheck Auto Rewind to make it show the final frame.

It is unchecked...I have never had it checked. Although in another post, I mentioned some unexpected behaviors in the video window that Erica said she needed to forward to the dev folks and some changes needed to be implemented in the next version. So, maybe this rewind issue (even though the box is unchecked in the widget) is another similar unexpected behavior that I should mention to her in that post thread.

Do you have a poster image applied? Try setting the poster to None.

No poster image is applied.

I wanted to follow up to see if you were able to get the video to not show the first frame. 

If not, would you be able to send us your InDesign file and you html5_output here:

ajarproductions.com/pages/contact.php?category=in5

Hi, Myra. I wound up deciding to allow the videos to re-run upon page re-load after all. They are relatively short and, as it turned out, in some cases the last frame of video wasn't particularly communicative in and of itself. So it seemed to work better in this case to just let them re-load and play rather than keep them fixed on the final frame. That said, if you want me to append the code that Justin suggested and send you a file with that behavior to test, let me know. Thanks, Margaret
Hi Margaret, I'm glad that you got your project to work in a way that made sense.

If you have time and would like to send us your files, we can take a look. You can send them here:

https://ajarproductions.com/pages/contact.php?category=in5