avplayerviewcontroller

Custom button not working in AVPlayer iOS 11 but it's perfectly working below iOS 11?

元气小坏坏 提交于 2019-12-09 23:45:45
问题 I know possibly this is duplicate question but the question which is already exist didn't have an solution so , I'm asking again to possibly start bounty question . Here is my code which is working below iOS 11 : AVPlayer *player = [AVPlayer playerWithURL:videoURL]; // create a player view controller avcontroller = [[AVPlayerViewController alloc]init]; avcontroller.player = player; [player play]; NSNotificationCenter *noteCenter = [NSNotificationCenter defaultCenter]; [noteCenter

Can't hide status bar in AVPlayerViewController's portrait mode

不问归期 提交于 2019-12-08 06:15:06
问题 I'm developing an app that first presents a UICollectionView with a bunch of buttons that modally open a subclass of AVPlayerViewController with a custom "Over Full Screen" segue. UIViewControllerBasedStatusBarAppearance is set to YES in my Info.plist. Here's a small (had to zoom out, sorry) screenshot of all the view controllers in Interface Builder: The segue was defined in IB. When the user taps a collection view cell, I use performSegueWithIdentifier() to, well, perform the segue. The

Resume AVPlayer stream playback last sample

若如初见. 提交于 2019-12-08 03:59:52
问题 I am trying to use the native player (AVPlayer) to reproduce a live stream on iOS. However, I have trouble resuming the playback. When I stop the playback and resume it after few seconds, the playback starts from the moment I paused instead of reproducing the current (last) sample of the live stream. Is there a way to get the last sample, o configure AVPlayer to reproduce from last sample when tapping on Play Button? 回答1: My solution is based on denying user to keep the player paused. This is

Resume AVPlayer stream playback last sample

怎甘沉沦 提交于 2019-12-06 16:12:50
I am trying to use the native player (AVPlayer) to reproduce a live stream on iOS. However, I have trouble resuming the playback. When I stop the playback and resume it after few seconds, the playback starts from the moment I paused instead of reproducing the current (last) sample of the live stream. Is there a way to get the last sample, o configure AVPlayer to reproduce from last sample when tapping on Play Button? My solution is based on denying user to keep the player paused. This is, destroying the player each time playback is resumed. And creating a new instance each time, playback is

Force orientation not working in iOS 10 devices

岁酱吖の 提交于 2019-12-06 12:59:05
Currently i am doing force orientation change when AVPlayer fullscreen button pressed.I tried something similar final class NewMoviePlayerViewController: AVPlayerViewController { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() if contentOverlayView?.bounds == UIScreen.main.bounds{ DispatchQueue.main.async { let value = UIInterfaceOrientation.landscapeRight.rawValue UIDevice.current.setValue(value, forKey: "orientation") } print("full screen") }else{ DispatchQueue.main.async { let value = UIInterfaceOrientation.portrait.rawValue UIDevice.current.setValue(value, forKey:

AVPlayerViewController inside a view is not showing the playback controls

时光总嘲笑我的痴心妄想 提交于 2019-12-06 10:29:51
问题 I am working with apple tv. I have a UIView inside my UIViewController. I am adding AVPlayerViewController as subview of my UIView. UIView's frame is CGRect(x: 50, y: 50, width: 1344, height: 756). I am setting AVPlayerViewController frame equals to my UIView's frame. Issue is that video plays fine in its frame but the controls like pause, play, forward etc. are hidden and not working. But when I set frame as CGRect(x: 0, y: 0, width: 1920, height: 1080), controls are visible and working. My

AVPlayerViewController black screen when swiping on iOS 11

六月ゝ 毕业季﹏ 提交于 2019-12-05 06:22:20
I'm using AVPlayerViewController to play a video file (H.264, AAC, MP4-Container) on an iPad-App. Everything is working in iOS 10. And also in iOS 11 it plays the video correctly. But in iOS 11, when I start swiping in any direction, it immediately blacks out the video and also mutes audio. It also shows a loading indicator next to the timeline on the bottom. Also it ignores the allowsPictureInPicturePlayback property, so it doesn't show the PIP-Button on iOS 11. This is the code I use: avPlayerController = AVPlayerViewController() avPlayerController?.showsPlaybackControls = true

How do I replace MPMoviePlayer notifications?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 05:28:30
In iOS 9 MPMoviePlayer and all his components are deprecated. We used MPMoviePlayerController notifications, like MPMoviePlayerLoadStateDidChangeNotification, MPMovieDurationAvailableNotification, MPMoviePlayerPlaybackStateDidChangeNotification, MPMoviePlayerReadyForDisplayDidChangeNotification , to track video service quality. But now with AVPlayerViewController I can't find properly replacement for these notifications. How do I replace these notifications now? AVPlayerViewController is a lot different in its usage from the MPMoviePlayerViewController . Instead of using notifications you use

How to perform some action on Play and Pause actions of AVPlayer?

久未见 提交于 2019-12-05 02:07:49
问题 I have used AVPlayer to play video on my swift application. I want to place a Play button (custom button) at the middle of video. I know how to play and pause video on tapping the button. I couldn't find how to show/hide the custom button when the video is played/paused from default buttons? Are there any listener or something which triggers when the video is played/paused? I also want to hide the "Audio & Subtitles" icon from default control. 回答1: Here is how you can listen to player state

AVPlayerViewController inside a view is not showing the playback controls

廉价感情. 提交于 2019-12-04 17:27:17
I am working with apple tv. I have a UIView inside my UIViewController. I am adding AVPlayerViewController as subview of my UIView. UIView's frame is CGRect(x: 50, y: 50, width: 1344, height: 756). I am setting AVPlayerViewController frame equals to my UIView's frame. Issue is that video plays fine in its frame but the controls like pause, play, forward etc. are hidden and not working. But when I set frame as CGRect(x: 0, y: 0, width: 1920, height: 1080), controls are visible and working. My code is as per below: let url = URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4") let