Question: I have two different scenes which have videos. in the first frame of the scene, I pause the time line. Then I added an event onLayoutLoad to continue timeline. It seems to work, but is this problematic or is there a better way of doing this?
You might want to give the Audio/Video DOM canplay Event a try to see if this approach is an improvement.
It sounds like you might not really be doing anything; On Layout Load doesn't wait for videos and effectively gets triggered immediately when the layout is shown.
@JimScott's advice is the right direction - if you wanted to hold up playing a timeline until a video has enough data to play through you'd do something like:
// assign a Unique Element ID in Hype's Identity Inspector; ex: myVideoID
var videoElement = hypeDocument.getElementById("myVideoID");
// function that will continue the main timeline
function beginAnimations() {
hypeDocument.continueTimelineNamed("Main Timeline");
}
if(videoElement.readyState > 3) {
// if it is already in a good state just begin
beginAnimations();
} else {
// otherwise wait for the canplaythrough event
videoElement.oncanplaythrough = beginAnimations();
}