Skip to content

Commit d11279f

Browse files
author
Shahen Hovhannisyan
committed
fix(VideoPlayer): CurrentTime
Don't allow to set negative number to currentTime prop
1 parent 6d6bdb5 commit d11279f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ios/RNVideoProcessing/RNVideoPlayer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ class RNVideoPlayer: RCTView {
9797
var currentTime: NSNumber? {
9898
set(val) {
9999
if val != nil && player != nil {
100-
let floatVal = val as! CGFloat
100+
let convertedValue = val as! CGFloat
101+
let floatVal = convertedValue >= 0 ? convertedValue : self._playerStartTime
102+
print("CHANGED: currentTime \(floatVal)")
101103
if floatVal <= self._playerEndTime && floatVal >= self._playerStartTime {
102104
self.player.seek(to: convertToCMTime(val: floatVal))
103105
}

0 commit comments

Comments
 (0)