|
|
@ -546,6 +546,7 @@ var saveVideoMeta = function(videoId, metaData, manual) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//视频播放器
|
|
|
|
//视频播放器
|
|
|
|
|
|
|
|
var moreVideos = [], _noMoreVideos = false; |
|
|
|
if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
var myPlayer = videojs('my-player', { |
|
|
|
var myPlayer = videojs('my-player', { |
|
|
|
controls: true, |
|
|
|
controls: true, |
|
|
@ -590,6 +591,7 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
setTimeout(takeScreenshot, screenshot_start); |
|
|
|
setTimeout(takeScreenshot, screenshot_start); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成封面图
|
|
|
|
$('.btn-snapshot').click(function(e) { |
|
|
|
$('.btn-snapshot').click(function(e) { |
|
|
|
var clickedBtn = $(e.target); |
|
|
|
var clickedBtn = $(e.target); |
|
|
|
clickedBtn.prop('disabled', true); |
|
|
|
clickedBtn.prop('disabled', true); |
|
|
@ -601,22 +603,6 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
clickedBtn.prop('disabled', false); |
|
|
|
clickedBtn.prop('disabled', false); |
|
|
|
}, 3000); |
|
|
|
}, 3000); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加载更多视频
|
|
|
|
|
|
|
|
if ($('.othervideos').length > 0) { |
|
|
|
|
|
|
|
var videoId = $('.othervideos').attr('data-id'), |
|
|
|
|
|
|
|
cateId = $('.othervideos').attr('data-pid'), |
|
|
|
|
|
|
|
cacheId = $('.othervideos').attr('data-cid'), |
|
|
|
|
|
|
|
currentPage = $('.othervideos').attr('data-page'); |
|
|
|
|
|
|
|
var api = '/list/', |
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
id: cateId, |
|
|
|
|
|
|
|
cid: cacheId, |
|
|
|
|
|
|
|
show: 'video', |
|
|
|
|
|
|
|
dataType: 'video', |
|
|
|
|
|
|
|
page: currentPage |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getVideoUrl = function(videoId, videoPath) { |
|
|
|
var getVideoUrl = function(videoId, videoPath) { |
|
|
|
var url = new URL(location.href); |
|
|
|
var url = new URL(location.href); |
|
|
@ -651,14 +637,29 @@ if ($('.othervideos').length > 0) { |
|
|
|
return html; |
|
|
|
return html; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加载更多视频
|
|
|
|
|
|
|
|
var currentPage = $('.othervideos').attr('data-page'); |
|
|
|
|
|
|
|
var getOtherVideos = function(currentPage) { |
|
|
|
|
|
|
|
if (_noMoreVideos) {return false;} |
|
|
|
|
|
|
|
var videoId = $('.othervideos').attr('data-id'), |
|
|
|
|
|
|
|
cateId = $('.othervideos').attr('data-pid'), |
|
|
|
|
|
|
|
cacheId = $('.othervideos').attr('data-cid'); |
|
|
|
|
|
|
|
var api = '/list/', |
|
|
|
|
|
|
|
params = { |
|
|
|
|
|
|
|
id: cateId, |
|
|
|
|
|
|
|
cid: cacheId, |
|
|
|
|
|
|
|
show: 'video', |
|
|
|
|
|
|
|
dataType: 'video', |
|
|
|
|
|
|
|
page: currentPage |
|
|
|
|
|
|
|
}; |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: api, |
|
|
|
url: api, |
|
|
|
method: 'GET', |
|
|
|
method: 'GET', |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
data: params |
|
|
|
data: params |
|
|
|
}).done(function(data) { |
|
|
|
}).done(function(data) { |
|
|
|
//console.log('more videos', data);
|
|
|
|
|
|
|
|
if (typeof(data.videos) != 'undefined' && data.videos.length > 0) { |
|
|
|
if (typeof(data.videos) != 'undefined' && data.videos.length > 0) { |
|
|
|
|
|
|
|
moreVideos = data.videos; |
|
|
|
$('.othervideos').html(renderVideos(videoId, data.videos)); |
|
|
|
$('.othervideos').html(renderVideos(videoId, data.videos)); |
|
|
|
setTimeout(function() { |
|
|
|
setTimeout(function() { |
|
|
|
$('.othervideos .video-poster').each(function(index, el) { |
|
|
|
$('.othervideos .video-poster').each(function(index, el) { |
|
|
@ -668,12 +669,56 @@ if ($('.othervideos').length > 0) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, 50); |
|
|
|
}, 50); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
//_noMoreData = true;
|
|
|
|
_noMoreVideos = true; |
|
|
|
console.warn('获取更多视频数据出错啦', data.msg); |
|
|
|
console.warn('获取更多视频数据出错啦', data.msg); |
|
|
|
} |
|
|
|
} |
|
|
|
}).fail(function(jqXHR, textStatus, errorThrown) { |
|
|
|
}).fail(function(jqXHR, textStatus, errorThrown) { |
|
|
|
console.error('获取更多视频数据失败,错误信息:' + errorThrown); |
|
|
|
console.error('获取更多视频数据失败,错误信息:' + errorThrown); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getOtherVideos(currentPage); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//自动播放
|
|
|
|
|
|
|
|
myPlayer.on('ended', function() { |
|
|
|
|
|
|
|
var cachedAutoPlayStatus = Cookies.get('autoplay'); |
|
|
|
|
|
|
|
if (cachedAutoPlayStatus == 'off') {return false;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (moreVideos && moreVideos.length > 0) { |
|
|
|
|
|
|
|
var nextVideo = moreVideos.shift(); |
|
|
|
|
|
|
|
myPlayer.src(nextVideo.path); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
currentPage = parseInt(currentPage) + 1; |
|
|
|
|
|
|
|
getOtherVideos(currentPage); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var switchAutoPlayBtns = function(status) { |
|
|
|
|
|
|
|
var cookieKey = 'autoplay'; |
|
|
|
|
|
|
|
if (status == 'on') { |
|
|
|
|
|
|
|
$('.autoplay_disabled').removeClass('btn-primary'); |
|
|
|
|
|
|
|
$('.autoplay_enabled').addClass('btn-primary'); |
|
|
|
|
|
|
|
Cookies.set(cookieKey, 'on', { expires: 7 }); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$('.autoplay_enabled').removeClass('btn-primary'); |
|
|
|
|
|
|
|
$('.autoplay_disabled').addClass('btn-primary'); |
|
|
|
|
|
|
|
Cookies.set(cookieKey, 'off', { expires: 7 }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#my-player').focus(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cachedAutoPlayStatus = Cookies.get('autoplay'); |
|
|
|
|
|
|
|
if (cachedAutoPlayStatus == 'off') { |
|
|
|
|
|
|
|
$('.autoplay_enabled').removeClass('btn-primary'); |
|
|
|
|
|
|
|
$('.autoplay_disabled').addClass('btn-primary'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.autoplay_disabled').click(function() { |
|
|
|
|
|
|
|
switchAutoPlayBtns('off'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$('.autoplay_enabled').click(function() { |
|
|
|
|
|
|
|
switchAutoPlayBtns('on'); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|