shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.11k stars 1.33k forks source link

CEA 608 Captions #6941

Closed TetrisSQC closed 2 months ago

TetrisSQC commented 3 months ago

Have you read the Tutorials? yes

Have you read the FAQ and checked for duplicate open issues? yes

What version of Shaka Player are you using? 4.9.10

What browser and OS are you using? MacOS

Please ask your question

Hello, I would like to play subtitles with Shaka (CEA-608), but this does not seem to work. I just can't find my error, because the demo application at http://shaka-player-demo.appspot.com shows them. Please find attached my example implementation, maybe someone can kindly give me a hint what I have forgotten?

Regards, Christian

plyr.html.zip

avelad commented 3 months ago

The content you are using on your page does not have CEA-608 (https://storage.googleapis.com/shaka-demo-assets/angel-one/dash_chaining.mpd), which is why it does not show them.

TetrisSQC commented 3 months ago

Thanks, for your quick response I was not aware that this stream did not had any caption available. This one has, and works fine in the example player, but not on my one: https://mcdn.daserste.de/daserste/de/master.m3u8

Christian

avelad commented 3 months ago

Your stream shows a static screen (I think in German) and the subtitles are always empty. videoframe_7221 056

TetrisSQC commented 3 months ago

Yes, this particular channel is region blocked. I will try to find a non blocked stream besides this it does not work with every stream and I have no idea what is missing in the code.

avelad commented 3 months ago

I gave it another chance and in the Shaka Demo the subtitles are shown:

https://github.com/shaka-project/shaka-player/assets/8983024/8f6d718f-d816-45b5-96fb-d08f025b5737

avelad commented 3 months ago

I see that in your file you use plyr, in its documentation I have seen: https://github.com/sampotts/plyr?tab=readme-ov-file#captions

This is an interoperability problem between Shaka and this way of managing subtitles.

TetrisSQC commented 3 months ago

You are right it is most likely an issue with plyr, when I add this: } function updateSubtitles() { const tracks = player.getTextTracks();

        const subtitles = tracks.map(track => ({
            kind: 'captions',
            label: track.label,
            srclang: track.language,
            src: 'data:text/vtt;base64,',
        }));

        plyrPlayer.source = {
            ...plyrPlayer.source,
            tracks: subtitles,
        };
        const activeTrack = tracks.find(track => track.active);
        if (activeTrack) {
            plyrPlayer.currentTrack = subtitles.findIndex(sub => sub.srclang === activeTrack.language);
        }

    } and execute the function when loadeddata is triggered, I get the caption stream also listed, but this does not explain why there is always Shaka Player TextTrack which does nothing. 
shaka-bot commented 2 months ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.