From 65b91916f1ddf20ea6ad082ddb368744e34957c5 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 16 Jul 2024 08:54:29 +0800 Subject: [PATCH] auto show video snapshot --- www/js/beauty.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/www/js/beauty.js b/www/js/beauty.js index 1358b81..e523b16 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -254,16 +254,23 @@ if ($('#pr-player').length > 0 && typeof(videojs) != 'undefined') { ctx.drawImage( video, 0, 0, canvas.width, canvas.height ); var snapshotImg = canvas.toDataURL('image/jpeg'); + + //更新视频封面图和视频时长 + $('#poster_'+mc_video_id).attr('src', snapshotImg); + $('#poster_'+mc_video_id).parent('a').find('.duration').text(formatDuration(myPlayer.duration())); + saveVideoMeta(mc_video_id, { duration: myPlayer.duration(), snapshot: snapshotImg }); + mc_video_id = null; + tryToGetVideoSnapshot(); //go next } }); - setInterval(tryToGetVideoSnapshot, 1000); + setInterval(tryToGetVideoSnapshot, 500); } //视频列表封面图加载