Questions tagged [avplayerlayer]

AVPlayerLayer is a subclass of CALayer to which an AVPlayer object can direct its visual output.

During playback, AVPlayer may compensate for temporal drift between its visual output and its audible output to one or more independently-clocked audio output devices by adjusting the timing of its associated player layers. The effects of these adjustments are usually very small; however, clients that wish to remain entirely unaffected by such adjustments may wish to place other layers for which timing is important into independently timed subtrees of their layer trees.

You can create arbitrary numbers of player layers with the same AVPlayer object. Only the most-recently-created player layer will actually display the video content on-screen.

Click Here for Apple documentation of AVPlayerLayer.

248 questions
47
votes
3 answers

Multiple videos with AVPlayer

I am developing an iOS app for iPad that needs to play videos in some part of the screen. I have several video files that needs to be played after each other in an order that is not given at compile time. It must looks as if it is just one video…
Peter
  • 1,495
  • 1
  • 14
  • 21
31
votes
6 answers

AVplayer resuming after incoming call

I am using AVPlayer for music playback. My problem is that after an incoming call, the player won't resume. How do I handle this when an incoming call comes?
user2889249
  • 899
  • 2
  • 13
  • 22
21
votes
4 answers

AVPlayerLayer not bounds to UIView frame

I'm trying to add AVPlayerLayer to UIView self.player = AVPlayer(URL: NSURL(fileURLWithPath: path!)) self.playerLayer = AVPlayerLayer(player: player); self.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; …
Jornia Kabakum
  • 443
  • 8
  • 15
20
votes
3 answers

AVPlayer error while playing on tvOS

I'm playing a video on tvOS using the following code: NSString *filePath = [[NSBundle mainBundle] pathForResource:name ofType:@"mov"]; NSURL *fileUrl = [NSURL fileURLWithPath:filePath]; self.player = [AVPlayer playerWithURL:fileUrl]; AVPlayerLayer…
Wojtek
  • 1,006
  • 11
  • 30
17
votes
2 answers

NSKeyValueObservation: Cannot remove an observer for the key path from object because it is not registered as an observer

I get random crashes (which I can't reproduce on devices I own) in my app with exception: Cannot remove an observer Foundation.NSKeyValueObservation 0xaddress for the key path "readyForDisplay" from AVPlayerLayer 0xaddress because it is not…
iur
  • 2,056
  • 2
  • 13
  • 30
16
votes
5 answers

Resume AVPlayer video playback after app become active

I write custom player from AVPlayer for video playback. According to Apple docs set the video layer: self.player = [IPLPlayer new]; self.player.playerLayer = (AVPlayerLayer *)self.playerView.layer; Where self.playerView is usual class from…
HotJard
  • 4,598
  • 2
  • 36
  • 36
15
votes
3 answers

AVPlayer Video Blank but Hear Sound

I'm switching from MPMoviePlayerController to AVPlayer as I need finer grained control over video swapping. The .mov file I was playing with MPMoviePlayerController played fine, but after switching to AVPlayer I hear the audio from the video, but…
Gary Rudolph
  • 1,062
  • 9
  • 21
15
votes
8 answers

How to get video frame of the AVPlayer?

I have PlayerView class for displaying AVPlayer's playback. Code from documentation. #import #import @interface PlayerView : UIView @property (nonatomic) AVPlayer *player; @end @implementation…
Andrey Banshchikov
  • 1,558
  • 2
  • 15
  • 27
13
votes
0 answers

How to get a specific video area in Swift AVPlayer?

I am working on Swift base MAC OS-X application. The user will choose a video file and the NSView Controller will play the video using AVPlayerView. The user can draw a rectangle over the AVPlayerView and I have achieved this functionality. How to…
Ali
  • 1,102
  • 5
  • 21
  • 39
13
votes
4 answers

AVPlayerLayer blank after entering background while being in a hidden controller and entering foreground and being shown

I have an App in which I use AVPlayerLayer (used within a subclass of UIView just like Apples AV Foundation Programming Guide). Ihave a couple of view controllers witch are held in the View Controller that is resonsible for the menu (JASidePanels…
okipol
  • 1,197
  • 3
  • 11
  • 27
13
votes
3 answers

How to add transition between videos when using AVQueuePlayer?

I am working on a video application that plays a number of videos one after another. The videos are stored in an array of AVPlayerItems. AVQueuePlayer is initialized with those AVPlayerItems and it automatically plays the videos from that array. The…
Parvez Belim
  • 1,003
  • 13
  • 36
10
votes
1 answer

How to properly delete/release AVPlayer/AVPlayerItem?

I am implementing a video app, that lists video and able to stream or watch local videos. If I try to watch videos with my player that inherits from AVPlayer, a lot of threads initated, after 15-20 times, the system does not alloc the AVPlayer well…
erdemgc
  • 1,701
  • 3
  • 23
  • 43
10
votes
3 answers

AVPlayer fails with AVPlayerItemStatusFailed (OSStatus error -12983)

Sometimes AVPlayer fails with AVPlayerItemStatusFailed and after that failure occurred, AVPlayer continues to failed with AVPlayerItemStatusFailed. I tried to clear the AVPlayer instance and create new one, but I cannot achieve…
instback
  • 131
  • 2
  • 15
9
votes
1 answer

Video playback issues only on iOS 13 with AVPlayerViewController and AVPlayer when using HLS video

I have an app that plays back videos. It's compatible with iOS 11, 12 and iOS 13. On iOS 11 and 12, video playback works properly as expected using either AVPlayerViewController or even just AVPlayerLayer. However, on iOS 13 I started getting…
9
votes
1 answer

Display multiple videos using AVPlayer and AVPlayerLayer on UICollectionView

I'm working an application displaying "n" number of videos on full screen using AVPlayer & AVPlayerLayer classes on UICollectionView Cell with horizontal scroll. I was set paging enabled on UIScrollView. Because I need to play only current position…
Ram
  • 764
  • 1
  • 7
  • 20
1
2 3
16 17