avfoundation

Trying to stream audio from microphone to another phone via multipeer connectivity

故事扮演 提交于 2019-12-18 04:51:09
问题 I am trying to stream audio from the microphone to another iPhone via Apples Multipeer Connectivity framework. To do the audio capturing and playback I am using AVAudioEngine (much thanks to Rhythmic Fistman's answer here). I receive data from the microphone by installing a tap on the input, from this I am getting a AVAudioPCMBuffer which I then convert to an array of UInt8 which I then stream to the other phone. But when I am converting the array back to an AVAudioPCMBuffer I get an EXC_BAD

iOS AVAudioSession interruption notification not working as expected

天大地大妈咪最大 提交于 2019-12-18 04:31:59
问题 I want to know when my AVAudioRecorder is inaccessible (e.g when music starts playing). As audioRecorderEndInterruption will be deprecated with iOS 9 I am focusing on AVAudioSession 's interruption notification (but neither is working as expected). The issue is that the interruption notification is never called if the app was and remains in the foreground when the interruption occurs. E.g: The user starts and stops playing music without moving the application into the background. To detect

AVAssetWriter How to create mov video with no compression?

ぃ、小莉子 提交于 2019-12-18 04:23:33
问题 I'am creating a video from an array of images. The purpose of my work is to create a .mov video with no compression. I have see in developer library that it exist a key "AVVideoCompressionPropertiesKey" but I don't know how to specify no compression with this key. Could you help me please? Here is my sample code : NSDictionary *videoCleanApertureSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:320], AVVideoCleanApertureWidthKey, [NSNumber numberWithInt:480],

Reverse video playback in iOS

元气小坏坏 提交于 2019-12-18 04:03:19
问题 I want to play video backward in AVPlayer. I have tried with changing rates property to -1.0, and although it did work it was not smooth. Is there any way through which I can smoothly play videos backward? 回答1: As stated in the comments, the problem is with keyframes and the fact that most codecs are not designed to play backwards. There are 2 options for re-encoding the video that doesn't require you to actually reverse the video in editing. Make every frame a keyframe. I've seen this work

Reverse video playback in iOS

混江龙づ霸主 提交于 2019-12-18 04:03:11
问题 I want to play video backward in AVPlayer. I have tried with changing rates property to -1.0, and although it did work it was not smooth. Is there any way through which I can smoothly play videos backward? 回答1: As stated in the comments, the problem is with keyframes and the fact that most codecs are not designed to play backwards. There are 2 options for re-encoding the video that doesn't require you to actually reverse the video in editing. Make every frame a keyframe. I've seen this work

Set Camera Focus On Tap Point With Swift

不羁的心 提交于 2019-12-18 03:38:37
问题 The API for using the camera in swift seems a but different and I am having a hard time focusing the camera on a point. When the user taps the screen I want the camera to focus on that point This is my code: func focusCamera(point:CGPoint) { var screenRect:CGRect = bounds var focusX = Float(point.x/screenRect.width) var focusY = Float(point.y/screenRect.height) _currentDevice.lockForConfiguration(nil) _currentDevice.setFocusModeLockedWithLensPosition(focusX) { time in self._currentDevice

AVAudioEngine playing multi channel audio

匆匆过客 提交于 2019-12-18 03:01:09
问题 Simple question. How do I play multi channel audio files (>2 channels) using AVAudioEngine so that I can hear all channels on default 2-channel output (headphones/speaker). Following code (stripped of error checking for presenting) plays the file first two channels but I can only hear it when headphones are plugged in. AVAudioFile *file = [[AVAudioFile alloc] initForReading:[[NSBundle mainBundle] URLForResource:@"nums6ch" withExtension:@"wav"] error:nil]; AVAudioEngine *engine = [

HTTP Live Streaming with AVPlayer in iOS 4.0?

不想你离开。 提交于 2019-12-18 02:58:09
问题 Is it possible to use HTTP Live Streaming with AVPlayer on iOS 4.0? This was clearly a documented feature of 4.0. However, if I run Apple's SitchedStreamPlayer sample code on my 3GS running iOS 4.0.1, clicking "Load Movie" does not play the stream, but gives an error: 2011-06-21 13:14:49.428 StitchedStreamPlayer[680:307] The asset's tracks were not loaded due to an error: Cannot Open MPMediaPlayer is able to play the same stream on the same device. However, I need a working solution with

iOS: AVPlayer - getting a snapshot of the current frame of a video

て烟熏妆下的殇ゞ 提交于 2019-12-18 02:48:10
问题 I have spent the whole day and went through a lot of SO answers, Apple references, documentations, etc, but no success. I want a simple thing: I am playing a video using AVPlayer and I want to pause it and get the current frame as UIImage . That's it. My video is a m3u8 file located on the internet, it is played normally in the AVPlayerLayer without any problems. What have I tried: AVAssetImageGenerator . It is not working, the method copyCGImageAtTime:actualTime: error: returns null image

Possible to play video using a subclass of NSURLProtocol, using either MPMovieController or AVFoundation?

孤者浪人 提交于 2019-12-18 01:20:31
问题 I'm currently trying to play a video to a URL that has the custom scheme defined in a custom NSURLProtocol subclass. Initially I was using MPMoviePlayerController in an attempt to accomplish this, but after running into problems and checking stack overflow, I found that the MPMoviePlayerController does not handle NSURLProtocol subclasses as expected. How to play movie with a URL using a custom NSURLProtocol? As a result I decided to look at the AVFoundation framework, however, it seems that