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
6
votes
1 answer

Stretch video on AVPlayerLayer

I am using the following code to show a full-screen video on my UIView: - (void)playMovie:(NSString *)name :(NSString *)type { NSURL *movieURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:name ofType:type]]; …
goodolddays
  • 2,595
  • 4
  • 34
  • 51
5
votes
1 answer

AVPlayer flashing when using replaceCurrentItem() - Swift - Programmatically

I'm setting up an AVPlayer in a UIView in this way: fileprivate func setUpAVPlayer(){ self.cardModel?.urlStrings?.forEach({ (urlString) in guard let url = URL(string: urlString) else { return } let asset =…
StackGU
  • 868
  • 9
  • 22
5
votes
2 answers

AVPlayer blank video: playing sound but no video

This question has the same problem, but the solutions didn't work. The AVPlayer sometimes plays a blank video: there is sound but no video. While blank videos were played, we printed the frame and status of the player. The frame was non-zero and was…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
5
votes
4 answers

AVPlayerLayer shows black screen but sound is working

Im trying to display a local recorded video in a AVPlayerLayer which works sometimes. I can hear the audio from the recorded video but can't see the video. Sometimes both video and audio is working, sometimes only audio. I've tried both with a…
5
votes
2 answers

Xcode - Objective C - AVPlayer programmatically - play local video, with standard/system skin

Can anyone help me with code for setting up and playing local videofile, using AVPlayer in Xcode? (using AVPlayerLayer, and AVPlayerViewController) All done programmatically and with standard/system videoskin? Regards Henning
Henning
  • 253
  • 1
  • 2
  • 11
5
votes
1 answer

AVPlayerItemStatusFailed error when too many AVPlayer instances created

I'm working on an iOS app which creates a feed of all the videos submitted by the pool of users, enabling users to browse and view the videos that others have created. As you can imagine, I need to be able to support an arbitrary number of videos in…
bfich
  • 393
  • 2
  • 19
5
votes
1 answer

AVPlayer stretches the end of a HLS video

When AVPlayer reaches the end of the video (for an HTTP live stream), the last frame stretches to fill the view. How do I get around this stretching? For instance, consider that the video was recorded in portrait mode. On a smaller view, the video…
joelg
  • 1,094
  • 9
  • 19
5
votes
1 answer

Disable Audio (and interruption) with MPMoviePlayerController using Swift

At the moment, this is how I'm playing a video on the subview of my UIViewController: override func viewDidAppear(animated: Bool) { let filePath = NSBundle.mainBundle().pathForResource("musicvideo", ofType: "mp4") …
gotnull
  • 26,454
  • 22
  • 137
  • 203
4
votes
0 answers

AVPlayerRateDidChangeReasonAppBackgrounded called even when app is not in background

I'm finding that on iOS 15, AVPlayer is adjusting its rate to 0.0 with the notification reason AVPlayerRateDidChangeReasonAppBackgrounded, even when the app is still in the foreground. This seems to occur when a view containing an AVPlayerLayer is…
Aaron Wojnowski
  • 6,352
  • 5
  • 29
  • 46
4
votes
1 answer

Black screen observed sometimes while playing the FairPlay Streaming protected content

We are using AVPlayerLayer to play the content in iOS application. Some time there is a black screen occurred while playing the content but content continue playing audio during playback. This can be observed randomly during the playback also when…
Sumit
  • 41
  • 2
4
votes
1 answer

Avplayer implement subtitles using .srt file in iOS swift

How to implement subtitles using .srt file with avplayer in iOS. When using the avplayer is there a way to use .srt file in avplayer to show the subtitle on the player
4
votes
2 answers

AVPlayer in UITableViewCell is black and can't view

I've gone through every post and article but have yet to solve my problem and I'm not sure why. I have a table view which if the piece of content is an image, it will show an image in the TableViewCell, otherwise it will show a video in it. For the…
Jaqueline
  • 465
  • 2
  • 8
  • 25
4
votes
1 answer

Sync video in AVPlayerLayer and AVPlayerViewController

I'm working with AVPlayerto show the playing video using a URL in it. There are 2 parts to it: 1. Firstly, I've embedded the AVPlayer to a view's sublayer using AVPlayerLayer, i.e. var player: AVPlayer? func configure() { let urlString =…
PGDev
  • 23,751
  • 6
  • 34
  • 88
4
votes
1 answer

Add button on top of AVPlayerLayer - iOS Swift

I'm trying to add a play button on top of my AVPlayerLayer but it's not showing up. I have a UIView called playerView as an IBOutlet. Here's how I create the player and a corresponding playerLayer, and put it in the playerView: player =…
Adam Zarn
  • 1,868
  • 1
  • 16
  • 42
4
votes
0 answers

How to replace AVPlayerLayer for AVPictureInPictureController?

I am working on PIP mode, as per the requirement in PIP mode I need to start another player as soon as current AVPlayer ends. Currently PIP mode closes automatically as it ends. Creating new AVPictureInPictureController object isn't starting in PIP…
1 2
3
16 17