Questions tagged [avfoundation]

1

votes
1

answer
476

Views

Is there a way to convert CMSampleBuffer into CVImageBuffer?

I am using a framework (MoodMe) to detect faces on iPhone camera and I need to pass a image or frame to MoodMe instance. I have converted the camera output into a UIImage but the framework does not detect any face. (I think it) So I want to pass to my buffer to framework, it is asking me for a CVIm...
Igor Custodio
1

votes
0

answer
179

Views

Error handling in AVAssetResourceLoaderDelegate

What is the recommended way for handling error in AVAssetResourceLoaderDelegate? specifically network requests in shouldWaitForLoadingOfRequestedResource / shouldWaitForRenewalOfRequestedResource? However, there is no way for my app to know something went wrong until I start playing the video. I tri...
noc
1

votes
0

answer
65

Views

resume() does not work if playback was paused for some time in lockscreen

The AVPlayer notify AVPlayerItemFailedToPlayToEndTimeNotification when playing the stream . i use the below code and print the error details : NSError *error = notification.userInfo[AVPlayerItemFailedToPlayToEndTimeErrorKey]; NSLog(@'itemFailedToPlayMPMovieFinishReasonPlaybackError=%@' ,error); Err...
Prashanth Patil
1

votes
0

answer
72

Views

Using AVAudioUnitSampler as Audio Unit v3 Extension – distorted sound

I have a music app that uses AVAudioUnitSampler to generate sounds. I'm trying to make an Audio Unit Extension, so my app will be able to be used in a host apps like Garage Band. I implement AUViewController and return underlying AVAudioUnitSampler's audioUnit in createAudioUnit(with:) method like t...
Pavel Alexeev
1

votes
1

answer
32

Views

How to pause background music in game using AVAudioPlayer for multiple scenes

So I have a background music looping in the background in my GameViewController. The pause music button is available in the GameScene where a user can mute or unmute the game music. I have two global variables: var muteButton = SKSpriteNode(imageNamed: 'pause') var mute: Bool = false Inside my Game...
yushi
1

votes
0

answer
108

Views

Is there any way to record video with AVCaptureMovieFileOutput and change cameras?

I want to record a video with AVFoundation and AVCaptureSession using AVCaptureMovieFileOutput. I want to record a video like Instagram Stories, so I want to change the camera while the video is recording. The problem with AVCaptureMovieFileOutput is that when I change the captureDevice in the capt...
croigsalvador
1

votes
0

answer
154

Views

can I set different aspect ratio when capturing LivePhoto images?

I am using Swifts 4 SDK for taking live photos in my app. Is it possible to take live photo images in different Aspect Ratios? I want to support 4:3, 16:9 and 1:1. I will add some code for how I take my photo, I couldn't realize how to change the aspect ratio, and I understand it may not be a trivia...
Eyzuky
1

votes
0

answer
282

Views

AVPlayer with downloaded content doesn't work but streaming content does

I am trying to (1) download a piece of audio from a link, (2) add that newly-downloaded audio to an AVPlayer and (3) play it. Something is going wrong at step (3) and I'm looking for any guidance. Here's the code, including my alamofire and download functions, as I fear something may be going wrong...
RMoore
1

votes
1

answer
190

Views

Disable “drag” function for AVPlayer

My app plays videos for toddlers. It uses AVPlayer. In a recent update Apple has implemented the function of dragging the video view to close it. This doesn't work well with toddlers touching the screen all the time. Does anyone know how to disable this function? (the code is in Objective-C)
Emily94
1

votes
0

answer
54

Views

Audio Missing when Adding Text on pixelBuffer

I am trying to add text overlay on video, When recording in iPhone 5s or lower devices in High quality and writing text on that then after 1 or 2 seconds audio goes missing, But this doesn't happen on larger devices like iPhone 6/6s. If i remove that text writer method then it works properly on all...
Stark
1

votes
0

answer
227

Views

crossfading effect with AVPlayer

I want to create crossfading effect with two AVPlayer, one player for current track and other for nextTrack. where player one is my central player(tracking remote control event and progress), on player one did finish playing event second player become central player. Thanx!
SPatel
1

votes
0

answer
74

Views

AVAudioSession: how to set buffering time for audio and video

I am trying to record voice while playing a background music in iOS, Swift. Everything works well but I feel a small delay in the recorded audio. I think it is because of the buffering time. I tried to find a solution to reduce the buffering time as much as possible. Configuring Device Hardware /...
Colin Witkamp
1

votes
0

answer
150

Views

AVAsset Unsupported URL

I am trying to load a video downloaded from the internet stored in the Documents directory. However when I try I keep getting: error: Error Domain=NSURLErrorDomain Code=-1002 'unsupported URL' let dstURL = URL(string: dstPath)! let asset = AVAsset(url: dstURL) asset.loadValuesAsynchronously(forKeys...
cluelessatmaths
1

votes
0

answer
15

Views

unable get audio or video running status in mac using osx app

Currently I am facing a problem in getting the status of audio or video playing in mac using swift. I want status alone whether any application is using audio or video currently on mac.
Siva Prasad
1

votes
0

answer
248

Views

How to test background audio in iOS UI Tests

I want to test various aspects of background music and speech in iOS UI Testing; is background music playing? did music change on new scene? does music mute on interruptions from phone call, FaceTime etc? is speech uttered when required ? Can't seem to find any api documentation or tutorials that sh...
MP Droid
1

votes
1

answer
319

Views

iPhone App - is this possible to Capture and Record Video from External Camera

I have one requirement in my iOS app. 1:- Can we use external camera to capture and Record Videos in my App. 2:- I am sure its not possible connecting external camera through USB without MFi License. 3:- So i want to go for Wifi option. Please Comments.Any Library and reference would be really helpf...
Er. Maheshwari
1

votes
0

answer
151

Views

AVPlayerItem.seek(to: cmTime, toleranceBefore:, toleranceAfter:) to get specific video frames?

This week I've had a miserable time trying to get video frames from a Quicktime movie and display them in a Metal texture. It has been far harder than I anticipated. I just want to show frame 0, and then step back and forth through the video frames with the arrow keys. After failing with the AVPla...
bsabiston
1

votes
0

answer
242

Views

Swift AVFoundation stitching multiple videos together and keep preferred transform

I'm trying to stitch multiple video clips together. If I stitch each AVAsset in one AVMutableCompositionTrack it works but loses the transformation on the first asset by appending another one with enabled mirroring mode for front facing camera. Can I somehow use multiple AVMutableCompositionTrack of...
fsoc
1

votes
0

answer
129

Views

After taking a photo 4 times from the front camera the app crashes

When I flip the camera from back to front and tap to take a picture four times the app crashes with the following error: [AVCapturePhotoOutput capturePhotoWithSettings:delegate:] No active and enabled video connection' Below are the two pieces of code that I believe are strongly related to the prob...
TheRedCamaro3.0 3.0
1

votes
0

answer
262

Views

AVAudioEngine realtime frequency modulation

I would like to modify the incoming signal in realtime and send it to the iOS devices speakers. I've read that the AVAudioEngine can be used for such tasks. But can't find documentation or examples for what I would like to achieve. For testing purposes I've done: audioEngine = AVAudioEngine() let un...
Leo
1

votes
1

answer
199

Views

How does the CMTime created when use CMSampleBufferGetPresentationTimeStamp in iOS? Is it related to systemUptime?

When I use CMSampleBufferGetPresentationTimeStamp to get the video frame's presentation timestamp: CMTime pts = CMSampleBufferGetPresentationTimeStamp(sampleBuffer); NSLog(@'pts: %+.3f', CMTimeGetSeconds(pts)); the timestamp printed is not based from 0, but almost equal to [[NSProcessInfo processInf...
yi.zhou
1

votes
1

answer
373

Views

setExposureModeCustom crahes in iPhone X swift 4

I have an app, which will access Camera's Exposure mode settings for changing the Shutter Speed of the Camera with Custom values. And it's works as expected in maximum devices, except iPhone X. Below is the code which i am using, do { try captureDevice.lockForConfiguration() captureDevice.setExposur...
Austin Michael
1

votes
0

answer
52

Views

Why Some portion of Camera image is outside its view bound?

I've set up a UIView where camera will be shown. Everything works fine, but when I set the videoGravity of the AVCaptureVideoPreviewLayer to AVLayerVideoGravityResizeAspectFill, it seems that the some top & bottom parts which are outside of the camera view frame are also visible in the clicked photo...
Rajendra Nayak
1

votes
0

answer
282

Views

How to play Vimeo Video Url in iOS app

I am not able to play vimeo video url using AVPlayer in swift 4 and below code for I am using : let player = AVPlayer(url: URL(string: self.trailerVideoURL)!) let playerController = AVPlayerViewController() playerController.player = player present(playerController, animated: true) { player.play() }
iHarshad
1

votes
0

answer
112

Views

Server doesn't receive audio file url although the response is succes

So I'm trying to upload to the server my audio file. From the server I need to fulfil this things : messages/create -> route type: POST mandatory: message_token // message_token must be generated unique message // type FILE => message_token + message_id + owner_id + .amr duration // example: 4000,...
Mohamed Lee
1

votes
0

answer
1.1k

Views

Is it possible to add filter effects into a Video file in Swift3 iOS

I am developing a video editing kind of application in Swift3 language Where I am merging multiple videos.. setting custom background sound, WaterMark and Fade In & Fade Out effect to the final merged video using AVFoundation framework. Now my problem is I need to add filter effects like Warm, cold...
Anand Gautam
1

votes
1

answer
24

Views

Is it possible to sync SKEmitterNodes with a Video using AVSynchronizedLayer?

I want to synchronize the movement of a SKEmitterNode with a video using AVSynchronizedLayer. So as the video seeks forward, seeks backward or just plays, the SKEmitterNode moves accordingly. I know this can be done easily with CALayers, but can it be done with SKEmitterNode(s)? I tried to apply SKA...
Shashank Agarwal
1

votes
0

answer
150

Views

AVFoundation video recording does not return camera intrinsics if recording at 240fps

I'm using the AVCaptureVideoDataOutputSampleBufferDelegate captureOutput:didOutputSampleBuffer:fromConnection: delegate method to capture video buffers and then write out to file using an AVAssetWriter. When configuring the recording session I'm checking for camera intrinsics delivery support and en...
Robert Turrall
1

votes
1

answer
122

Views

H.264 Decoder not working properly?

I've gone over the code for this decoder for elementary h.264 bitstreams a hundred times, tweaking things along the way, with no luck. When I send the output CMSampleBuffers to an AVSampleBufferDisplayLayer, they don't appear, presumably because there's something wrong with how I'm decoding them. I...
Philip S
1

votes
0

answer
74

Views

How do I meter external volume using a microphone (Swift Playgrouds)

i was just wondering if there is a method to meter audio in swift playgrounds using microphone input. Ive tried playing around with AVFoundation however have not yet found a method to meter mic input in dB, only how to record and store audio. Does anyone have any solutions.
swiftuser765
1

votes
1

answer
285

Views

Strange happened when Scanning EAN13 Barcode by using xcode AVFoundation

I wrote a small ios app to scan ean13 barcode, there is a strange problem regarding the sensitivity, it can read 100% of those ean13 barcodes from the products for which the barcodes are well printed on the product by the manufacturer, for example, CD box, medicine box, chocolate, butter, tea box......
Kevin Xu
1

votes
0

answer
134

Views

How to achieve smooth edges for filtering with AVDepthData

I am trying to imitate the Portrait mode Apple created in their camera app. At the moment I get a working result, but not satisfying, as the object that I am trying to filter out has the filter going on to the edges instead of having an accurate line surrounding it (images attached). I used this tut...
Eyzuky
1

votes
1

answer
71

Views

Camera issue when setting AVCaptureDevice to 1 fps

I have an issue with the AVFoundation framework. Whenever I set the FPS of the camera to 1, after a while, my FaceTime HD camera LED starts blinking with one second intervals. Also, no calls to the delegate (sample buffer delegate) are called anymore. The issue does not occur when I set it to 2 FPS...
Kukiwon
1

votes
0

answer
172

Views

AVCaptureSession is not releasing AVCaptureDevice without closing application for usage in DeckLink SDK

When using the AVCaptureSession to connect a AVCaptureDevice the device get's locked by the application and can not be released. The only way the device is truly released is after restarting the app. We are using AVCaptureSession for previewing the camera and audio level meters. But once we start th...
Jory de Kort
0

votes
1

answer
147

Views

Is there a way to intercept audio output from within your app to display back an audio visualizer on iOS?

We're currently using Linphone library to make VOIP calls and they have their own solution for audio playback. However, we would like to display a visualizer for the audio that Linphone is outputting from within our own app. Is there a way that we can intercept this data (maybe through sample buffer...
Jessica Lee
1

votes
1

answer
82

Views

Invalid keys -> ProfileLevel in a AVCaptureVideoDataOutput (macOS)

I'm adding keys to my AVCaptureVideoDataOutput. when adding the key AVVideoProfileLevelKey the system throws me -> Failed to set (contentViewController) user defined inspected property on (NSWindow): *** +[AVVideoOutputSettings videoOutputSettingsWithVideoSettingsDictionary:] Output settings dictio...
Anders Cedronius
1

votes
0

answer
84

Views

AvFoundation's AvPlayerItem timebase notifications fire 4 to 8 times per second

I'm trying to monitor the playback rate of an AvPlayerItem. According to the timebase docs (https://developer.apple.com/documentation/avfoundation/avplayeritem/1387605-timebase), the best way to do this is by subscribing to the kCMTimebaseNotification_EffectiveRateChanged notification. So I set up t...
Dries Cleymans
1

votes
1

answer
276

Views

Play audio and vibration simultaneously on ios using swift

Is there any way to play audio file and vibrate iphone when audio is started and stop vibrating when audio stops playing? currently this code is working but it plays audio and when audio stops then it vibrates the phone, I want both (audio and vibration) play together. var alertSoundEffect: AVAudioP...
Hafiz Shoaib Awan
1

votes
0

answer
172

Views

AVFoundation add support for Code39Mod10 and Codabar barcodes

I've implemented an QR-/Barcode reader in Swift using AVFoundation framework. For supported types I added nearly all types available: let supportedCodeTypes = [AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, AVMetadataObjectTypeCode93Code, AVMetadat...
mahega
1

votes
1

answer
73

Views

The audio file on iOS that is being played on Android does not hear me. Only sound that's not good

I'm working on a recorder app on iOS and a friend of mine he's doing it on Android, but when he want's to play my url sound which I send to server and which also works fine for me when I play it .. he hears a lot of noise and not my actual recorder. func setupRecorder() { let myID = userDefaults.val...
Mohamed Lee

View additional questions