Corrected currentTime & playableDuration when using start & end time
This commit is contained in:
@@ -207,7 +207,10 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
return
|
||||
}
|
||||
|
||||
let currentTime = _player?.currentTime()
|
||||
var currentTime = _player?.currentTime()
|
||||
if (currentTime != nil && _source?.startTime != nil) {
|
||||
currentTime = CMTimeSubtract(currentTime!, CMTimeMake(value: _source?.startTime ?? 0, timescale: 1000))
|
||||
}
|
||||
let currentPlaybackTime = _player?.currentItem?.currentDate()
|
||||
let duration = CMTimeGetSeconds(playerDuration)
|
||||
let currentTimeSecs = CMTimeGetSeconds(currentTime ?? .zero)
|
||||
@@ -223,7 +226,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
}
|
||||
onVideoProgress?([
|
||||
"currentTime": NSNumber(value: Float(currentTimeSecs)),
|
||||
"playableDuration": RCTVideoUtils.calculatePlayableDuration(_player),
|
||||
"playableDuration": RCTVideoUtils.calculatePlayableDuration(_player, withSource: _source),
|
||||
"atValue": NSNumber(value: currentTime?.value ?? .zero),
|
||||
"currentPlaybackTime": NSNumber(value: NSNumber(value: floor(currentPlaybackTime?.timeIntervalSince1970 ?? 0 * 1000)).int64Value),
|
||||
"target": reactTag,
|
||||
|
||||
Reference in New Issue
Block a user