Forum Discussion
Not a JavaSrcipt Expert / Can someone point me in the right direction
I would like to control a youtube video in storyline - load, play, pause, etc. (Instead of using the Youtube commands)
I've seen some scripting around this, but nothing appears to work. I think I am doing something fundamentally wrong.
Does anyone have a .story example I could start with?
Do you have to setup variables in storyline?
Any guidance would be appreicated.
Thanks
Tony
- SteveGannonCommunity Member
This article should get you started, Tony:
https://www.rabbitoreg.com/2016/01/09/full-control-over-youtube-video-in-storyline/
It's a bit involved but well-written and clear.
- TonyVincigue847Community Member
Thanks Steve. I did see this and embedded it in my storyline, but it does not work for me.
I've placed the code into my storyline file with a trigger on a button. I've clicked on the button to execute the javascript, but nothing appears.
I think I am doing something fundamentally wrong. Like to I need to setup variables, etc.
Do you know of a storyline file with this already included so that I can copy/modify the scripting?
Thanks
Tony
- SteveGannonCommunity Member
He provides a link to the source file near the bottom of the article. The key to getting this to work is that long JavaScript needs to go into a separate file (just put it in a text file and rename the extension with .html). You need to put that file HTML file on a web server and have the web object in Storyline point to that URL. It won't work from your local drive.
- TonyVincigue847Community Member
Steve
Thanks for your help. I was able to download the file, create the placeholder.html file and load it onto a webserver. I also modified the user.js file as recommended.
I ran it successfully with the included youtube video, and was able to also switch it out withe another video. All good.
The only problem now is the play, pause buttons don't work. I can play the video with the YouTube play button, but not with the buttons in the storyline file.
Any suggestions to get it working?
I appreciate your guidance.
Tony
- SteveGannonCommunity Member
A few questions to help troubleshoot this, Tony:
Were you able to get the play/pause buttons to work with the original video in the sample?
Is there something unique about the video you're trying to control (e.g., is it private, does it have ads associated with it, etc.)?
If you're published file is on your local machine, have you tried placing it on a web server (preferably in the same location as the placeholder.html file)? I do not recommend testing this from Articulate Review because it doesn't always work well with custom things like this.