Javascript to change variable
Feb 15, 2017
Hi all,
I need to use javascript to change the value of a variable when an embedded video completes. The video is coming from Wistia. A couple of years ago, I was able to do able to do this but now the same code doesn't work. Here's the code. I have tried two variations but all are non-starters. Can any one help me with this?
- removed this line <script type="text/javascript">
- removed parent in this line var player = parent.GetPlayer();
<script type="text/javascript">
wistiaEmbeds.onFind(function(video) {
video.bind("end", function() {
var player = parent.GetPlayer();
player.SetVar("EndofVideo3","on");
return this.unbind;
});
});
</script>
Cheers,
Julie
2 Replies
Your code assumes a) wistiaEmbeds exposes onFind, b) you can bind to an "end" event and c) parent is Articulate, which is likely isn't. I'd suggest watching this variables in your browser's Developer console. My money's on the parent context.. Good luck; non trivial code
Thank you Brian for the response. The problem was actually in teh embed code from Wistia. I needed to remove the async command. When I did that everything worked. I have been told by other Javascript developers that the code used in articulate is not typically the way it is done.
Thank you Brian!
Cheers,
Julie
This discussion is closed. You can start a new discussion or contact Articulate Support.