4 Replies
Julie Stelter

Hi Norm, I'm trying to do what you describe but I can't get the code to work. I have an embedded video that needs to play until the end and then this changes the EndofVideo3 to true. Then I have a trigger in SL2 to jump to the next slide  when the variable changes and if the variable is true. I also have an execute Javascript trigger when the timeline starts. I didn't include the video embed code. Can you help? 

wistiaEmbeds.onFind(function(video) {
video.bind("end", function() {
var player = GetPlayer();
player.SetVar("EndofVideo3", true);
return this.unbind;
});
});

Norm Cousineau

Hi Julie, that code looks foreign to me (onFind?). The SetVar part looks good, but I'd suggest always setting the var EndofVideo3 to false when the slide starts, otherwise there will be no change. When you say 'embed' do you mean the video itself is embedded, or it's part of a web page that's embedded? If the latter is the case, it's more tricky. The first thing you'll want to do is make sure the 'onFind' handler is working, for example try inserting an 'alert' or console.info('works!') to see if your code is taking effect.

If it's an embedded web page with the video in it, and the video is embedded in that page using something called "wistiaEmbeds" (don't know what that is), then that object (wistiaEmbeds) is probably not in same scope as where you're placing the JavaScript, so it wouldn't work.

Try this JavaScript before yours:

alert(wistiaEmbeds);

If the alert is "undefined" then your JavaScript won't work.

If the video were embedded directly on the timeline, that would be easy, you could set a trigger to go to a slide when the media completes.