I want to make an ajax call, and then display an html 5 video.
The following code doesn't work.
$.ajax({
type: "POST",
url: "Videos.aspx/GetBlocs",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("#videoPlayer").html(
'<video id="Video1" src="" class="video-js vjs-default-skin" ' +
' controls preload="auto" width="640" height="360" ' +
' data-setup=\'{ "techOrder": ["youtube"], "src": "http://www.youtube.com/watch?v=xjS6SftYQaQ" }\'>' +
'</video>'
);
}
});
As you can see, I dont even use the ajax call back value for now.
However, if the video is displayed BEFORE the ajax call, it works.
$("#videoPlayer").html(
'<video id="Video1" src="" class="video-js vjs-default-skin" ' +
' controls preload="auto" width="640" height="360" ' +
' data-setup=\'{ "techOrder": ["youtube"], "src": "http://www.youtube.com/watch?v=xjS6SftYQaQ" }\'>' +
'</video>'
);
$.ajax({
type: "POST",
url: "Videos.aspx/GetBlocs",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
.....
}
});
Edit: I am also using video-js and youtube video-js plugins.