No AVAssetDurationDidChangeNotification send from macOS to iOS

We have a macOS app that captures video & audio from local cameras (built-in and USB connected). It saves the captured footage in an AVFragmentedAsset on the local disk. While recording, the user can open and work with the saved AVFragmentedAsset from inside the app, and its duration is automatically updated as new frames are added to the file on disk.

We were also able to open and view the asset from a shared directory on the recording Mac using a simple iOS app with its duration updated regularly. This was some months ago.

Now I am trying to do the same on the latest versions of iOS and macOS and it does not work. Using the Xcode debugger I can see that the iOS app does not receive the AVAssetDurationDidChangeNotification.

The asset on iOS is created with:

self.capturedMovieAsset = [[AVFragmentedAsset alloc] initWithURL: fileURL
options: @{ AVURLAssetPreferPreciseDurationAndTimingKey : @(YES) }];

The AVFragmentedAssetMinder is created after the asset's duration and hasFragments properties are loaded:

self.fragmentedAssetMinder = [[AVFragmentedAssetMinder alloc] initWithAsset: self.capturedMovieAsset mindingInterval: 5];

and the observer is added after that:

[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(fragmentedDurationChanged:) name: AVAssetDurationDidChangeNotification object: self.capturedMovieAsset];

The fragmentedDurationChanged: callback is never called on iOS.

I am currently using a MacBook Pro (15-inch, 2019) and an iPhone 12 Pro, running the latest release versions of iOS 16.0.3, macOS 12.6 and Xcode 14.0.1. The strange thing is that it used to work, albeit on iOS 15.x.

Is there a setting in smb or AVFoundation, that I can use to make this work?

Replies

Just an update: tested sharing from macOS 13 to iOS 16.1 and 15.7 with the same (no) results.

  • Submitted as FB11740980 (Cannot get AVAssetDurationDidChangeNotification send from macOS to iOS) but no resolution yet.

Add a Comment

I am also facing the same issue in iOS 17 with XCode 15.0.1. Were you able to get the AVAssetDurationDidChangeNotification on iOS?