avfoundation

Can my app be notified when another application starts/stops playing audio?

徘徊边缘 提交于 2019-12-13 16:26:24
问题 My iOS game has music and sound effects. I'd like to let users listen to their own music in place of the game's background music. A simple solution is to add a new menu item that disables the game's background music. However, I'd like to avoid creating a new menu item unless I can be convinced that this approach is worse for the user. My current approach: Set the audio session category to AVAudioSessionCategoryAmbient to allow mixing of game audio with iPod (or other music app) playback. In

Sound for Scene Transition, that doesn't stutter

杀马特。学长 韩版系。学妹 提交于 2019-12-13 15:48:47
问题 In SpriteKit (for those unfamiliar with it) there's a way to load and unload scenes, and a transition (visual) between them. I'm trying to make a sound play between scenes, as they transition... that doesn't stutter. So far, all the ways I've tried either create no sound, or the sound stutters, even using a sound manager, like this: import AVFoundation import SpriteKit open class SoundManager { static let soundStart = SKAction.playSoundFileNamed("ActionBeep_AP1.7", waitForCompletion: true)

How to avoid shutter sound struggling during capturing still image with `AVCaptureStillImageOutput`?

99封情书 提交于 2019-12-13 07:24:53
问题 I'm capturing image with AVCaptureStillImageOutput . All done fine. But I tried to navigate into new view controller, the shuttering sound struggles. Any workaround to avoid this? 回答1: Try to set output to AVCaptureVideoDataOutput (not AVCaptureStillImageOutput) and capture single frame from the video output. 来源: https://stackoverflow.com/questions/5349667/how-to-avoid-shutter-sound-struggling-during-capturing-still-image-with-avcaptu

Reading multiple video files using “AVAssetReaderTrackOutput” simultaneously freaks out OSX

我的未来我决定 提交于 2019-12-13 05:43:33
问题 I need to read all frames from three short video files (3min each) into the memory ( NSArray of CMSampleBufferRef ). I used typical approach with AVAsset , AVAssetReader , AVAssetReaderTrackOutput and calling copyNextSampleBuffer in while loop. It works okay for 1 file - all 3570 samples are loaded. If I try to load two more files (sequentially) - second loads only 1820 samples, third loads 0 with error -1189 (Cannot Open). And I tried both main thread, background thread and designated thread

AVAsserexportsession failed randomly

孤街醉人 提交于 2019-12-13 05:09:44
问题 I am creating the video from a set of images with AVAssetwriter and AVAssetExportSession and successfully getting the video and save it to the documents. But randomly the video exporting failed and it shows An Unknown error occured with error code -11800. ExportSessionError: -11800 adn userinfo{ NSLocalizedDescription = "The operation could not be completed"; NSLocalizedFailureReason = "An unknown error occurred (-12124)"; NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-12124 \

Confused on what object actually contains the captured image when using AVFoundation

て烟熏妆下的殇ゞ 提交于 2019-12-13 04:43:31
问题 I have a photo taking app that is using AVFoundation. So far everything works perfectly. However, the one thing that is really confusing me is, what object is the captured image actually contained in? I have been NSLogging all of the objects and some of their properties and I still can't figure out where the captured image is contained. Here is my code for setting up the capture session: self.session =[[AVCaptureSession alloc]init]; [self.session setSessionPreset:AVCaptureSessionPresetPhoto];

Black Video outputted via AVMutableVideoComposition and CAAnimation

∥☆過路亽.° 提交于 2019-12-13 03:45:45
问题 I am building iOS application that is able to record video and add animation overlay over recorded video with AVFoundation and CAAnimation . All sub features are working fine but end of video's background is black while animation is playing. It's not rendering background video that I selected. I've used AVAssetWriter to record video and it's well played on camera roll. But if I use this recorded video to add overlay, end of video's background is black. Interesting thing is if I record video

How to animate the string of a CATextLayer?

非 Y 不嫁゛ 提交于 2019-12-13 03:14:47
问题 I am currently overlaying some text in a video using the AVMutableComposition, I would like to change the string repeatedly based on some time interval. I am trying to use the Core Animation to achieve this; however, the string property does not seem to be animatable. Is there any other way to achieve the goal? Thanks. Code (not working): func getSubtitlesAnimation(withFrames frames: [String], duration: CFTimeInterval)->CAKeyframeAnimation { let animation = CAKeyframeAnimation(keyPath:"string

Classify QR Code with AVFoundation - objective C [duplicate]

大憨熊 提交于 2019-12-13 02:59:53
问题 This question already has answers here : QR Code possible data types or standards (3 answers) Closed 4 years ago . I'm new with QR Code. I use AVFoundation to detect QR Code and decode it to a text. I want to ask that: How can I know the text is a link or a contact or a number,... I mean: With a QR code, can I know what type is it with using AVFoundation? Sorry for my bad english. 回答1: In the QR code, you can read the text by using a scanner seperately and if you need to read the text in

AVAssetExportSession exportAsynchronouslyWithCompletionHandler returns failed

末鹿安然 提交于 2019-12-13 02:02:39
问题 I'm implementing AVAssetExportSession to trim a video online but always returns failed. Here is my implementation: NSString *url = @"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"; NSURL *fileURL = [NSURL URLWithString:url]; AVAsset *asset = [AVAsset assetWithURL:fileURL]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetHighestQuality]; NSURL *exportUrl = [NSURL fileURLWithPath:[documentsDirectory