Update 2: If I am understanding things correctly, this probably occurs becuase the JFE engine does not create a new header from page to page of the survey. If anyone knows how to work around this, I would be very grateful for your input.
Update: I created a new study from scratch and incorporated @sonyper's code. It worked fine. I then swapped my link in and it all ran fine (and I discovered that your code included the enablejsap=1 option in the iframe which was probably one issue). However, when I added a screen to preceed the video, the code no longer worked. So I guess I have a new question to explore. Just wanted to say thanks for your help (and if you know how to get around this new issue, by all means let me know as I will be grateful).
So....Your survey works for me (the two alerts pop up immediately and it doesn't advance after second video though). However, when I copy and paste your header code into the header for my study, it doesn't work (and the player ID name in the iFrame is the same, so it's not that). I also tried just using your iframe code (including the video-everythign copy and pasted) and it also doesn't work within my study. It is perhaps worth saying that when I copy your code directly into my study, I also don't get the pop-up alerts so it seems like for some reason the script in the header is being ignored in my current study...but works in the copy of the study I uploaded to my account (so not an account issue). I'm stumped. Any ideas?
Thanks @sonyper - I will check this out right away!
Hi there, I was wondering if you would mind answering a question, as I am struggling with onYouTubeIframeAPIReady() also, but it seems like you have already solved the issue I am having. I simply want my survey to advance immediately after one video. I copied your scripts with minor changes (the ID I assigned the iframe, the videos themselves) [thanks for posting your code!]. Unfortunately, my survey does not advance and I cannot figure out why. :( Here is the iframe code that contains the video (with initial "<" removed): iframe id="video1" allowfullscreen="false" frameborder="0" height="480" width="640" src="https://www.youtube.com/embed/hX-mnTqfx7o?autoplay=0&rel=0&controls=0&showinfo=0&disablekb=1&fs=0&modestbranding=1"></iframe> Here is the code I put in script tags inside my header: var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentN
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.