Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chromecast add subtitle while playing video

I can show subtitle(webvtt) using android app using following code

MediaTrack subtitle = new MediaTrack.Builder(0, MediaTrack.TYPE_TEXT)
                            .setName("English")
                            .setSubtype(MediaTrack.SUBTYPE_SUBTITLES)
                            .setContentId(mediaObject.getSubtitleUrl())
                            .setLanguage(Locale.getDefault())
                            .build();

                    tracks.add(subtitle);

My problem is, this approach works when media is loaded initially to Chromecast, so if I want add subtitle later while media is playing I have to reload media again.

Is there work around this? As I have seen some apps doing the desired behavior.

like image 834
ingsaurabh Avatar asked Dec 19 '16 07:12

ingsaurabh


People also ask

How do I turn on subtitles while casting?

- While movie is playing, tap the three vertical dots at the top right corner. - Tap Add Subtitles. - Choose the appropriate subtitle (available only if the srt file resides in the same folder). - If you have multiple subtitle files (different languages), then they will also show in the list.

Why subtitles are not working while casting?

The subtitle file is empty or corrupted. You won't play the video file with subtitles correctly when casting VLC to Chromecast if the subtitle file is damaged or empty. You can download subtitles from online subtitle sites again. The subtitle's name is different from the video file name.

Can VLC cast to Chromecast with subtitles?

Yes - using the chrome browser to cast the desktop VLC works with subtitles!


1 Answers

You'd need to load your media with subtitles included from the beginning. You can have subtitles turned off and then allow user to select one and turn that on or off at run time but in order to have things working, subtitles need to be included at the load time of media.

like image 127
Ali Naddaf Avatar answered Oct 17 '22 01:10

Ali Naddaf