video url based on variable

barman Community Member Posts: 4

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'); = "myVideo";
vid.autoplay = true; = 'position:absolute;top:300px;left:300px;width:200px;height:200px';
var pd = document.getElementById('pageDIV');
var srcMp4 = document.createElement("source");
srcMp4.type = "video/mp4";
srcMp4.src = url;


  • barman
    barman Community Member Posts: 4
    I edited out the question :D
    Anybody knows a more elegant solution?
  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    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?
  • barman
    barman Community Member Posts: 4

    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 :)