Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用xgplayer-hls插件播放直播流,默认设置不自动播放,retry成功请求数据后视频会自动播放 #1657

Open
lffrom0303 opened this issue Nov 21, 2024 · 0 comments

Comments

@lffrom0303
Copy link

lffrom0303 commented Nov 21, 2024

您使用的西瓜播放器版本是多少? What version of xgplayer are you using?
"xgplayer": "^3.0.20",
"xgplayer-hls": "^3.0.20"

您使用的操作系统和浏览器分别是? What OS and browser are you using?
macos
Google Chrome 版本 131.0.6778.85(正式版本) (arm64)

如何复现问题? How to reproduce the problem?
this.player = new Player({
id: this.videoInfo.id,
url,
autoplay: false,
autoplayMuted: true,
plugins: isNotSupported ? [HlsPlugin] : [],
isLive: true,
hls: {
targetLatency: 1, // 直播目标延迟,默认 10 秒
maxLatency: 1, // 直播允许的最大延迟,默认 20 秒
disconnectTime: 0, // 直播断流时间,默认 0 秒,(独立使用时等于 maxLatency) retryCount: 3, // 重试 3 次,默认值
retryDelay: 0, // 每次重试间隔 1 秒,默认值
loadTimeout: 10000, // 请求超时时间为 10 秒,默认值
preloadTime: 1, // 默认值
fetchOptions: {
// 该参数会透传给 fetch,默认值为 undefined
mode: "cors",
},
},
height: "100%",
width: "100%",
});

默认进来 查看后台会一直请求直播流 当加载失败后,会显示错误信息

您期望的播放器正常行为是? What did you expect to happen?
我想在视频加载错误后直接让视频重新加载,加载成功后暂停,而不是重新请求成功就直接播放,点击播放按键后,加载失败重新请求成功才可以自动播放。
this.player.on(Events.ERROR, (error) => {
console.log("加载错误", error);
this.player && this.player.retry();
});

实际播放器的表现是? What actually happened?
当retry加载成功后,视频会自动播放,此时我并没有点击播放按键

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

@lffrom0303 lffrom0303 changed the title 使用xgplayer-hls插件播放直播流,默认设置不自动播放,还是会请求直播流 使用xgplayer-hls插件播放直播流,默认设置不自动播放,retry成功请求数据后视频会自动播放 Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant