Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow applications to modify subtitle offsets during playback #1976

Open
pawaom opened this issue Dec 14, 2024 · 1 comment
Open

Allow applications to modify subtitle offsets during playback #1976

pawaom opened this issue Dec 14, 2024 · 1 comment

Comments

@pawaom
Copy link

pawaom commented Dec 14, 2024

How can we sync subtitles for Delay

Suppose we have a video and subtitles in Srt format

Now the video plays with the subtitle but the subtitles are delayed by say 30 second to the actual video how can we adjust the subtitles to sync with the actual video

We have used the following code to display the subtitles

val mediaItem: MediaItem  = MediaItem.Builder()
                    .setUri(uri)
                    .setSubtitleConfigurations(
                        listOf(
                            MediaItem. SubtitleConfiguration.Builder(
                                subtitleUri)

                                    .setMimeType (MimeTypes. APPLICATION_SUBRIP) // The correct MIME type for you
                                    .setLanguage ("en")
                                    .setSelectionFlags(C.SELECTION_FLAG_DEFAULT)

                    .build())) .build()
                mediaItemsList.add(mediaItem)

Also int the above code we have the language set to english how can we set it to the "Default" language of the device or one selected by the user for the App.

@icbaker
Copy link
Collaborator

icbaker commented Dec 16, 2024

The sync part of this question is a duplicate of google/ExoPlayer#854.

I'm going to close that one and leave this one open as it's on our new issue tracker.


Also int the above code we have the language set to english how can we set it to the "Default" language of the device or one selected by the user for the App.

I'm not sure I understand this question - surely the language a subtitle file is in depends on the file itself, not the user's selected device language. If you don't know what language a subtitle file is in, you can leave SubtitleConfiguration.language unset.

@icbaker icbaker marked this as a duplicate of google/ExoPlayer#854 Dec 16, 2024
@icbaker icbaker changed the title How can we sync subtitles for Delay Allow applications to modify subtitle offsets during playback Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants