Questions tagged [avplayerviewcontroller]

Using AVPlayerViewController makes it easy for you to add media playback capabilities to your application matching the styling and features of the native system players. Since AVPlayerViewController is a system framework class, your playback applications automatically adopt the new aesthetics and features of future operating system updates without any additional work from you.

SDKs

  • iOS 8.0+
  • tvOS 9.0+

Framework

  • AVKit

To find more information :

544 questions
4
votes
3 answers

Enable/Disable background music

To enable background music from app Spotify or Music app, I use this code: do { try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryAmbient) try AVAudioSession.sharedInstance().setActive(true) …
Roduck Nickes
  • 1,021
  • 2
  • 15
  • 41
4
votes
0 answers

AVPlayerViewController fullscreen issues constraint warnings

I am trying to create an UIViewController with some labels and a movie in the middle of the screen. For the movie, I am using AVPlayerViewController but, whenever I click on its fullscreen button, I receive several constraint warnings even if I…
4
votes
2 answers

Now that MPMoviePlayerPlaybackDidFinishReasonUserInfoKey is deprecated, what is the best way to find why playback ended?

In iOS9, the MPMoviePlayer classes have all been deprecated in favor of AVPlayer. I have an existing app using MPMoviePlayerPlaybackDidFinishReasonUserInfoKey to determine how to log events on how the video player ended. How do I do the same with…
4
votes
2 answers

Embedded AVPlayerControllerView adds AVTouchIgnoringView blocking default player's interface

UPDATE: The issue has nothing to do with AVPlayerControllerView, please see my answer below. Name of the class AVTouchIgnoringView confused me in the beginning, but that was also a wrong path of thinking about the problem. === As we all know, Media…
mikejd
  • 1,540
  • 13
  • 18
3
votes
1 answer

Identify when AVPlayerViewController is closed by tapping X button

Is there any method to identify when we close the AVPlayerViewController when the video is still playing? Attached the image as to which 'Close' button I am referring to.
3
votes
2 answers

AVPlayer doesn't play video until a video from UIImagePickerController is played

I'm having a problem which I haven't seen a post like it on here. I have an AVPlayerViewController which plays a video-based off the path from my Firebase Database (not Storage). The video plays perfectly as I want it to, but only once I watch a…
Jaqueline
  • 465
  • 2
  • 8
  • 25
3
votes
0 answers

Audio playing but video freezes AVPlayer on slow internet

I load my AVAsset asynchronously through this method: playerAsset.loadValuesAsynchronously(forKeys: ["duration", "playable", "hasProtectedContent"]) { DispatchQueue.main.async {[weak self] in guard let strongSelf = self else { return } …
3
votes
1 answer

Airplay stop playing video streaming when app is in background or device locked

I'am using an AVPlayerViewController for playing video in streaming. When I launch Airplay on the AVPlayerViewController on the Apple TV and put the app in background or if I lock the device, the video paused on the Apple TV. I verify that like in…
3
votes
0 answers

Video slow in loading and playing with AVPlayer

I'm playing videos using following code. Videos are hosted on my own server and accessible via url. Videos takes a lot of time to load and play. Typically it takes 15 secs or so to load and start playing for 50 MB file size. I don't want to reduce…
Raymond
  • 1,108
  • 13
  • 32
3
votes
1 answer

Custom TimeBar in ExoPlayer

I would like to create a custom timebar in exoplayer using PlayerView that: cannot be dragged by user but only shows the progress in the video UPDATE: Ok, so I was able to disable dragging by setting the touch_target_height to 0dp! allows the…
3
votes
1 answer

On iOS 13, AVPlayer chooses an audio only stream for this HLS video. Can I control this behavior, and instead have it load the video + audio?

An HLS/m3u8 video file (that I don't control) has an option to provide a audio-only stream, presumably for poor network conditions. On iOS 13 this gets selected all the time, even when the network's not that bad. On iOS 12 and earlier it would…
3
votes
1 answer

On Vimeo, does it make sense to use "HTTP Live Streaming" video file link if your video isn't live streaming?

In my app, I want to display some mp4 tutorial videos for the user using AVPlayerViewController. I upgraded to a Pro account on Vimeo, enabling me to use the direct links to my videos. It gives you a couple of options for which kind of link to use:…
3
votes
1 answer

AVPlayer duration changes when passed to differrent controller

I have a controller with a AVPlayer in collection view cell. When orientation changes to Landscape, the player should get FullScreen. For this I am presenting an AVPlayerController with same instance of player in Collection View Cell. The video…
udbhateja
  • 948
  • 6
  • 21
3
votes
0 answers

Change display text of AVPlayerViewController based on metadata

I am writing a basic Swift audio streaming application using AVPlayer and wanted to know if it was possible to change the default display text of the AVPlayerViewController. Currently the AVPlayerViewController looks like the following when I…
Joshua Alger
  • 2,122
  • 1
  • 14
  • 25
3
votes
1 answer

Swift 4 Unable to simultaneously satisfy constraints when using AVPlayerViewController()

I'm programatically adding a intro video for my app. Im getting the following warnings. any ideas what I'm doing wrong? Im very new to swift and iOS development. 2018-04-19 13:11:56.295952+0200 [1779:395252] [LayoutConstraints] Unable to…
James Nicholson
  • 987
  • 10
  • 20