From cc2e9c42fa7d160c10daa21343e82b5d63e77b3e Mon Sep 17 00:00:00 2001 From: Jens Andersson Date: Tue, 5 May 2020 17:49:42 +0200 Subject: [PATCH 1/3] Fix video dimensions for HLS streams --- CHANGELOG.md | 1 + ios/Video/RCTVideo.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b52c98c..0fffdaff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Version 5.1.0-alpha6 - Fix iOS bug which would break size of views when video is displayed with controls on a non full-screen React view. [#1931](https://github.com/react-native-community/react-native-video/pull/1931) +- Fix video dimensions were undefined when playing HLS in ios ### Version 5.1.0-alpha5 diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index dde0dcb6..c6113cad 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -638,6 +638,10 @@ static int const RCTVideoUnset = -1; } else { orientation = @"portrait"; } + } else if (_playerItem.presentationSize.height) { + width = [NSNumber numberWithFloat:_playerItem.presentationSize.width]; + height = [NSNumber numberWithFloat:_playerItem.presentationSize.height]; + orientation = width > height ? @"landscape" : @"portrait"; } if (self.onVideoLoad && _videoLoadStarted) { From 4bc2a723a4bf406498a795eebe808c1691f8b524 Mon Sep 17 00:00:00 2001 From: Jens Andersson Date: Tue, 5 May 2020 17:54:00 +0200 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fffdaff..27ff1395 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Version 5.1.0-alpha6 - Fix iOS bug which would break size of views when video is displayed with controls on a non full-screen React view. [#1931](https://github.com/react-native-community/react-native-video/pull/1931) -- Fix video dimensions were undefined when playing HLS in ios +- Fix video dimensions being undefined when playing HLS in ios. [#1992](https://github.com/react-native-community/react-native-video/pull/1992) ### Version 5.1.0-alpha5 From 08c7aaa77e660129041b488e4448b884e3d63ad3 Mon Sep 17 00:00:00 2001 From: Jens Andersson Date: Tue, 5 May 2020 18:10:49 +0200 Subject: [PATCH 3/3] Compare CGFloats instead --- ios/Video/RCTVideo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index c6113cad..e9c49b91 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -641,7 +641,7 @@ static int const RCTVideoUnset = -1; } else if (_playerItem.presentationSize.height) { width = [NSNumber numberWithFloat:_playerItem.presentationSize.width]; height = [NSNumber numberWithFloat:_playerItem.presentationSize.height]; - orientation = width > height ? @"landscape" : @"portrait"; + orientation = _playerItem.presentationSize.width > _playerItem.presentationSize.height ? @"landscape" : @"portrait"; } if (self.onVideoLoad && _videoLoadStarted) {