Browse Source

js improve

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

13
www/js/beauty.js

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

Loading…
Cancel
Save