avplayerviewcontroller

How to resume audio playing of other apps after dismissing AVPlayerViewController?

放肆的年华 提交于 2021-02-18 18:09:13
问题 I use AVPlayerViewController to play short videos in my app. If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I currently use AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) to do that. Even though Apple's Music app and Podcasts app do resume playing after I call AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) —won't resume

How to resume audio playing of other apps after dismissing AVPlayerViewController?

馋奶兔 提交于 2021-02-18 18:06:08
问题 I use AVPlayerViewController to play short videos in my app. If there is an app playing audio in background before user plays a video in my app, I want the background audio playing of the other app to resume after my video player is dismissed. I currently use AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) to do that. Even though Apple's Music app and Podcasts app do resume playing after I call AVAudioSession.setActive(false, with: .notifyOthersOnDeactivation) —won't resume

Exit AVPlayerViewController fullscreen programmatically?

我的梦境 提交于 2021-02-10 06:37:50
问题 I am try customize AVPlayerViewController show fullscreen and I search link: How to make a AVPlayerViewController go to fullscreen programmatically?. It work when I use private method, but I can't find method exit full screen. 回答1: I have found a solution to this problem that works for me extension AVPlayerViewController { func goFullScreen() { let selectorName: String = { if #available(iOS 11.3, *) { return "_transitionToFullScreenAnimated:interactive:completionHandler:" } else if #available

Exit AVPlayerViewController fullscreen programmatically?

偶尔善良 提交于 2021-02-10 06:37:15
问题 I am try customize AVPlayerViewController show fullscreen and I search link: How to make a AVPlayerViewController go to fullscreen programmatically?. It work when I use private method, but I can't find method exit full screen. 回答1: I have found a solution to this problem that works for me extension AVPlayerViewController { func goFullScreen() { let selectorName: String = { if #available(iOS 11.3, *) { return "_transitionToFullScreenAnimated:interactive:completionHandler:" } else if #available

Rotate video 90 degrees in AVPlayerViewController - possible?

落爺英雄遲暮 提交于 2021-01-27 20:58:24
问题 I cannot figure out how to rotate the video 90 degrees in AVPlayerViewController , anyone have any ideas as to how to do this? I'm unsure how to access the AVPlayerLayer as you normally would. 回答1: Try with this code, using AffineTransform we rotate the view but we need also adjust the frame EDITED UIView.animate(withDuration: 0.5) { self.avPlayerViewController?.view.transform = CGAffineTransform(rotationAngle: CGFloat((90 * Double.pi)/180)) self.avPlayerViewController?.view.frame = CGRect(x:

iOS 11 AVPlayerViewController Disable Pinch / Drag Gesture

让人想犯罪 __ 提交于 2021-01-08 02:31:06
问题 I have an AVPlayerViewController setup to play a video and them I am in-bedding the VC's view in a custom view controller. But if they user tries they can move the video around by 2 finger grabbing. How do I disable this? Thanks! See Below: 回答1: Try something like this before start playing video var positions = [Int]() for (idx, recognizer) in (playerVC.view.subviews[0].gestureRecognizers?.enumerated())! { if recognizer is UIPinchGestureRecognizer || recognizer is UIPanGestureRecognizer {

iOS 11 AVPlayerViewController Disable Pinch / Drag Gesture

眉间皱痕 提交于 2021-01-08 02:30:34
问题 I have an AVPlayerViewController setup to play a video and them I am in-bedding the VC's view in a custom view controller. But if they user tries they can move the video around by 2 finger grabbing. How do I disable this? Thanks! See Below: 回答1: Try something like this before start playing video var positions = [Int]() for (idx, recognizer) in (playerVC.view.subviews[0].gestureRecognizers?.enumerated())! { if recognizer is UIPinchGestureRecognizer || recognizer is UIPanGestureRecognizer {