I am using AVFoundation to capture video from the built-in camera to an AVFragmentedAsset on disk.
On a separate app I have an AVFragmentedAssetMinder that watches for changes in the asset duration and updates the AVPlayerItem of the AVPlayer.
The code doing the update is:
The problem with that approach is that I get flashes when updating, which is very annoying.
Is there any other way to update the playing AVPlayerItem?
I am using the latest macOS and Xcode.
On a separate app I have an AVFragmentedAssetMinder that watches for changes in the asset duration and updates the AVPlayerItem of the AVPlayer.
The code doing the update is:
Code Block CMTime oldTime = self.player.currentItem.currentTime; float oldRate = self.player.rate; self.player.rate = 0.0; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset: fragAsset]; [self.player replaceCurrentItemWithPlayerItem: playerItem]; [self.player seekToTime: oldTime toleranceBefore: kCMTimeZero toleranceAfter: kCMTimeZero]; self.player.rate = oldRate;
The problem with that approach is that I get flashes when updating, which is very annoying.
Is there any other way to update the playing AVPlayerItem?
I am using the latest macOS and Xcode.