Merge pull request #2741 from iFeelSmart/fix/avoid_duplicated_onEnd

fix(android): ensure we don't disable playback when player is ENDED
This commit is contained in:
Olivier Bouillet 2022-08-20 14:27:38 +02:00 committed by GitHub
commit 11cde867df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@
### Version 6.0.0-alpha.2
- Fix Android #2690 ensure onEnd is not sent twice [#2690](https://github.com/react-native-video/react-native-video/issues/2690)
- Fix Exoplayer progress not reported when paused [#2664](https://github.com/react-native-video/react-native-video/pull/2664)
- Call playbackRateChange onPlay and onPause [#1493](https://github.com/react-native-video/react-native-video/pull/1493)
- Fix being unable to disable sideloaded texttracks in the AVPlayer [#2679](https://github.com/react-native-video/react-native-video/pull/2679)

View File

@ -824,7 +824,10 @@ class ReactExoplayerView extends FrameLayout implements
player.setPlayWhenReady(true);
}
} else {
player.setPlayWhenReady(false);
// ensure playback is not ENDED, else it will trigger another ended event
if (player.getPlaybackState() != Player.STATE_ENDED) {
player.setPlayWhenReady(false);
}
}
}