Plyr: Captions with Shaka Player

Created on 5 Jan 2018  路  5Comments  路  Source: sampotts/plyr

using shaka player I couldn't add a track to player nor manually neither programmatically.

Manually

placing <track src="src" kind="subtitles" > inside <video>

Programatically

using shaka player addTextTrack(uri, language, kind, mime, opt_codecopt, opt_labelopt) method

In both ways, the vtt file is fetched from the server but it doesn't show anything. using first method cause a cc icon appear next to the volume control but it doesn't do anything.

Help Wanted Improvement Streaming

Most helpful comment

I managed this issue by overriding textDisplayFactory of shaka-player:

shakaPlayer.configure({
   textDisplayFactory: () => {
      return {
         setTextVisibility: () => {},
         isTextVisible: () => true,
         destroy: () => { }
      }
   }
 });

All 5 comments

You can use HTML5 <track> elements if you have subtitles in the WebVTT format. If this isn't the case you may want to handle the conversion server side.

Shaka doesn't quite play by the standard rules, so you we can't handle it like the other libraries. See #994

I managed this issue by overriding textDisplayFactory of shaka-player:

shakaPlayer.configure({
   textDisplayFactory: () => {
      return {
         setTextVisibility: () => {},
         isTextVisible: () => true,
         destroy: () => { }
      }
   }
 });

Thanks for the update!

I'm not sure what that does though? Does it make Shaka Player use multiple tracks (one per language) like the other libraries (see #994). I'm guessing not?

according to google/shaka-player#1443 I Implement a custom text displayer for shaka which does nothing and let plyr handle displaying captions.

Thanks! I'll leave this open until there's a full example of how to use Plyr with Shaka Player and captions, or if I write one myself. I prefer not to have to dig into the Shaka Player api again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nam-co picture nam-co  路  4Comments

TheZoker picture TheZoker  路  4Comments

jwjcmw picture jwjcmw  路  4Comments

Lycanthrope picture Lycanthrope  路  4Comments

frumbert picture frumbert  路  3Comments