avfoundation

AVPlayer making extraneous http request prior to playback of HLS / AES-encrypted video

拈花ヽ惹草 提交于 2019-12-05 16:12:48
We're using AVPlayer on iOS 8.4 to play HLS, AES-encrypted video. Our .m3u8 files include the url of the license server, e.g.: EXT-X-KEY:METHOD=AES-128,URI="https://...." In our iOS application, we're using AVAssetResourceLoaderDelegate method resourceLoader:shouldWaitForLoadingOfRequestedResource: to intercept the request that gets sent by the AVPlayer (or some object within AVFoundation) to the license server. Within that method, we add a token (required by the license server) to the request's queryString. The license server receives the request with the token, returns the encryption key,

AVAudioEngine crashes when I unplug headphones during a call

霸气de小男生 提交于 2019-12-05 16:10:12
问题 Here is what I see in the log: 16:33:20.236: Call is Dialing 16:33:21.088: AVAudioSessionInterruptionNotification 16:33:21.450: AVAudioSessionRouteChangeNotification 16:33:21.450: ....change reason CategoryChange 16:33:21.539: AVAudioEngineConfigurationChangeNotification 16:33:21.542: Starting Audio Engine 16:33:23.863: AVAudioSessionRouteChangeNotification 16:33:23.863: ....change reason OldDeviceUnavailable 16:33:23.860 ERROR: [0x100a70000] AVAudioIONodeImpl.mm:317: __

AVAudioEngine inputNode's format changes when playing an AVAudioPlayerNode

随声附和 提交于 2019-12-05 15:47:39
I'll start with a simple "playground" view controller class I've made that demonstrates my problem: class AudioEnginePlaygroundViewController: UIViewController { private var audioEngine: AVAudioEngine! private var micTapped = false override func viewDidLoad() { super.viewDidLoad() configureAudioSession() audioEngine = AVAudioEngine() } @IBAction func toggleMicTap(_ sender: Any) { guard let mic = audioEngine.inputNode else { return } if micTapped { mic.removeTap(onBus: 0) micTapped = false return } stopAudioPlayback() let micFormat = mic.inputFormat(forBus: 0) print("installing tap: \(micFormat

Airplay: Playing a Movie from MPMoviePlayerController results in only audio being streamed to Apple tv

 ̄綄美尐妖づ 提交于 2019-12-05 15:37:57
Setting up Airplay was easy enough. self.moviePlayer = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease]; [self.moviePlayer setAllowsAirPlay:YES]; However, when I try to play a video, only the audio is streamed. The video continues to play on the iPad. Additionally, the Airplay control only shows the "Audio Only" icon in the source list. (see photo). This makes me think that iOS "thinks" that only audio is playing. I have several other apps with Airplay on my device and they work correctly. I have cycled both the Apple tv and the iPad on and off. Both the iPad and the

AVfoundation blur background in Video

十年热恋 提交于 2019-12-05 15:30:17
问题 In my application I have fix composition render size of 1280 x 720. So if will import any portrait video then I have to show blur background with fill and aspect frame of video in centre. Same like this: https://www.youtube.com/watch?v=yCOrqUA0ws4 I achieved to play both videos using AVMtableComposition , but I don't know how to blur a particular background track. I did following in my code: self.composition = [AVMutableComposition composition]; AVAsset *firstAsset = [AVAsset assetWithURL:

How to instantly see new video layer after letting go of button?

送分小仙女□ 提交于 2019-12-05 15:03:39
I have an app where a user can hold a button to take a video. However when they do so and then the new layer, with the video playback, does not appear instantly. Instead, there is a very short delay where you can see the camera still showing what the camera sees after the user has let go of the button. When the delay finishes the video instantly shows up and starts playing. But how can I instead make the first frame of the video appear before its ready to play so that its there just for a moment before it starts playing? See snapchat's video taking functionality to see what I mean Below is the

AVMutableComposition resizing issue

感情迁移 提交于 2019-12-05 13:52:07
问题 I'm trying to render an image into a video captured with the front camera using AVMutableComposition. The size of the resulting video (including the image) is perfectly fine. However, the initial video will be resized as shown in this picture: I'm using the NextLevelSessionExporter and this is my code snippet: // * MARK - Creating composition /// Create AVMutableComposition object. This object will hold the AVMutableCompositionTrack instances. let mainMutableComposition = AVMutableComposition

MAC OSX AVFoundation video capture

∥☆過路亽.° 提交于 2019-12-05 13:28:17
I am new bie to MAC OSX development. I wanted to capture video as raw frames using AVFoundation on OSX 10.7. I am not understanding setting specific video resolution to camera device, somehow I setted using VideoSettings, but if I set 320x240, it is capturing at 320x176. I am not understanding is there any API call mismatch. Please help me yo sort out this issue. Awaiting for your reply.....Thanks in advance....... Regards, Anand The answer by user692178 works. But a cleaner approach would be to set kCVPixelBufferWidthKey and kCVPixelBufferHeightKey options on AVCaptureVideoDataOutput object.

Memory Management issue with AVAssetWriter in iPhone?

久未见 提交于 2019-12-05 12:42:52
I have successfully created video from uiimages using AVAssetWriter. But as soon as the writer starts writing video theres a sudden rise in the memory allocation in the instruments. The spike in the memory allocation changes from 3-4 MB to 120MB and then cools off. I have used the following code for this... -(void)writeImageAsMovie:(NSArray *)array toPath:(NSString*)path size:(CGSize)size { NSMutableDictionary *attributes = [[NSMutableDictionary alloc]init]; [attributes setObject:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB] forKey:(NSString*)kCVPixelBufferPixelFormatTypeKey];

Swift3 Microphone Audio Input - play without record

痞子三分冷 提交于 2019-12-05 12:37:29
I am trying to play microphone audio input using swift3 without recording. I can record the audio with the following code: let session = AVAudioSession.sharedInstance() try! session.setCategory(AVAudioSessionCategoryPlayAndRecord, with:AVAudioSessionCategoryOptions.defaultToSpeaker) try! audioRecorder = AVAudioRecorder(url: filePath!, settings: [:]) audioRecorder.delegate = self audioRecorder.isMeteringEnabled = true audioRecorder.prepareToRecord() audioRecorder.record() and then play it back ultimately after picking up the recorded file with: audioPlayerNode.play() But I would like to skip