Skip to content

Commit

Permalink
feat: allow "0" to work too
Browse files Browse the repository at this point in the history
  • Loading branch information
YangJonghun committed Nov 20, 2023
1 parent 4fb8b03 commit dcf1434
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ private void initializePlayerSource(ReactExoplayerView self, DrmSessionManager d
if (haveResumePosition) {
player.seekTo(resumeWindow, resumePosition);
}
if (startPositionMs > 0) {
if (startPositionMs >= 0) {
player.setMediaSource(mediaSource, startPositionMs);
} else {
player.setMediaSource(mediaSource, !haveResumePosition);
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/component/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ The following other types are supported on some platforms, but aren't fully docu
#### Start playback at a specific point in time

Provide an optional `startPosition` for video. Value is in milliseconds. If the `cropStart` prop is applied, it will be applied from that point forward.
(If it is zero or negative, it is ignored)
(If it is negative or undefined or null, it is ignored)

Platforms: Android, iOS

Expand Down
2 changes: 1 addition & 1 deletion ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
_pendingSeek = false
}

if _startPosition > 0 {
if _startPosition >= 0 {
setSeek([
"time": NSNumber(value: _startPosition),
"tolerance": NSNumber(value: 100)
Expand Down
2 changes: 1 addition & 1 deletion src/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
mainVer: resolvedSource.mainVer || 0,
patchVer: resolvedSource.patchVer || 0,
requestHeaders: resolvedSource.headers || {},
startPosition: resolvedSource.startPosition || -1,
startPosition: resolvedSource.startPosition ?? -1,
cropStart: resolvedSource.cropStart || 0,
cropEnd: resolvedSource.cropEnd,
title: resolvedSource.title,
Expand Down

0 comments on commit dcf1434

Please sign in to comment.