【发布时间】:2016-05-11 03:43:56
【问题描述】:
您好,我有一个应用程序,它有一个网格和一个 js 视频播放器。 目前我正在使用来自 SQL 数据库的数据填充网格,当单击一行时,我有一个函数调用,它调用存储过程并返回一个 url,然后使用该 url 更改源更改源。有趣的是,使用基本的 html 5 视频播放器,我的代码可以正常工作,但不适用于 Video JS
我的代码 -
function changesource(url) {
var video = $("#vid1");
video.src = url;
document.getElementById('vid1').src = url;
}
// calls the function for browse
function getBrowseData() {
$.ajax({
type: "post",
data: JSON.stringify({
archive_header_Key: testdata,
}),
url: "/Search.aspx/GetBrowseData",
dataType: "json",
contentType: "application/json",
success: function (object) {
response(object);
},
complete: function (object) {
},
error: function (object) {
}
});
function response(object) {
var obj = (object.d[0]["browse_file"]);
var slashReplace = obj.replace(/\\/g, "/");
var slashFinal = slashReplace.substring(10);
var browsevalue = GetValue("BrowseServer");
var slashfinal = "http://" + browsevalue + ":5060" + slashFinal;
Location = slashfinal;
$('#p1').text(slashfinal);
changesource(slashfinal);
}
}
var Video = ("<video id='vid1' class='video-js vjs-default-skin' controls preload='none' width='640' height='264' data-setup='{}'><source src=" + Location + " type='video/mp4'/></video> <script>var options = { hidden: false }, mplayer = videojs('vid1'); mplayer.rangeslider(options); mplayer.showSlider();</script>");
任何帮助将不胜感激
【问题讨论】:
标签: javascript html html5-video video.js