Fix exoplayer aspect ratio update on source changes (#2053)

* Fix exoplayer aspect ratio update on source changes

* Update CHANGELOG.md
This commit is contained in:
Jeferson Daniel 2020-06-30 14:00:16 -03:00 committed by GitHub
parent 8962720f56
commit dbf1a4e034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,7 @@
- Added preventsDisplaySleepDuringVideoPlayback (#2019)
- Reverted the JS fullscreening for Android. [#2013](https://github.com/react-native-community/react-native-video/pull/2013)
- Set iOS request headers without needing to edit RCTVideo.m. [#2014](https://github.com/react-native-community/react-native-video/pull/2014)
- Fix exoplayer aspect ratio update on source changes [#2053](https://github.com/react-native-community/react-native-video/pull/2053)
### Version 5.1.0-alpha5

View File

@ -67,6 +67,10 @@ public final class AspectRatioFrameLayout extends FrameLayout {
return videoAspectRatio;
}
public void invalidateAspectRatio() {
videoAspectRatio = 0;
}
/**
* Sets the resize mode which can be of value {@link ResizeMode.Mode}
*

View File

@ -200,6 +200,11 @@ public final class ExoPlayerView extends FrameLayout {
shutterView.setVisibility(VISIBLE);
}
public void invalidateAspectRatio() {
// Resetting aspect ratio will force layout refresh on next video size changed
layout.invalidateAspectRatio();
}
private final class ComponentListener implements SimpleExoPlayer.VideoListener,
TextOutput, ExoPlayer.EventListener {

View File

@ -410,6 +410,8 @@ class ReactExoplayerView extends FrameLayout implements
player.setPlaybackParameters(params);
}
if (playerNeedsSource && srcUri != null) {
exoPlayerView.invalidateAspectRatio();
ArrayList<MediaSource> mediaSourceList = buildTextSources();
MediaSource videoSource = buildMediaSource(srcUri, extension);
MediaSource mediaSource;