Receiving eventMetadata from AVPlayerItemMetadataOutput stops responding on iOS18 only

Case-ID: 9391388

Our application uses timed Metadata as part of a rating control system. We noticed a problem in production and diagnosis shows that we stop receiving timed Metadata on iOS18 only

Our live streams are primed with metadata at least once per second but we are seeing extended gaps in receiving this content, in excess of 10 minutes.

We have also observed that this happens more as the player climbs the bitrate ladder, and doesn't happen if we cap to a low resolution i.e. a preferredMaximumResolution of 768x432.

Furthermore, if we throttle network conditions after we stop receiving metadata the we start receiving them again.

Following is a simple example that demonstrates the above behaviour, unfortunately I cannot share the live stream endpoint which is primed with metadata publicly, but can provide privately to Apple to reproduce the problem.


import UIKit
import AVKit

class ViewController: UIViewController, AVPlayerItemMetadataOutputPushDelegate {
    var player: AVPlayer?
    var itemMetadataOutput: AVPlayerItemMetadataOutput?
        
    override func viewDidAppear(_ animated: Bool) {
        guard let url = URL(string: "endpoint redacted") else {
            return
        }
        
        let player = AVPlayer(url: url)
        let controller = AVPlayerViewController()
        controller.player = player
        self.player = player
        
        present(controller, animated: true) {
            player.play()
            let currentItem = player.currentItem
            let itemMetadataOutput = AVPlayerItemMetadataOutput(identifiers: nil)
            self.itemMetadataOutput = itemMetadataOutput
            self.itemMetadataOutput?.setDelegate(self, queue: .main)
            currentItem?.add(itemMetadataOutput)
        }
    }
    
    public func metadataOutput(_ output: AVPlayerItemMetadataOutput,
                               didOutputTimedMetadataGroups groups: [AVTimedMetadataGroup],
                               from track: AVPlayerItemTrack?) {
        print("received metadata \(Date())")
    }
}
Receiving eventMetadata from AVPlayerItemMetadataOutput stops responding on iOS18 only
 
 
Q