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 (490 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 (18.3k 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.