iOS Development
swift – Stay video streaming challenge: Clean display on iOS 17 with AVMutablePlayer/AVPlayer

I am encountering a difficulty with stay video streaming on iOS 17 utilizing AVMutablePlayer. I am using a wss URL to stream movies by capturing knowledge in chunks (e.g., 5 seconds) and taking part in it. Upon completion of the 5-second section, I load one other 5 seconds utilizing self.participant.replaceCurrentItem(with: nextPlayerItem).
Regardless of listening to occasions through self.participant.currentItem?.observe, the performance seems to be working properly on iOS 16 however constantly shows a clean video on iOS 17.
/**
Performs subsequent fragment set.
*/
non-public func playNext() {
let nextSet = self.dataCollector.getNextItem(size: self.configuration.frameDelay)
if nextSet.depend == self.configuration.frameDelay {
var playerTime:Int = self.participant.currentItem != nil ? Int(CMTimeGetSeconds(participant.currentTime())) : 0
var allData = Information()
allData.appendAll(dataSet: dataCollector.getFileType())
nextSet.forEach { (knowledge) in
playerTime += 1
allData.append(knowledge.getFragmentData())
self.currentFragmentTimes.updateValue(knowledge.getFragmentTime(), forKey: playerTime)
}
if(allData.depend > 0) {
self.participant.replaceCurrentItem(with: AVPlayerItem(asset: AVMutableMovie(knowledge:allData, choices: nil)))
self.playerInitializedTime = nil
self.participant.play()
}
}
}
I attempted to Exchange the AvMutablePlayer with AVPlayer it appears working however there’s flickering after every alternative of information buffer.
Credit: www.ismmailgsm.com