//Play video on Website
vyoutyube = youtube_parser(VidUrl)
vyoutyube = "http://www.youtube.com/embed/" + vyoutyube;
if (vyoutyube != "") {
var updPostedVideodiv = document.createElement("div");
updPostedVideodiv.className = "update-body-upload-video";
updleftbg.appendChild(updPostedVideodiv);
var updVideoplay = document.createElement("iframe");
updVideoplay.setAttribute("src", vyoutyube);
updVideoplay.type = "application/x-shockwave-flash";
updVideoplay.setAttribute("autostart", true);
updVideoplay.setAttribute("allowfullscreen", true);
updVideoplay.setAttribute("loop", false);
updPostedVideodiv.appendChild(updVideoplay);
var videoDesc = document.getElementById('txtVidDesc').value;
var updVideoDesc = document.createElement("div");
updVideoDesc.className = "update-body-vide-Desc";
updVideoDesc.innerHTML = videoDesc;
updleftbg.appendChild(updVideoDesc);
}
function youtube_parser(url) {
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(regExp);
if (match && match[7].length == 11) {
return match[7];
} else {
alert("Youtube Url is incorrect");
}
}
No comments:
Post a Comment