video url based on variable
May 9, 2016 12:00 AM
Hi,
I try to find the easiest way to play a video which url is depending on the value of a variable. The object is to show personalised video's.
What I have at the moment is an external HTML object, type 'Header Scripting', with contents:
function playVideo(url) {
var vid = document.createElement('video');
vid.id = "myVideo";
vid.autoplay = true;
vid.style.cssText = 'position:absolute;top:300px;left:300px;width:200px;height:200px';
var pd = document.getElementById('pageDIV');
pd.appendChild(vid);
var srcMp4 = document.createElement("source");
srcMp4.type = "video/mp4";
srcMp4.src = url;
vid.appendChild(srcMp4);
}
Discussion (3)
I edited out the question :D
Anybody knows a more elegant solution?
Depends on what you want as a "more elegant" solution. What doesn't it do for you now? What would you like it to do beyond what it does now?
Hi,
I was hoping for a solution 'inside' Lectora, using the video object of Lectora and somehow getting it to play the url in the variable :)
Discussions have been disabled for this post