diff --git a/www/js/beauty.js b/www/js/beauty.js index e523b16..4d0a511 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -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') { ctx.drawImage( video, 0, 0, canvas.width, canvas.height ); var snapshotImg = canvas.toDataURL('image/jpeg'); + var duration = myPlayer.duration(); //更新视频封面图和视频时长 - $('#poster_'+mc_video_id).attr('src', snapshotImg); - $('#poster_'+mc_video_id).parent('a').find('.duration').text(formatDuration(myPlayer.duration())); + if (duration && snapshotImg) { + $('#poster_'+mc_video_id).attr('src', snapshotImg); + $('#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 } });