|
|
@ -304,15 +304,20 @@ $('.video-poster').each(function(index, el) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//保存视频数据
|
|
|
|
//保存视频数据
|
|
|
|
var saveVideoMeta = function(videoId, metaData) { |
|
|
|
var saveVideoMeta = function(videoId, metaData, manual) { |
|
|
|
|
|
|
|
var params = { |
|
|
|
|
|
|
|
id: videoId, |
|
|
|
|
|
|
|
meta: metaData |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (typeof(manual) != 'undefined' && manual) { |
|
|
|
|
|
|
|
params.manual = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/site/savevideometa', |
|
|
|
url: '/site/savevideometa', |
|
|
|
method: 'POST', |
|
|
|
method: 'POST', |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
data: { |
|
|
|
data: params |
|
|
|
id: videoId, |
|
|
|
|
|
|
|
meta: metaData |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).done(function(data) { |
|
|
|
}).done(function(data) { |
|
|
|
if (data.code != 1) { |
|
|
|
if (data.code != 1) { |
|
|
|
console.warn('视频数据保存失败', data.msg); |
|
|
|
console.warn('视频数据保存失败', data.msg); |
|
|
@ -331,7 +336,7 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
preload: 'auto' |
|
|
|
preload: 'auto' |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
var takeScreenshot = function() { |
|
|
|
var takeScreenshot = function(manual) { |
|
|
|
//myPlayer.pause();
|
|
|
|
//myPlayer.pause();
|
|
|
|
|
|
|
|
|
|
|
|
var height = myPlayer.videoHeight(), width = myPlayer.videoWidth(), |
|
|
|
var height = myPlayer.videoHeight(), width = myPlayer.videoWidth(), |
|
|
@ -351,7 +356,7 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
saveVideoMeta($('video.vjs-tech').attr('data-id'), { |
|
|
|
saveVideoMeta($('video.vjs-tech').attr('data-id'), { |
|
|
|
duration: duration, |
|
|
|
duration: duration, |
|
|
|
snapshot: snapshotImg |
|
|
|
snapshot: snapshotImg |
|
|
|
}); |
|
|
|
}, manual); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//myPlayer.play();
|
|
|
|
//myPlayer.play();
|
|
|
@ -371,7 +376,15 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { |
|
|
|
setTimeout(takeScreenshot, screenshot_start); |
|
|
|
setTimeout(takeScreenshot, screenshot_start); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('.btn-snapshot').click(function() { |
|
|
|
$('.btn-snapshot').click(function(e) { |
|
|
|
takeScreenshot(); |
|
|
|
var clickedBtn = $(e.target); |
|
|
|
|
|
|
|
clickedBtn.prop('disabled', true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var manual = 1; |
|
|
|
|
|
|
|
takeScreenshot(manual); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
|
|
|
|
|
clickedBtn.prop('disabled', false); |
|
|
|
|
|
|
|
}, 3000); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |