avfoundation

AVPlayer not playing MP3 audio file in documents directory iOS

和自甴很熟 提交于 2019-12-19 04:07:18
问题 I'm using AVPlayer to play a MP3 located in the documents directory (file is confirmed to be in there) - I load the AVPlayerItem wait for the AVPlayerItemStatusReadyToPlay then instantiate the AVPlayer with the item and play. The AVPlayerItemStatusReadyToPlay does get called, but no audio actually plays, anyone have an idea why? - (void)checkFileExists { if (![[NSFileManager defaultManager] fileExistsAtPath:[self.urlForEightBarAudioFile path]]) { [self beginEightBarDownload]; } else { // set

iPhone: NSData representation of Audio file for Editing

人盡茶涼 提交于 2019-12-19 03:38:22
问题 I have been scratching my head since long now but not getting around to this. I haven't found a single example for Audio editing! I want to insert new Audio file in between somewhere in original Audio file, save it as new converted audio files. For this I have written following code. I got this idea from here. NSString *file1 = [[NSBundle mainBundle] pathForResource:@"file1" ofType:@"caf"]; // Using PCM format NSString *file2 = [[NSBundle mainBundle] pathForResource:@"file2" ofType:@"caf"];

iOS8 AVAudioEngine how to send microphone data over Multipeer Connectivity?

爱⌒轻易说出口 提交于 2019-12-19 03:22:29
问题 I want to send microphone audio data over Multipeer Connectivity (iOS 8) and play it through the speaker of the receiving peer. I've also setup the AVAudioEngine and I can hear the microphone data from the (upper) speaker output, but I don't know how to send AVAudioPCMBuffer over the network. Here's my code snippet: AVAudioInputNode *inputNode =[self.engine inputNode]; AVAudioMixerNode *mainMixer = [self.engine mainMixerNode]; [self.engine connect:inputNode to:mainMixer format:[inputNode

AVAudioSession setCategory not working

有些话、适合烂在心里 提交于 2019-12-19 03:18:39
问题 I have a video capturing app and I want to be able to play background music while recording audio+video. I can accomplish this if I set the AVAudioSession category to PlayAndRecord in didFinishLaunchingWithOptions . However, this causes a glitch in the audio whenever the view with the camera enters or exits the foreground, and its apparently impossible to get rid of: https://forums.developer.apple.com/message/74778#74778 I can live with the glitch if it just happens when I start/stop

AVAudioPlayer rate

老子叫甜甜 提交于 2019-12-19 03:12:20
问题 So I'm trying to play a sound file at a different rate in iOS 5.1.1, and am having absolutely no luck. So far I have tried setting the rate of the AVAudioPlayer: player = [[AVAudioPlayer alloc] initWithContentsOfURL:referenceURL error:&error]; player.enableRate = YES; player.rate = 1.5; player.numberOfLoops = 0; player.delegate = self; [player prepareToPlay]; [player play]; with no luck at all, the sound plays but just ignores the rate I give it. I have also tried AVPlayer: avPlayer = [

How to record video in ProRes codec on iOS?

Deadly 提交于 2019-12-18 18:49:54
问题 I would like to capture video from device’s back camera directly to ProRes codec, now that .proRes422 and .proRes4444 are available as AVVideoCodecType options in iOS 11. But I receive an error that recording is: unsupported given the current configuration On both iPhone X and second generation iPad Pro, when trying to capture video with the following code: movieFileOutput.setOutputSettings([AVVideoCodecKey: AVVideoCodecType.proRes422], for: movieFileOutputConnection!) If this approach is

AVPlayer plays video composition result incorrectly

末鹿安然 提交于 2019-12-18 17:49:20
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

AVPlayer plays video composition result incorrectly

房东的猫 提交于 2019-12-18 17:49:14
问题 I need a simple thing: play a video while rotating and applying CIFilter on it. First, I create the player item: AVPlayerItem *item = [AVPlayerItem playerItemWithURL:videoURL]; // DEBUG LOGGING AVAssetTrack *track = [[item.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; NSLog(@"Natural size is: %@", NSStringFromCGSize(track.naturalSize)); NSLog(@"Preffered track transform is: %@", NSStringFromCGAffineTransform(track.preferredTransform)); NSLog(@"Preffered asset transform is: %@"

Start playing sound in background on iOS?

与世无争的帅哥 提交于 2019-12-18 17:26:35
问题 I'm trying to do something similar to Tile.app. When it shows a notification, it plays a sound. That seems simple enough-- use UILocalNotification and include the sound file name. But local notifications limit sounds to no more than 30 seconds, and Tile's sound keeps playing for a whole lot longer than that. I expect it's looping, and it continues until I can't stand the noise any more. The sound also plays even if the phone's mute switch is on, which doesn't happen with local notifications.

AVAudioPlayer and AirPlay - possible?

谁说我不能喝 提交于 2019-12-18 16:57:27
问题 I'm trying to ascertain whether it's possible to toggle AirPlay support using the AVAudioPlayer class. From what I have read: AirPlay is a technology that lets your application stream audio to Apple TV and to third-party AirPlay speakers and receivers. AirPlay support is built in to the AV Foundation framework and the Core Audio family of frameworks. Any audio content you play using these frameworks is automatically made eligible for AirPlay distribution. Once the user chooses to play your