Browse Source

js improve

master
filesite 4 months ago
parent
commit
cd6a0f52e2
  1. 11
      www/js/beauty.js

11
www/js/beauty.js

@ -229,7 +229,6 @@ if ($('#pr-player').length > 0 && typeof(videojs) != 'undefined') { @@ -229,7 +229,6 @@ if ($('#pr-player').length > 0 && typeof(videojs) != 'undefined') {
var videoItem = noSnapVideos.pop();
mc_video_id = videoItem.id;
console.log(mc_video_id, videoItem.url);
try {
myPlayer.src(videoItem.url);
myPlayer.play();
@ -254,18 +253,20 @@ if ($('#pr-player').length > 0 && typeof(videojs) != 'undefined') { @@ -254,18 +253,20 @@ if ($('#pr-player').length > 0 && typeof(videojs) != 'undefined') {
ctx.drawImage( video, 0, 0, canvas.width, canvas.height );
var snapshotImg = canvas.toDataURL('image/jpeg');
var duration = myPlayer.duration();
//更新视频封面图和视频时长
if (duration && snapshotImg) {
$('#poster_'+mc_video_id).attr('src', snapshotImg);
$('#poster_'+mc_video_id).parent('a').find('.duration').text(formatDuration(myPlayer.duration()));
$('#poster_'+mc_video_id).parent('a').find('.duration').text(formatDuration(duration));
}
saveVideoMeta(mc_video_id, {
duration: myPlayer.duration(),
duration: duration,
snapshot: snapshotImg
});
mc_video_id = null;
mc_video_id = ''; //reset
tryToGetVideoSnapshot(); //go next
}
});

Loading…
Cancel
Save