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

feat: implement opacity to control visibility of subtitles #3583

Merged

Conversation

coofzilla
Copy link
Contributor

Summary

Add ability to control subtitle visibility while still maintaining ability of selecting a text track.

Motivation

see #3579

Changes

Updated subtitleStyle to include an opacity property; which, can control the visibility of subtitles.

Updated documentation for the new property and provided a link onTextTrackDataChanged -> subtitleStyles to clarify intent on how to control visibility of subtitles.

Test plan

✅ Tested on example app:

image

Simply set the following props:

          selectedTextTrack={{
            type: SelectedTrackType.LANGUAGE,
            value: 'en',
          }}
          subtitleStyle={{
            opacity: 0,
          }}

Then observe that the subtitleTracks log from onTextTrackDataChanged and do not display them :)

Subtitles displayed as expected when set to 1:

image

If not explicitly set, they will be displayed:

image

Type safe, must be 0 or 1
image

implemented per discussion on TheWidlarzGroup#3579

updated docs and linked onTextTrackDataChanged to the subtitle style to clarify intent on how to control visibility.
@coofzilla
Copy link
Contributor Author

@KrzysztofMoch I believe the build android actions need their cache cleaned and re-run they passed https://github.com/react-native-video/react-native-video/actions/workflows/build-android.yml right before I did the lint to remove a white space.

@coofzilla
Copy link
Contributor Author

#3580 seems like this might be related.

Copy link
Collaborator

@freeboub freeboub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see my comment.
I think you can also add the ios change in this PR ?!

@coofzilla
Copy link
Contributor Author

coofzilla commented Mar 12, 2024

I think you can also add the ios change in this PR ?!

actually, yeah I can add those changes, I'm going to update it now.

@coofzilla
Copy link
Contributor Author

coofzilla commented Mar 13, 2024

@freeboub Added the ios changes, please review :)

Tested:

✅ Opacity set to 0:

image_720

✅ Opacity set to 0.5( not supported; but, no errors ) this is due to limitations with alpha support on legibleOutput:
image_480

✅ Opacity set to 1:

image_480-1

@coofzilla
Copy link
Contributor Author

and one more verification for good measure.

tested with:

  selectedTextTrack={{
    type: SelectedTrackType.LANGUAGE,
    value: 'en',
  }}
  subtitleStyle={{
    opacity: 0,
  }}

image

Copy link
Member

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Collaborator

@freeboub freeboub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small remark, else it looks good to me !

@coofzilla
Copy link
Contributor Author

one small remark, else it looks good to me !

great catch, thank you! I think the cache needs to be cleared for the Build Android, and then it should be good for merge? 🥹

@coofzilla coofzilla requested a review from freeboub March 13, 2024 21:13
@freeboub
Copy link
Collaborator

@coofzilla Yes this is OK for me!
let's wait for @KrzysztofMoch for the builder cache issue

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.

3 participants