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

add exoplayer subtitles attributte #972

Closed
wants to merge 2 commits into from

Conversation

sungjkim34
Copy link

@sungjkim34 sungjkim34 commented Mar 15, 2018

When using the exoplayer, the subtitle boolean attribute will now toggle on or off the subtitles.
This works especially great with a HLS with embedded subtitles.

@huanghanzhilian
Copy link

How to use it, please

@sungjkim34
Copy link
Author

Just add a boolean to the subtitle prop.
<Video subtitle={true} />

@huanghanzhilian
Copy link

Hello, your example is HLS embedded subtitles, can you do plug-in subtitles, such as VTT, ass file type subtitles?

@huanghanzhilian
Copy link

My needs are similar to him
978

@sungjkim34
Copy link
Author

No unfortunately this PR is specifically only for subtitles attached directly to the HLS stream.
I would possibly recommend attaching a WebVTT subtitle to your HLS stream if you want to use the code from this fix.

@cobarx
Copy link
Contributor

cobarx commented May 1, 2018

I need support for external subtitles as well and should be able to put together a PR for ExoPlayer support shortly. It would make a lot of sense to have a unified API to control both embedded & external subtitles. Trying to stay close to the HTML5 video tag (https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video), I came up with:

<Video source={{ uri: "https://example.com/video.mp4" }}
  tracks={[
    { label: "English", type: "vtt", uri: "https://example.com/video.en.vtt" },
    { label: "Spanish", type: "srt", uri: "https://example.com/video.es.srt" }
  ]}
  // One of "none", "embedded", or a label. Defaults to none. Maybe should be called selectedCaption
  selectedTrack="English" 
  />

I think we want to be able to switch between tracks without reloading the video or loading subtitles on the fly, so this approach would make it easier. Looping in a team member @akshaygore06 for thoughts.

@akshaygore06
Copy link
Contributor

@cobarx: I like your approach of passing the list of available tracks with the video source. I think this will be a good approach to solve the subtitles sideloading issue.

@petrbela
Copy link

petrbela commented May 2, 2018

I have added basic support for subtitles in an HLS stream using iOS' AVPlayer flextv@ce01d5a

I think it might be a good idea to work together on establishing an API, both for vtt subtitles included in an HLS stream, and side-loaded from external files (although Apple is quite sparse on how to work with external subtitles, there are some ways to do it).

@sungjkim34 For HLS subtitles, there seems to be an option to set a preferred language for the subtitles. Do you think we should add it as an option?

@cobarx Are you working off https://google.github.io/ExoPlayer/guide.html#side-loading-a-subtitle-file? Are there any other configuration options that might be included?

@petrbela petrbela mentioned this pull request May 2, 2018
@cobarx
Copy link
Contributor

cobarx commented May 3, 2018

@petrbela Not seeing anything else we need to support at the moment, we can always add more attributes later.

Does anyone know how to control the order that the props are passed to the native module? ExoPlayer only supports loading subtitles before the video starts and React Native is passing the source prop before the track prop.

@cobarx
Copy link
Contributor

cobarx commented Jun 1, 2018

I have a pretty clear idea of what's required to implement robust text track support for both iOS & ExoPlayer. I've documented my ideas in #1044, please provide feedback. I should have be able to get embedded caption support done in about a week.

@cobarx
Copy link
Contributor

cobarx commented Jun 3, 2018

My implementation is now ready in #1049.

@cobarx
Copy link
Contributor

cobarx commented Jun 5, 2018

Going to close this since we have a more robust implementation in the other PR. I'll open another PR in the next few weeks to support sidecar subtitles.

@cobarx cobarx closed this Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants