简体   繁体   English

hls.js-如何订阅任何事件

[英]hls.js - how to subscribe to any event

First time I play a playlist, I keep getting bufferStalledError . 第一次播放播放列表时,我会不断收到bufferStalledError

I can detect this error, however, if I resolve this error then a jump or skip in the video play back occurs and it stops occurring. 我可以检测到此错误,但是,如果我解决了该错误, 则会在视频播放中发生跳跃或跳过 ,并且它停止发生。

However, if i ignore it then it will play without a noticable interruption and the video keeps playing . 但是,如果我忽略它,它将在没有明显中断的情况下播放并且视频将继续播放 But this error will continue to be raised but without any noticable issues. 但是此错误将继续出现,但不会出现任何明显的问题。

However, at times, the same error will result in an overflow and hls.js won't be able to recover automatically, and no further errors are reported after such a failure than the last bufferStalled error . 但是,有时,相同的错误将导致溢出,并且hls.js将无法自动恢复,并且在发生此类故障后没有报告比上一个bufferStalled error更多的错误

I have to restart the video through destroy and attach again resuming the play functionality hls.js is unable to do automatically or through recoverMediaErrors() . 我必须通过销毁并重新附加视频来重新启动视频,以恢复播放功能hls.js无法自动执行或通过recoveryMediaErrors()完成

The only problem is that I am unable to subscribe to an event that says that the video is playing, or stuck. 唯一的问题是,我无法订阅表明视频正在播放或卡住的事件。 After a bufferStalledMediaError hls.js will recover it automatically without a glitch, but sometimes it fails to do so. 在bufferStalledMediaError之后,hls.js会自动恢复它,而不会出现故障,但是有时它无法恢复。 In both cases no more errors are reported . 在这两种情况下,都不会报告更多错误

But is there maybe another event reported that says it is playing that is not an error report? 但是,是否可能有另一个事件报告说正在播放而不是错误报告?

Is there an hls.on(Hls.Events.ALL, ... ) event ? 是否有hls.on(Hls.Events.ALL,...)事件?

What about setting up a TimeLineController ? 设置一个TimeLineController怎么样? It's not documented. 没有记录。

Reference: https://github.com/dailymotion/hls.js/blob/master/API.md 参考: https : //github.com/dailymotion/hls.js/blob/master/API.md

I don't think there is a built in way to listen to all events, but you could always just subscribe to every event: 我认为没有内置的方法可以监听所有事件,但是您始终可以订阅每个事件:

Object.keys(Hls.Events).forEach(function (e) {
    _hlsInstance.on(Hls.Events[e], console.info.bind(console));
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM