Page 1 of 1

I get a pink screen when changing the drawable's size

Posted: 20 Feb 2020 15:53
by watermamal
I'm using VLCKit and when the view appears in portrait mode with the iPhone max models, the view appears pink in the simulator and black on a real device, I'm guessing this is due to the video being outputted to a view that's too large, but when I rotate the device to landscape it works and then if I rotate it back to portrait it also works(if I'm on a real device, on simulator it never works in portrait).

This is my code that changes the view size on orientation change so that the video will always fill the entire screen and overflow

Code: Select all

func adaptMovieFrameToScreen() { let screen = UIScreen.screens[0].bounds let videoSize = self.mediaPlayer.videoSize let ratio = videoSize.width / videoSize.height let screenRatio = screen.width / screen.height var size = CGSize() if videoSize.width == 0 || videoSize.height == 0 { return } size.height = screen.height size.width = size.height * videoSize.width / videoSize.height if ratio < screenRatio { size.width = screen.width size.height = size.width / ratio } self.movieView.frame = CGRect(origin: UIScreen.screens[0].bounds.origin, size: size) self.scrollView.frame = self.movieView.frame debugPrint("Video Size: \(videoSize), Ratio: \(ratio)") debugPrint("Debug Frame Size: \(size), Ratio: \(screenRatio)") debugPrint("Debug Movie Frame Size \(movieView.frame.size)") debugPrint("Debug Screen Size \(screen.size)") resetZoom() }
and here is the vlc debug log [url]https://pastebin.com/0RdRSuB1[/url]
sorry but pasting the log here was puttin me over character limit