The AVFoundation framework provides both Objective-C and Swift interfaces for editing and playing audio-visual media in a Mac OSX or iOS application. Questions using this framework should include this tag.
Questions tagged [avfoundation]
6407 questions
3
votes
0 answers
What happens when you play an AVAsset from a remote url?
I'm confused on how an AVAsset gets and plays video from a remote url. I have looked at the documentation but am still a little bewildered by AVAssets, items, and players.
The main questions that I have are
Does AVKit automatically manage…

Nick
- 247
- 2
- 9
3
votes
1 answer
Is it possible to use both CIFilter and GPUImage filter on AVMutableComposition?
I have an AVMutableComposition with two tracks (one for video and audio each) that combines multiple videos (as segments: AVCompositionTrackSegment) for playback. I have to apply filters on selected videos and not on the whole composition (lets say…

Hadi
- 109
- 10
3
votes
0 answers
Domain=AVFoundationErrorDomain Code=-11814 Only Happens On iPhone6
I'ved got a strange error for AVCaptureDevice that only happens on iPhone6. I'ved tried it on iPhone6S and iPad and it works fine. The error is: Domain=AVFoundationErrorDomain Code=-11814
Here is the error print output:
Unable to obtain video device…

Axil
- 3,606
- 10
- 62
- 136
3
votes
1 answer
Capturing Video With SwiftUI and AVFoundation
I've seen some examples of how to do video play back, but haven't found any examples of capturing video with SwiftUI. Does anyone know how to do this? Or does anyone know of any tutorials of how to do this?

Taylor Simpson
- 940
- 1
- 10
- 27
3
votes
1 answer
Apple's AVCamera Night Mode
I've been building a camera app using the AVFoundation and wanted to add NightMode support to it.
Apple features a stunning implementation for this, more about it can be read here: https://www.macrumors.com/guide/night-mode/
Now, the only…

MartinJK
- 78
- 1
- 6
3
votes
2 answers
Record and playback using bluetooth earphone's mic & internal speaker in Swift
I currently have a pair of Bluetooth earbuds. From this post, I have the code needed to retrieve audio from the Bluetooth earbuds' microphone and then playback the audio through the Bluetooth earbuds. However, I want to modify the code so that I can…

Nikhil Sridhar
- 1,670
- 5
- 20
- 39
3
votes
1 answer
What is the best way to draw custom timestamp text over a video with AVFoundation?
I've got an AVMutableVideoComposition that I'm exporting with AVAssetExportSession and I'm trying to overlay a custom timestamp that updates every second on top of it. Should I be using AVAssetWriter, multiple CALayers with CABasicAnimations, or…

RealCasually
- 3,593
- 3
- 27
- 34
3
votes
0 answers
AVAudioSession .playAndRecord low volume issue with AirPods
I have a ViewController that records a users audio and then plays it back. I am using the .playAndRecord category of the AVAudioSession to handle the recording and playback. I have the options
[.allowBluetooth, .defaultToSpeaker,…

user291813
- 61
- 1
3
votes
1 answer
AVPlayer video from temporary directory after recording stops playing after few seconds
I have a custom camera, which can record videos and take photos. The problem is after recording and pushing viewController with recorded video preview, video stops playing after few seconds.
So the flow is:
Custom camera opened;
I've recorded a…

Rodion Kuskov
- 146
- 1
- 5
3
votes
0 answers
Play local sound on watchOS button tap
I'm new to swift development and building a simple app for the apple watch. I'd like a short sound to play when a button is tapped. Is this possible?
From what I understand the best way to do this is with AVFoundation and AVAudioPlayer. There seem…

Threee
- 31
- 1
3
votes
1 answer
Why is AVPlayer initial loading so slow?
I've developed an application in iOS that plays a list of videos. Data structure is that I send a request to my own server and get the URL for all the videos at once after I create the views of my viewController.
After that, I start playing the…

Mahan Mirshafa
- 61
- 6
3
votes
1 answer
How to trigger events or callback at a specific point in an Audio Track?
I want to play an Audio file (A wav file for example) and at specific locations of the track I want to fire events or triggers that will control an external device.
My idea for now is to generate a MIDI track that plays in sync with the Audio Track…

Sarang Borude
- 329
- 1
- 12
3
votes
0 answers
Very quiet audio samples from AVCaptureMultiCamSession after disconnecting Lightning earphones
I've encountered an issue with some AVFoundation video and audio capture code that only happens when changing AVCaptureSession() to AVCaptureMultiCamSession() with no other code changes.
It only reproduces intermittently, and the steps are:
Boot…

Richard Viney
- 957
- 16
- 31
3
votes
0 answers
Properly frame CALayers over a video swift
I have an app where you can move images and text on a video kinda like Snapchat and Instagram stories. I use AVMutableVideoComposition to add the images and text to the video as CALayers. But when I save the video, the position and size of the…

James Meli
- 31
- 2
3
votes
1 answer
How to encode self-delimited opus in iOS
I can record opus using AVAudioRecorder as following:
let opusRecordingSettings = [AVFormatIDKey: kAudioFormatOpus,
AVSampleRateKey: 16000.0,
AVNumberOfChannelsKey: 1] as [String: Any]
…

MD TAREQ HASSAN
- 1,188
- 20
- 46