video url based on variable

barman
barman Community Member Posts: 4
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);
}

Comments