Is there a way to programmatically mute the sound on OSX? - objective-c

Is there a way to programmatically mute the sound on OSX without using private APIs and in a way that is accepted by the Mac App Store.

FOR MAC OS X: This tutorial might be of assistance.
FOR IOS: No.
Sound Mute is a system-wide setting. So for applications developed using the official SDK cannot change (and in most cases cannot even access) system-wide settings.
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but will prevent your app from getting Apple's approval.

On the Mac, see Srikar's answer. I believe he's got it covered.
On iOS, [MPMusicPlayerController iPodMusicPlayer].volume = 0.0 will mute the audio output. If there is an MPVolumeView present in your view hierarchy, it will do this without visual feedback; if there is not, it may present the volume change popup you see when you press the hardware volume buttons on the device.

Related

How to find out if the video is currently playing in full screen on OS X

We have an application for Mac OS X that needs to know when the user is watching a movie in full screen to change its behavior.
Is there any system programmatic "hooks" that allow native Objective-C application to know when fullscreen playback is started?
You can get a list of all windows by using the CGWindow API, like in the Son of Grab sample.
From there, you can look at the window levels to figure out which windows are full screen, but I am not aware of any way to look for video playback specifically, as different apps (VLC, QickTime Player) all use slightly different methods. Of course, you could hard code specific process names, and assume that they are doing video playback if they have a fullscreen window.

Siri on Custom keyboard App Extension iOS 8

Currently I am working on a iOS 8 custom keyboard extension and I want to mimic the functionality of Siri similar to the default keyboard.
Can we able to use Siri on iOS 8 Custom keyboard App extension? If we can is there any API/documentation available?
Thanks
Custom keyboard is an app extension, so it cannot access to the microphone. And without microphone, we cannot do something like Siri does.
I think we have to wait until Apple changes!
Custom keyboards, like all app extensions in iOS 8.0, have no access to the **device microphone**, so dictation input is not possible.
From: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
No, native Siri access is not yet possible. You can use something like Nuance ndev to produce this functionality though. http://dragonmobile.nuancemobiledeveloper.com
You should be able to switch back and forth using the globe key so the user will have quick access to the native keyboard in the case they need to dictate.

Is it possible to test touch gestures with a "non-touchable" laptop?

While developing Windows Store apps and WP8 apps, is it possible to test the "touch" gestures while using a laptop that doesn't support touch? Are there parallel mouse or keyboard actions/combinations that will do the same thing as a "pinch" or a "flick" gesture (to imitate semantic zoom and unzoom) for example?
When you use the simulator, there are buttons at the right that let you simulate multi-touch. It's not convenient, but it mostly works.
http://msdn.microsoft.com/en-us/library/windows/apps/hh441475(v=vs.110).aspx
I haven't been able to use the WP8 SDK yet but if the SDK is like WP7 (from what I hear from others it is) use the simulator that comes with the SDK and use Multitouch Vista to emulate the touches with this Guide to using Multitouch Vista. You will just need any other USB mouse (note though using the built-in trackpad as another mouse has been hit and miss in my experience with Multitouch Vista)
For Windows Store Apps the easiest way to simlute gestures only us by using the provided simulator. You can still use Multitouch Vista but the dots to track the points won't show in the Metro Environment.

Playing music on a Mac in lock screen and display off

I have an app with a behavior that I want to copy. The app can play music in the lock screen state. The app can also turn off the screen at this state. I'm not too sure if the app is placing the Mac in sleep mode but the white indicator light on the front of the Mac book is on but is not pulsing while the display is off.
I know how to play music and place the mac in the lock screen state using apple script. What I don't know how to do is turn off the display and have the indicator light turned on. This behavior is similar to when the Mac is in sleep mode. Any ideas as to how this can be done programmatically using objective-c and/or apple script?
I cannot use anything that is not documented by Apple. I am running the latest version of OSX Lion.
If you hold down the command, shift and eject buttons at the same time, the screen goes dark instantly. I just confirmed this in 10.7.1.
As for Applescripting Display Sleep, it's not trivial. I did find a probable solution in this thread:
http://macscripter.net/viewtopic.php?pid=135732#p135732
Give it a try and see if it accomplishes what you are looking for.

How can I turn on and off the bluetooth on iphone sdk programatically?

how can I tell programatically if the bluetooth is turned on or of on the device?
And in ethier case turn it off or on programatically?
thanks
Are you talking about the popup that appears when you run the GKTank application while bluetooth is turned off? I suspect this is a function of the PeerPicker class - I haven't seen a way to query the bluetooth status directly.
However if you attempt to make a bluetooth call when bluetooth is off you'll receive a GKSessionCannotEnableError error code (Bluetooth is not currently available).
There's currently no way to interface with Bluetooth unless you join the Made for iPod / Works With iPhone program for some hardware you're developing.