I am trying to write an extension for Netflix to show 2 subtitles. I know there are already extensions for that but I just want to try this out.
I just want to understand how this could be done. I want to use the original subtitles Netflix provides. When you pick one and the subtitle element which has the class player-timed-text-container
changes automatically. How can I in parallel get player-timed-text-container
for the other type of subtitle.
After a bit research I found (in this question), that we can get the player as
const videoPlayer = netflix
.appContext
.state
.playerApp
.getAPI()
.videoPlayer
// Getting player id
const playerSessionId = videoPlayer
.getAllPlayerSessionIds()[0]
const player = videoPlayer
.getVideoPlayerBySessionId(playerSessionId)
The player has thankfuly getTextTrackList
to get the subtitles and also a set function which I have not figured out yet what the correct signature is.
My curiosity is mostly about the way to follow to do this. I am very weak on Javascript but if I can understand the idea, I think I can implement it. I investigated https://github.com/dannvix/NflxMultiSubs. I belive that it somehow fetches the appropriate subtitle for each second in parallel and prints it. I would be happy if someone has an idea about how to do this or if this is the way to go, and elaborate it a bit more if that is. Thank you very much.