Questions tagged [avqueueplayer]

AVQueuePlayer is a subclass of AVPlayer used to play a number of items in a sequence.

An AVPlayer object can be used to implement controllers and user interfaces for single- or multiple-item playback. The multiple-item case supports advanced behaviors.

AVPlayer works equally well with local and remote media files, providing appropriate information about readiness to play or about the need to await additional data before continuing.

The visual content of items played can be displayed by an instance of AVPlayer in a CoreAnimation layer of class AVPlayerLayer; to synchronize real-time playback with other CoreAnimation layers, AVSynchronizedLayer can be used. An instance of AVVideoCompositionCoreAnimationTool cannot be used with an AVPlayer object; for offline rendering AVAssetExportSession should be used.

The status of a player can be observed using key-value observing. AVPlayer serializes notifications of changes that occur dynamically during playback on a dispatch queue so that remote observers can be added and removed safely. By default, this queue is the main queue (see dispatch_get_main_queue). To ensure safe access to a player’s nonatomic properties while dynamic changes in playback state may be reported, one must serialize access with the receiver’s notification queue. In the common case, such serialization is naturally achieved by invoking AVPlayer’s various methods on the main thread or queue.

199 questions
3
votes
1 answer

App Icon won't show in music controls in app switcher

I'm writing an app that streams music and I'm having a ton of trouble setting the icon on the music control dock screen (when you double-click the home button and swipe to the left). All the documentation said to do something like this, but the icon…
AdamPro13
  • 7,232
  • 2
  • 30
  • 28
3
votes
2 answers

Detecting Current Item in AVQueuePlayer and Knowing when it Changes?

I currently have an AVQueuePlayer playing a few .aif files in sequence. As it goes through each audio I want to perform an action related to that specific sound (for example changing an imageview's uiimage). My problem is setting the NSNotification…
KingPolygon
  • 4,753
  • 7
  • 43
  • 72
3
votes
3 answers

AVQueuePlayer: Loop last item in a queue (and eliminate hiccup) or loop last seconds of a video

I am using AVQueuePlayer to play videos in sequence (although I have hiccups between plays). Now I'd like to: 1) Loop the last item in that sequence (not the full one). 2) In doing so, I'd also like to eliminate hiccups. Below is my code to play the…
Armand
  • 435
  • 1
  • 11
  • 23
3
votes
1 answer

AVQueuePlayer frustrations (buffer underrun handling)

I am having a hell of a time with AVQueuePlayer. Very simply, I am making it on an array of AVPlayerItems built with playerItemWithURL: and pointing to video assets on a server out on the Net. If I try to run this thing in the stimulator (sic) it…
Raconteur
  • 1,381
  • 1
  • 15
  • 29
3
votes
1 answer

Receiving RemoteControlEvents to First Tab when interacting in Second Tab in a TabBar Controlled iOS App

I am developing an iOS app with a tab bar controller. In the first tab, I placed an instance of AVQueuePlayer to start playing music from the web. I did all coding to allow play and pause events through remote control events. But I could able to…
3
votes
0 answers

Is it possible to play AVQueuePlayer in reverse order?

I am using AVQueuePlayer and it is working fine. My problem now is that I have a back button. If I press the button, previous video needs to be played. Is there any way for that? Thanks.
Raj A.N.T. Gounder
  • 490
  • 1
  • 6
  • 17
2
votes
2 answers

How to use Swift Concurrency to load AVQueuePlayer?

I have about 200 audio assets about 5 seconds each that are loaded into an AVQueuePlayer. I do this so it plays all the assets as one full song, but allowing the user to view or jump to a specific verse. The issue is the main thread gets locked when…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
2
votes
1 answer

How to start next a Song or recognized that a song is finished while playing with AVPlayer?

How can I start next song immediately with AVPlayer? I have collections of song selected from iPod Library in MPMediaItemCollection. Now how can i use AVPlayer for lists of songs to be played one by one??
DShah
  • 9,768
  • 11
  • 71
  • 127
2
votes
0 answers

Use AVQueuePlayer to loop a single playerItem

I am using below code to loop a single playerItem with the AVQueuePlayer: -(void) init { _soundPlayer = [ [ AVQueuePlayer alloc ] init ]; [ _soundPlayer addObserver: self forKeyPath: @"status" options: NSKeyValueObservingOptionNew context:…
GeFo.GT
  • 220
  • 2
  • 12
2
votes
1 answer

How can I detect that AVQueuePlayer finished playing?

I am playing back a queue of multiple audio files using AVQueuePlayer. I have not been able to detect that the last audio file finished playback. For AVAudioPlayer there is AVAudioPlayerDelegate with audioPlayerDidFinishPlaying, however that seems…
Björn
  • 111
  • 10
2
votes
1 answer

Is there a better way to watch for a key-value change?

I am wondering if the following is really the best way to know when a video is ready to play: Currently what I do is if currentMedia.playerQueue?.status.rawValue == 1 { I play, else (video has not loaded yet) I will show loading icon and then do the…
user11182243
2
votes
1 answer

Play video playlist and individual video clip from playlist in Loop, AVQueuePlayer iOS Swift

I am trying to play video playlist in loop and also play individual video clip from playlist in loop in AVQueuePlayer using AVPlayerItem, but i am unable to find the solution for same below is the code that i have tried so far General var player :…
Zღk
  • 854
  • 7
  • 25
2
votes
2 answers

AVQueuePlayer Current Item Changed

I am using QueuePlayer to play a list of songs and the songs are playing. My issue is that I am trying to track whenever the current item changes. I try adding an observer to the QueuePlayer, but this isn't working. The observing func isn't getting…
Iam Wayne
  • 561
  • 6
  • 26
2
votes
3 answers

Using AVPlayerLooper to loop through multiple videos

I've been trying to figure out how to loop over multiple videos with AVPlayerLooper, but their templateItem takes an argument of type AVPlayerItem and not [AVPlayerItem]. I'm currently using an AVQueuePlayer to display the video but I need to loop…
Harish
  • 1,374
  • 17
  • 39
2
votes
1 answer

MP3 Queue Player - Load in background thread?

I have an AVQueuePlayer that is used to play a list of MP3 songs from the internet (http). I need to also know which song is currently playing. The current problem is that loading the song causes a delay that blocks the main thread while waiting for…
Hope4You
  • 1,927
  • 4
  • 21
  • 45