fix(android): add subtitleStyle.subtitlesFollowVideo prop to control subtitles positionning #4133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
add subtitleStyle.subtitlesFollowVideo prop to control subtitles positionning
2 options: follow video or follow main view
Here is description of the new property:
subtitlesFollowVideo
helps to determine how the subtitles are positionned.To understand this prop you need to understand how views management works.
The main View style passed to react native video is the position reserved to display the video component.
It may not match exactly the real video size.
For exemple, you can pass a 4:3 video view and render a 16:9 video inside.
So there is a second view, the video view.
Subtitles are managed in a third view.
First react-native-video resize the video to keep aspect ratio (depending on
resizeMode
property) and put it in main view.When putting subtitlesFollowVideo to true, the subtitle view will be adapt to the video view.
It means that if the video is displayed out of screen, the subtitles may also be displayed out of screen.
When putting subtitlesFollowVideo to false, the subtitle view will keep adapting to the main view.
It means that if the video is displayed out of screen, the subtitles may also be displayed out of screen.
This prop can be changed on runtime.
Motivation
Fix following regression: #4019 (will be fixed by default)
Regression introduced by following PR: #3830
Linked tickets: #3662 and #4043
Changes
dynamically configure subtitle position with a new prop added in subtitleStyle
Test plan
Can be tested with the sample. I didn't add a button to trigger change, but I tested with manually change the value
Note, it is not implemented on ios, I think it should ...