fix(ios): ensure duration available when playing live (#3710)
* fix(ios): ensure duration is correct when starting a live playback
This commit is contained in:
parent
eec125579f
commit
d56b251aef
@ -1281,8 +1281,13 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
guard let _playerItem else { return }
|
||||
var duration = Float(CMTimeGetSeconds(_playerItem.asset.duration))
|
||||
|
||||
if duration.isNaN || duration == 0 {
|
||||
// This is a safety check for live video.
|
||||
// AVPlayer report a 0 duration
|
||||
duration = RCTVideoUtils.calculateSeekableDuration(_player).floatValue
|
||||
if duration.isNaN {
|
||||
duration = 0.0
|
||||
duration = 0
|
||||
}
|
||||
}
|
||||
|
||||
var width: Float?
|
||||
|
Loading…
Reference in New Issue
Block a user