3 Replies
Ashley Terwilliger

Hi Sagar,

I haven't seen a lot of examples where the Javascript was embedded into a web object, and as it's something we don't offer support for, I'll have to defer to the community for additional assistance. I have seen some threads where the Javascript was used to open the web object and you may want to investigate this thread and this one, perhaps even reaching out to those users to see if they're able to assist you further. 

Will Findlay

Here is some code you can use to do this. Insert this into your storyline file as a webobject... For some reason using a boolean variable doesn't work well in Storyline, so I just use a Text variable. Here is example: https://360.articulate.com/review/content/c0db799e-4921-4dbc-8fa4-00c38edbb76b/review


html, body {
margin: 0 0 0 0;
<div id="player"></div>

<script src="https://www.youtube.com/player_api"></script>


// create youtube player
var isComplete = false;
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '100%',
width: '100%',
playerVars: {rel:0},
videoId: '_kwZ-xeOj8Y',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange

//autoplay video
function onPlayerReady(event) {

// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
var isComplete = true;
var player = parent.GetPlayer();