修复视频播放数量不更新的问题

This commit is contained in:
LL
2025-11-18 15:19:06 +08:00
parent 558188765e
commit 2c9c06bf45

View File

@@ -188,6 +188,14 @@ document.addEventListener('DOMContentLoaded', () => {
// 播放结束自动下一条 // 播放结束自动下一条
player.addEventListener('ended', () => { next(); }); player.addEventListener('ended', () => { next(); });
let lastLoggedVideo = '';
player.addEventListener('play', () => {
const cur = player.currentSrc || player.src || '';
if (!cur || cur === lastLoggedVideo) return;
lastLoggedVideo = cur;
track({ event: 'video_play', page: location.pathname, url: cur, title: '' });
});
// 从后端接口获取视频列表 // 从后端接口获取视频列表
// 初始化:先拉取首条并填充缓存 // 初始化:先拉取首条并填充缓存
(async () => { (async () => {