fix(iOS): sometimes aspect ratio is invalid (#3821)
* perf: ensure we do not provide callback to native if no callback provided from app * chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size * chore: improve issue template * fix(android): avoid video view flickering at playback startup * fix: invert aspect ratio evaluation to find video height / width
This commit is contained in:
parent
bb2404f8ba
commit
dac0985430
@ -1383,12 +1383,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
var orientation = "undefined"
|
var orientation = "undefined"
|
||||||
|
|
||||||
let tracks = await RCTVideoAssetsUtils.getTracks(asset: _playerItem.asset, withMediaType: .video)
|
let tracks = await RCTVideoAssetsUtils.getTracks(asset: _playerItem.asset, withMediaType: .video)
|
||||||
if let videoTrack = tracks?.first {
|
var presentationSize = _playerItem.presentationSize
|
||||||
width = Float(videoTrack.naturalSize.width)
|
if presentationSize.height != 0.0 {
|
||||||
height = Float(videoTrack.naturalSize.height)
|
width = Float(presentationSize.width)
|
||||||
} else if _playerItem.presentationSize.height != 0.0 {
|
height = Float(presentationSize.height)
|
||||||
width = Float(_playerItem.presentationSize.width)
|
} else if let videoTrack = tracks?.first {
|
||||||
height = Float(_playerItem.presentationSize.height)
|
let naturalSize = videoTrack.naturalSize
|
||||||
|
width = Float(naturalSize.width)
|
||||||
|
height = Float(naturalSize.height)
|
||||||
}
|
}
|
||||||
orientation = width > height ? "landscape" : width == height ? "square" : "portrait"
|
orientation = width > height ? "landscape" : width == height ? "square" : "portrait"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user