#1724·xgplayer

西瓜播放器内部在触发 ready 时,为什么不使用微任务来触发,反而使用 setTimeout 0 呢

Author: tianjucunCreated Mar 11, 2025Updated Jun 8, 2026
Labelsenhancementfeature proposal

您使用的西瓜播放器版本是多少? What version of xgplayer are you using? v3 和 v2

您使用的操作系统和浏览器分别是? What OS and browser are you using?

如何复现问题? How to reproduce the problem?

ready 触发后才会展示播放按钮,如果ready事件触发比较慢,按钮也会展示慢

您期望的播放器正常行为是? What did you expect to happen?

是否可以使用微任务来触发 ready 事件呢

比如:Promise.resolve.then(() => { player.emit('ready') })

实际播放器的表现是? What actually happened?

可填写您所在的公司和相关产品业务,方便我们提供更好的技术支持 You can write your company and product which uses xgplayer, for helping us provide better technical support.