fix(android): ensure rate is never set to 0 (#3593)

* fix(android): ensure rate is never set to 0

---------

Co-authored-by: Olivier Bouillet <olivier@OrdinateOlivier.lan>
This commit is contained in:
Olivier Bouillet 2024-03-21 15:40:25 +01:00 committed by GitHub
parent 408cfb2c1c
commit 3d7444ab25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View File

@ -1903,6 +1903,11 @@ public class ReactExoplayerView extends FrameLayout implements
}
public void setRateModifier(float newRate) {
if (newRate <= 0) {
DebugLog.w(TAG, "cannot set rate <= 0");
return;
}
rate = newRate;
if (player != null) {

View File

@ -434,8 +434,8 @@ Default: 250.0
Speed at which the media should play.
- **0.0** - Pauses the video
- **1.0** - Play at normal speed
- **0.0** - Pauses the video (iOS only)
- **1.0** - Play at normal speed (default)
- **Other values** - Slow down or speed up playback
### `repeat`

View File

@ -638,11 +638,13 @@ class VideoPlayer extends Component {
/>
</View>
<View style={styles.generalControls}>
{/* shall be replaced by slider */}
<MultiValueControl
values={[0.25, 0.5, 1.0, 1.5, 2.0]}
values={[0, 0.25, 0.5, 1.0, 1.5, 2.0]}
onPress={this.onRateSelected}
selected={this.state.rate}
/>
{/* shall be replaced by slider */}
<MultiValueControl
values={[0.5, 1, 1.5]}
onPress={this.onVolumeSelected}