장치가 세로 인 경우 비디오를 재생하는 컨테이너보기가 있습니다. 기기를 돌릴 때 동영상이 자동으로 전체 화면으로 재생되기를 원합니다. 나는 장치가 회전 할 때 감지이 코드를 해봤지만 전체 화면스위프트 3 - 가로로 회전 할 때 전체 화면으로 비디오 재생
override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
if (UIDevice.current.orientation.isLandscape) {
videoContainerView.frame = self.view.frame
// self.videoContainerView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height) // this didn't work to....
print("Device is landscape")
}
else{
print("Device is portrait")
}
}
비디오는 AVPlayer를 플레이어에에 컨테이너를 변경하지 않습니다. 감사의
'layoutConstraints'에 의해 귀하의 문제를 해결할 수 있습니까? 'videoView'를'containerView'에 바인딩하십시오. – RrrangeTop
이미 바인딩되어 있습니다 ... –
회전했을 때 AvplayerController를 화면 크기로 설정하여 해결책을 찾았습니다. 이제 navbar를 닫는 방법을 찾아야합니다. –