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
0
votes
0 answers

How to play many tracks via AVQueuePlayer in a row

That is my first question and I did not find any answer about this issue. I have a JSON with more than 2 thousand tracks on my server. And when I make an array of AVPlayerItem to insert into the AVQueuePlayer, It takes a lot of time. I want to load…
0
votes
0 answers

AVQueuePlayer duration accurate playback

I’m trying to achieve duration accurate 24h playback with AVQueuePlayer but keep getting longer total times. AVQueuePlayer items are inserted in async task. Perceptually, playback is gapless but total duration extends by between 1 minute and 1.5…
pnbv
  • 1
  • 1
0
votes
2 answers

Observer on AvPlayer works only on the first item

I've a SwiftUi app with a View in which I want to play a sequence of videos from remote. I've used an AVQueuePlayer. At the end of any reproduction I want to play the next video after a defined pause from an array of pauses. This code work only…
Lamoichenzio
  • 75
  • 1
  • 1
  • 7
0
votes
1 answer

How to set NowPlaying properties with a AVQueuePlayer in Swift?

I have an AVQueuePlayer that gets songs from a Firebase Storage via their URL and plays them in sequence. static func playQueue() { for song in songs { guard let url = song.url else { return } lofiSongs.append(AVPlayerItem(url:…
CristianMoisei
  • 2,071
  • 2
  • 22
  • 28
0
votes
0 answers

`Video will black when device goes from background to foreground in AVPlayer Swift IOS`

I'm trying to keep the video in AVPlayer playing when app goes from background to foreground, but it shown blank. I use Swift. I've found a lot of examples, but nothing works. configurePlayer function is I've create for that but I don't know…
0
votes
1 answer

How to play songs with AVQueuePlayer?

I can't seem to find understandable documentation or examples for AVQueuePlayer. I am currently trying to change my AudioManager so I can play an album with multiple or just a single song. I would appreciate any code examples or good articles about…
AdamLeet
  • 127
  • 8
0
votes
1 answer

VideoPlayer/AVQueuePlayer does not seek to time

The AVQueuePlayer does not seek to the given time. Video always starts playing at the beginning. Using the default controls, I can seek manually to a desired point. I am using a m3u8 HLS stream. import SwiftUI import AVKit struct ChannelPlayerView:…
jussi
  • 2,166
  • 1
  • 22
  • 37
0
votes
2 answers

Play sounds with AVQueuePlayer even if iPhone is muted

I'm using AVQueuePlayer to play sounds (a little App for kids to listen illustrated books), but if iPhone is muted the audio isn't audible. There is a way to force audio even if iPhone is muted? I think to YouTube where audio is audible or Instagram…
Fry
  • 6,235
  • 8
  • 54
  • 93
0
votes
1 answer

No playback from AVPlayer after app returns from a suspended state

I have an AVQueuePlayer which is working as expected except for after returning from a suspended state. It's playing a HLS audio stream. The logic for my pause button is very simple isPlaying ? player?.play() : player?.pause() I've checked the…
User4
  • 1,330
  • 2
  • 15
  • 18
0
votes
1 answer

How to show sheet view after last item finished playing in AVQueuePlayer?

I am playing an array of videos using AVQueuePlayer, but after the last video I see AVQueuePlayer trying to play the next video when there isn't any left. And what I'm trying to do is to toggle a boolean after the last item finished playing to show…
NYBSZ37
  • 61
  • 7
0
votes
0 answers

How to play AVQueuePlayer in loop

I have a couple of videos that need to be played in a loop. let player = AVQueuePlayer(items: items) let playerLayer = AVPlayerLayer(player: player) playerLayer.frame = view.bounds playerLayer.videoGravity = .resizeAspectFill …
Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
0
votes
1 answer

AVQueuePlayer won’t stop playing

If a person presses the button 10 times, then they will hear 10 different lists of songs being played continuously. I want it to be that if a person presses 10 times, they will only be listening to one list of songs. I'm basically trying to create a…
0
votes
1 answer

SwiftUI AVQueuePlayer not updating playerItem

I am trying to show a looping video then allow the user to tap a button to show the next or previous looping video. Why doesn't @Binding update this? and what is the right/best way to do this? I am using a UIViewRepresentable. Here is my…
Dan
  • 543
  • 2
  • 13
0
votes
1 answer

AVFoundation How to loop an audio for a specific duration?

I want to loop a specific audio for a given duration. For example; 10 sec. audio file. intended loop duration: 7 min. During this loop, I have to observe the remaining time of total of the loop iterations. I tried the AVQueuePlayer and…
0
votes
1 answer

How to show simple text depending on the mp3 file?

My app plays mp3 files in sequence. I finally managed to play mp3 files in sequence. Additionally, I need to show simple text on my app depending on the mp3 file. For example, when 0.mp3 file is played, textlabel.text shows "hello" from…
mjk
  • 21
  • 1
  • 6