Same issue here. I'm using Xcode 14.0(14A309) release. It worked fine with physical devices. But it failed in watch simulator and iPhone simulator.
Post
Replies
Boosts
Views
Activity
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")
}
}
macOS 14 , Xcode 15 still has the same issue. That make me crazy. Now I can only develop on iOS device.
Same issue with Xcode Version 15.1 beta 3 (15C5059c)