Youtube, iframes, variables
July 2, 2016 12:00 AM
Hello - maybe someone can help.
I would like to play this URL (and others like it) inside a title: https://www.youtube.com/v/nwUmz3KfEfk?start=17.3&end=18.5 -- note the timing information.
If I use the YT obect, it does not respect the timing.
I can create an HTML extension and embed an iframe in it. That works fine BUT
I actually want to be able to control the YT URL undefinediframe src="http://www.w3schools.com"undefined
I want to be able to replace http://www.w3schools.com with the contents of a variable which will be created by the title/lesson.
How can I do that? I have tried to look for examples in google of how to do this in javascript but I am obviously missing something as I have not been able to make any of them work (yet).
Any thoughts?
Many thanks
Andrew
undefined
Discussion (4)
Maybe I missed something, but changing the src of an iframe with javascript isn't difficult:
document.getElementById(undefined
Mind that you have to use the variable within a Lectora action on the page, otherwise it won't exist.
Tim
The best way would (probably) be to use the way Youtube recommends to embed their videos. Then you can control the player with the youtube iframe API. I've built a small example how to set up the player, select a video from a Lectora dropdown and set a start and an end time. Here's a sample by Sergey that can be combined:
http://community.trivantis.com/forums/topic/youtube-as-embed-object-need-a-done-playing-action-to-work/
Tim
Thank you Tim. No you're not missing anything except for the fact that I do not know JS well (or even like it to tell you the truth) and that I do not have at my fingertips the kind of information you just gave me (despite looking around on the net) - which was exactly what I needed.
Now... having said that. I am still in some bother about what I am trying to do which is:
to show the page, get the student to select the clip to watch (via a change in the variable) and then play it - a kind of Ajax process.
I guess I would need to somehow refresh the HTML extension (and only the HTML extension) so that it re-reads the Lectora variable and adjusts its contents - but how to do that???
I am sorry ... but I am struggling to find out what Lectora can do and what I need to do through other means.
Hope that makes sense.
Thanks again.
undefined
Discussions have been disabled for this post