I am playing a small .wav file using the AudioToolBox.
AudioServicesPlaySystemSound (soundFileObject);
But sometimes it is not playing.
What is the reason?
If you're in the Simulator, make sure that in System Prefrences → Sound, that "Play user interface sound effects" is not turned off. If you're on the device, check that the ringer switch is not set to silent.
Maybe it's this issue? AudioServicesDisposeSystemSoundID() will stop the sound work before playing.
Building on user1056521's answer, use the following code:
AudioServicesPlaySystemSoundWithCompletion(soundID, ^{
AudioServicesDisposeSystemSoundID(soundID);
});
where soundID is the SystemSoundID value you got when you called AudioServicesCreateSystemSoundID().
The completion block ensures the sound was played and completed playing before it is disposed of.
System Preferences → Sound → [x] Play user interface sound — this checkbox helped for me too, it solved the AudioServicesPlaySystemSound(_) issue. But worth noting was that the sample Apple Xcode project "SysSound" worked just fine without checking this box. I'm using the Xcode 4.4.1 for creating own app from scratch. Could there be differencies between projects created with older and newer Xcode tools?
For those who visit this question later,
AudioServicesPlaySystemSoundID()'s volume is based on system Ringer in range of 0.1 ~ 1.0, not mediaVolume
AudioServicesPlayAlertSoundID()'s volume is based on system Ringer in range of approximately 0.3 ~ 1.0
On the device, go into settings and turn up the volume on Sounds->Ringer and Alerts
Related
I am trying to play the default system beep sound in my program. I can play a specified sound, but I want to play the alert sound that is set in the Sound System Preferences.
Call NSBeep(). It's a part of AppKit.
An alternative to the accepted answer could be to use AudioServicesPlayAlertSound, passing it the kSystemSoundID_UserPreferredAlert parameter.
However, this has the drawback to require the AudioToolbox Framework in the app.
The question:
Is it possible that under specific condition (hardware, ...) the pjsua_conf_disconnect(0, callInfo.conf_slot) function do not mute the mic?
If yes, how can we effectively mute the mic with PJSIP?
The details:
In a OSX SIP application, user can mute the mic, and this will call:
...
pjsua_call_info callInfo;
pjsua_call_get_info([self identifier], &callInfo);
pj_status_t status = pjsua_conf_disconnect(0, callInfo.conf_slot);
...
Where [self identifier] is the pjsua_call_id of the current call.
I know for sure that after those 3 lines, status == PJ_SUCCESS, because only if this condition is true the UI is updated to let the user know the mic is muted.
This project uses the pjlib 1.12.0 for POSIX static libs.
Users that face this problem are on Mac OSX 10.8.1 and 10.8.2. They are all using their built-in MacBook [Pro,Air] mic, no headset.
Note that I am NOT able reproduce this problem myself on an OSX 10.8.2 mid-2009 MBP with the exact same build (from the MacAppStore), this is what making this problem hard to trouble shoot.
Note that it is not a random problem, it is contant: as the mute function never works for users experiencing this issue, and it always work for the others.
Is there any way to provide custom icons for each NSUserNotification, instead of the default app logo? Like the iconData parameter in Growl.
I want to show "Someone has just posted something" with the photo of this "someone".
You still cannot change the (default) image showing your app's icon, but starting in OS X Mavericks you can in addition display an additional image using the new property contentImage, e.g. like this:
This new property isn't documented in the NSUserNotification class reference, but mentioned in the Foundation Release Notes for OS X 10.9.
Currently not (Mountain Lion). You should post a feature request.
I know this question has been dead for 5 years, but in case someone finds that question and is still looking for a solution, there is that one:
https://github.com/indragiek/NSUserNotificationPrivate
I've tested it in macOS Sierra and it still works. Just be warned, quoting the project creator:
This should go without saying, but using any of this will result in
your app being rejected from the MAS (Mac Apple Store) and potentially breaking if the
APIs change.
Looking for a related answer about NSUserNotifications I found your question. Officially it's not yet supported. But I wrote a little custom control you can use that may fit your needs. Take a look on this Github repository.
I tested my application on 8GB iPod Touch using iOS 4.0(within multitask), it works. But when I change my original source code, and built it in the simulator. The application load, but nothing appear, it all dark. What I should do to solve the problem? I check the console, it didn't show any error msg. Thank u.
In the Simulator, check the Hardware->Device and Hardware->Version settings. Also, try setting a breakpoint in your code and stepping through it to see how far it gets.
What is it im supposed to set in the plist so that it shows that it does not work on the ipad on itunes?
its somthing to do with this http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedFeatures/AdvancedFeatures.html but I dont see anything that seems appropriate?
Im still kind of noobish so I'd appreciate a really simple answer or as simple as possible.
Thanks for your time
In Project Settings -> Build tab, Deployment category, Targeted Device Family.