Skip to content

Commit

Permalink
fix(android): ensure rate is never set to 0 (TheWidlarzGroup#3593)
Browse files Browse the repository at this point in the history
* fix(android): ensure rate is never set to 0

---------

Co-authored-by: Olivier Bouillet <[email protected]>
  • Loading branch information
freeboub and Olivier Bouillet authored Mar 21, 2024
1 parent 408cfb2 commit 3d7444a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,11 @@ public void seekTo(long positionMs) {
}

public void setRateModifier(float newRate) {
if (newRate <= 0) {
DebugLog.w(TAG, "cannot set rate <= 0");
return;
}

rate = newRate;

if (player != null) {
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/component/props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 3 additions & 1 deletion examples/basic/src/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 3d7444a

Please sign in to comment.