-
Notifications
You must be signed in to change notification settings - Fork 19
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
Exposing hls.js events #6
Comments
The internal hls.js library is exposed as Default internal CC plugin source code is here. Hls playback plugin is using "legacy" hls.js events like |
If the internal hls.js library is exposed as a static property through var myHls = new Clappr.HLS.HLSJS({
renderTextTracksNatively: false,
});
myHls.on(Clappr.HLS.HLSJS.Events.CUES_PARSED, (cues) => {
console.log("a"); // never called
});
myHls.attachMedia(player.core.el); Why would the |
I think it is more complex, because the hls instance is internally created in the hls-playback plugin at play time. (and destroyed on stop, except if vod pause) |
A simple hack, for exemple, could be to extends But the proper way, should be to add support of new hlsjs tracks api/events to hlsjs playback plugin. |
I will use the hack for now. Concerning the proper way, how about something along this idea (I haven't tested the code) in the configurations playback: {
hlsjsConfig: {
on: {
[HLSJS.Events.MEDIA_ATTACHED]: () => { console.log("works") }
},
once: {
[HLSJS.Events.MEDIA_ATTACHED]: () => { console.log("works") }
}
}
} in the // bind hlsjsConfig event handlers using the hls "on" method
for (const [event, handler] of Object.entries(assign({}, this.playback.hlsjsConfig.on))) {
this._hls.on(event, handler)
}
// bind hlsjsConfig event handlers using the hls "once" method
for (const [event, handler] of Object.entries(assign({}, this.playback.hlsjsConfig.once))) {
this._hls.once(event, handler)
} |
Adding a feature to bind custom events on hls instance in the hls playback plugin is an interresting idea. Thought i would add a new playback plugin option to do this, because i think (not verified) the |
Hi guys! I thought the idea was very good and that's why I opened a PR implementing a way to be able to have custom listeners for Take a look: #16 |
Hi,
I would like to create a custom closed caption rendering plugin which works with hls streams. To do so, hls.js offers a property called renderTextTracksNatively which disables native rendering of captions. It also exposes two new events, one of which is called Hls.Events.CUES_PARSED. This event will fire when new captions or subtitle cues are parsed.
Is there a way to expose hls.js event handlers from hlsjs-playback in a similar fashion to how clappr exposes events?
The text was updated successfully, but these errors were encountered: