Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Issues building a custom text track renderer #242

Open
ghost opened this issue Oct 30, 2018 · 3 comments
Open

Issues building a custom text track renderer #242

ghost opened this issue Oct 30, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 30, 2018

Hello,

Thanks for the great project. My team is currently using HasPlayer to provide an MSE-based smooth streaming solution on Edge and IE and it's working great.

However, we're currently integrating a custom closed-captions rendering layer for text tracks delivered via a smoothstreaming manifest. This work can be thought of as three separate parts:

  1. Reading the available tracks from a manifest.
  2. Selecting/unselecting an available track.
  3. Hooking into cuechange events from the selected track once active in order to update our UI.

So far, we have successfully completed steps 1 and 2, using a combinations of the following HasPlayer APIs:

  • MediaPlayer.prototype.enableSubtitles() to enable the parsing of text tracks
  • MediaPlayer.prototype.getTracks() to read the available tracks
  • MediaPlayer.prototype.selectTrack() to select the desired track

Once a track has been selected, I can see that a text track appears in the textTracks array of the HTML video element on which HasPlayer is mounted, and a list of cues is also available.

Unfortunately, the activeCues array is never updated, and no cuechange events are emitted from the track. I see that you have proprietary cueEnter and cueExit events triggered directly from the MediaPlayer instance, but these do not seem to emit either.

Am I doing something wrong or misunderstanding the API?

I've been unable to find any general documentation or example closed captions integrations to reference.

Thanks in advance!

@nicosang
Copy link
Contributor

Hi @patrickkunkadazn ,

first of all, thanks to your congratulations about hasplayer.js! ;-)
It's quite difficult to answer your question....It could be a timestamp issue : have you take a look at those values in the cues?
if start value is never reached, it could explain why cues are never activated...

Nico

@ghost
Copy link
Author

ghost commented Oct 30, 2018

Hi Nico. Thanks for the quick response.

I decided to test with an openly available DASH test stream with captions and came across the same issue:

https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-en.ism/.mpd

HasPlayer correctly picks up the "english" captions track, and allows me to select it, but no cue events are triggered.

Interestingly, when testing with Shaka player, we are able to hook into the cuechange events for the same manifest.

@nicosang
Copy link
Contributor

I've just tested your dash sample stream in the Dash-IF sample page. If you add the line to main.js webApp :
player.addEventListener("cueEnter", onCueEnter.bind(this)); ... function onCueEnter(e) { console.log('cueEnter:: ' + e.data.text); }
I can see subtitles and the onCueEnter event is correctly triggered.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant