From player.subtitles.list() I am getting all subtitles.But I want to add one more object for Off subtitle
Hi,
The player.subtitles.list()
method provides all available subtitles, and its status (enabled
property set to true
or false
). To implement an off
entry, you have to iterate through the list of subtitles and disable all enabled entries, similar to this code:
player.subtitles.list().filter(sub => sub.enabled).forEach(enabledSub => player.subtitles.disable(enabledSub.id))
Thank you,
I will check the same.
One more thing I am getting subtitle list with other videos but for live videos I am unable get.
subtitle.list() is empty
Can you please help me on the same also.
It should work all the same for live streams as well, as long as supported subtitle formats are linked in the manifest.
If that’s the case, it could be that you are querying the API too early, e.g. when the manifest loading wasn’t finished yet. I’d recommend waiting for the load
Promise to resolve or for the SourceLoaded event to be fired.