Post

Replies

Boosts

Views

Activity

AVCaptureSession playback audio through headphones
I am using a RemoteIO unit along with AVCaptureSession to playback samples received from builtin or external microphone. The problem is AVCaptureSession freezes for few seconds in the startup if RemoteIO is simultaneously initialised. I want to know if there is a better and faster way to loopback samples received through AVCaptureAudioDataOutput to headphones? There is one sample code by Apple called AVCaptureToAudioUnit that uses AUGraph but it's pretty old and does not build anymore.
1
0
1k
Mar ’21
AVFoundation variable frame rate output
Does AVFoundation exports only have fixed frame rate output in presets other than passthrough? In other words, do AVAssetExportSession & AVAssetWriter/Reader output/input ever output variable frame rate video? If input video was 29.43 fps, I see output video is always 30 fps when I render using the above two interfaces. Looks like AVF applies a default video composition while rendering.
2
0
1.5k
Dec ’20
AVFoundation variable to constant frame rate question
I want to know how AVFoundation handles variable frame rate compositions. I create an AVMutableComposition from a bunch of videos (most have variable frame rate as iPhone camera never shoots videos at constant frame rate), then assign an AVVideoComposition with a custom defined frameDuration. Then if I playback this composition or render it using AVAssetExportSession/AVAssetWriter, will the output always be a constant frame rate video and will AVPlayer play it as constant frame rate (perhaps by dropping frames)? Also how do I specify frame rates such as 29.97 or 23.98 for rendering and playback?
3
0
1.4k
Nov ’20
UICollectionView compositional layout with variable length items
Is it possible to have horizontal scrolling 2D UICollectionView with cells which are variable in width but same in height without subclassing UICollectionViewLayout? Some items may be even more than the size of collectionView frame and the size of any two items is not the same in general and the gap between successive items may also be variable. WWDC videos say compositional layout can achieve anything we can imagine, not sure how to do this.
2
0
1.3k
Oct ’20
AVFoundation methods for smooth playback
Dear Apple Engineers, There seems to incomplete documentation about new AVFoundation methods introduced in iOS 14  @available(iOS 13.0, *)   optional func anticipateRendering(using renderHint: AVVideoCompositionRenderHint) @available(iOS 13.0, *) optional func prerollForRendering(using renderHint: AVVideoCompositionRenderHint) How do we exactly use these methods, when are they exactly called, how much time can we take to load texture from memory in these methods, what is the correct usage...can anyone explain?
1
0
551
Oct ’20
PHPickerViewController super buggy UI in multi-select mode
When in multi-selction mode (selectionLimit = 0), the PHPickerViewController almost everytime detects a scroll or swipe gesture as touch and selects the entire row of photos. It is so buggy that the user does not know which photos he inadvertently selected! While it is easy to use third party frameworks for this job, the biggest advantage of this picker is it doesn't need complex Photo Library permissions that are confusing users on iOS 14. Are Apple Engineers even aware of this serious bug that makes the picker almost useless for multi-selection mode?
2
0
1.3k
Oct ’20
PHPickerViewController load videos via PHAsset without permission
PHPickerViewController allows access to copies of photo library assets as well as returning PHAssets in the results. To get PHAssets instead of file copies, I do: let photolibrary = PHPhotoLibrary.shared() var configuration = PHPickerConfiguration(photoLibrary: photolibrary) configuration.filter = .videos configuration.selectionLimit = 0 let picker = PHPickerViewController(configuration: configuration) picker.delegate = self self.present(picker, animated: true, completion: nil) And then, 			func picker(_ picker: PHPickerViewController,		 didFinishPicking results: [PHPickerResult]) { picker.dismiss(animated: true) { let identifiers:[String] = results.compactMap(\.assetIdentifier) let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: identifiers, options: nil) NSLog("\(identifiers), \(fetchResult)") } } But the problem is once the photo picker is dismissed, it prompts for Photo Library access which is confusing and since the user anyways implicitly gave access to the selected assets in PHPickerViewController, PHPhotoLibrary should load those assets directly. Is there anyway to avoid the Photo library permission? The other option to copy the assets in the app is a waste of space for editing applications.
0
0
1.1k
Oct ’20
Inserting slowMo AVComposition into AVMutableComposition
PHPhotoLibrary gives an AVComposition rather than an AVURLAsset for a video recorded in SlowMo. I want to insert slowMo videos into another AVMutableComposition, so this means I need to insert this AVComposition into AVMutableComposition which is my editing timeline. The hack I used before was to load the tracks and segments and find the mediaURL of asset. AVCompositionTrack *track = [avAsset tracks][0]; AVCompositionTrackSegment *segment = track.segments[0]; mediaURL = [segment sourceURL]; Once I had mediaURL, I was able to create a new AVAsset that could be inserted into AVMutableComposition. But I wonder if there is a cleaner approach that allows the slowMo video composition to be directly inserted into the timeline AVMutableComposition?
0
0
413
Oct ’20