question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

External Subtitles don't get displayed

See original GitHub issue

Have you read the FAQ and checked for duplicate open issues?: Yes What version of Shaka Player are you using?: 2.4.4, 2.5.0-beta Can you reproduce the issue with our latest release version?: Yes Can you reproduce the issue with the latest code from master?: Have not tried Are you using the demo app or your own custom app?: Custom If custom app, can you reproduce the issue using our demo app?: Unsure how What browser and OS are you using?: Chrome 69.0.3497.100 Windows 10 What are the manifest and license server URIs?: Any What did you do? Added subtitle track via addTextTrack, but is not shown or selectable via the UI

    player.load(manifestUri).then(function() {
        player.addTextTrack('/darkroom_timer.vtt', 'eng', 'subtitle', 'text/vtt', '',  'English')
    }).catch(onError);

What did you expect to happen?

When hitting the CC button, to have the option of a ‘English’ subtitle. This works if adding it in the <track> section of the HTML manually.

What actually happened?

Hitting CC only showed the usual ‘Shaka Player TextTrack’ and selecting it did nothing.

shaka

** Additional **

I am very new to using this, so it is probably user error, but have tried for a few days to no avail. Any help would be appreciated!

WebVTT file

WEBVTT

00:01.000 --> 00:03.000
This is a custom darkroom timer

00:04.000 --> 00:07.000
Created with a raspberry pi

HTML File

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.5.0-beta/shaka-player.compiled.debug.js" type="application/javascript"></script>
</head>
<body>
<video id="video"
       width="640"
       controls autoplay>
    <!--<track label="English" kind="subtitles" srclang="eng" src="/darkroom_timer.vtt" type="text/vtt" >-->

</video>

<script>
  var manifestUri = '/output/stream.mpd';

  function initApp() {
    shaka.polyfill.installAll();
    if (shaka.Player.isBrowserSupported()) {
      initPlayer();
    } else {
      console.error('Browser not supported!');
    }
  }

  function initPlayer() {
    var video = document.getElementById('video');
    var player = new shaka.Player(video);
    player.configure({
          drm: {
            clearKeys: {
              '11111111111111111111111111111111': '11111111111111111111111111111111',
            }
          },
          preferredTextLanguage: 'eng',
          preferredAudioLanguage: 'eng',
          streaming: {
            bufferingGoal: 120
          }
        }
    );
    window.player = player;
    player.addEventListener('error', onErrorEvent);
    player.load(manifestUri).then(function() {
        player.addTextTrack('/darkroom_timer.vtt', 'eng', 'subtitle', 'text/vtt', '',  'English')
        console.log('The video has now been loaded!');
    }).catch(onError);
  }

  function onErrorEvent(event) {
    onError(event.detail);
  }

  function onError(error) {
    console.error('Error code', error.code, 'object', error);
  }

  document.addEventListener('DOMContentLoaded', initApp);

</script>
</body>
</html>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ismenacommented, Sep 26, 2018

FYI, we are currently working on a UI layer for the player, that will allow for text track selection from the UI, listing all the text tracks available.

1reaction
TheModMakercommented, Sep 26, 2018

The one native track represents what is currently streaming from Shaka Player. You can change what we stream using player.selectTextLanguage or player.selectTextTrack; you can query languages and tracks with player.getTextLanguages and player.getTextTracks respectively. By default we play the latest added, but you can change this later.

Also note that if you are using native controls, you may need to set the streaming.alwaysStreamText configuration to ensure we play it. We have no way of detecting when the text track is showing. By default we only download text streams when they are visible. So if you change the native track’s visibility without using the player (player.setTextTrackVisbility), then we won’t stream it. You can set to always stream text with player.configure('streaming.alwaysStreamText', true).

As for why we only have one native track, it is because we want to stream only what is being displayed. If we had multiple native tracks for different languages, we would have to download all of them since it would be hard (or impossible) to determine which is currently displayed and get events when it changes. So we reuse the same native track and handle buffering and changing languages internally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

External Subtitles don't get displayed · Issue #1596 - GitHub
Please note that although subtitles will be displayed when captions button is pressed, the native UI will still say "Shaka Embedded track".
Read more >
Media player does not display external subtitles
Hey guys, Running on Windows 8, the Windows Media Player(not the video app, that one sucks anyway) does not display any external subtitles....
Read more >
[Solved] Plex Subtitles Not Showing/Appearing Error - WinXDVD
Supposing your Plex subtitles come from the external source and don't show up in Plex, firstly check if it's named correctly and encoded...
Read more >
External subtitles not working even when selected in Nvidia ...
It has always worked, but it now only works (direct plays with ext subtitles) if I remux everything into the same MKV container....
Read more >
External Subtitles not displayed on the list of subtitles in my TV ...
So I've found the solution, I had to rename my external subtitles within the tv show folder/movie folder EXACTLY what the Show/Movie is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found