Post

Replies

Boosts

Views

Activity

Reply to "AVQueuePlayer" has gaps when playing local music on iOS 17 real device.
This is the code. // ViewController.swift // AVQueueDemo // // Created by dingronghui on 2023/9/26. // import UIKit import AVFoundation class ViewController: UIViewController { var queuePlayer:AVQueuePlayer? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let audioFileURLs = [ Bundle.main.url(forResource: "song1", withExtension: "mp3")!, Bundle.main.url(forResource: "song2", withExtension: "mp3")!, Bundle.main.url(forResource: "song3", withExtension: "mp3")!, Bundle.main.url(forResource: "song3", withExtension: "mp3")!, Bundle.main.url(forResource: "song4", withExtension: "mp3")!, Bundle.main.url(forResource: "song4", withExtension: "mp3")!, Bundle.main.url(forResource: "song4", withExtension: "mp3")!, Bundle.main.url(forResource: "song4", withExtension: "mp3")!, Bundle.main.url(forResource: "song4", withExtension: "mp3")!, ] var playerItems: [AVPlayerItem] = [] for fileURL in audioFileURLs { let playerItem = AVPlayerItem(url: fileURL) playerItems.append(playerItem) } queuePlayer = AVQueuePlayer(items: playerItems) queuePlayer?.play() print("play") } }
Sep ’23