How to mute windows phone programmatically - c#

I want to start working on an app that have basic functionality to mute phone(no sound from any app, ring tone).
Is that possible, I have doubt because MS can take this as security threat.Please let me know from where to start?

You cannot programmatically control the entire Phone's volume through an API currently. Only the volume level of sounds from your application may be controlled.

Related

How to mute or adjust volume on windows systems sounds?

I am working on an audio application, and it is vital that we can mute Windows systems sounds (warnings, notifications etc) at critical times
I can set the system volume and access a number of sound related things, but not the Windows systems sounds
I can access microphones, loudspeakers (waveOut) and the mixer. However while in older versions of Windows, the mixer would contain "Systems sounds", but later do not. Opening "Sound Settings" one will find "Systems sounds" under apps.
If I could get that list, and control it, then I can mute the system.
How do I access that ?
Thanks to the link from Anders, I found the CoreAudio function, which lead me to IsSystemSoundsSession which then lead me to:
How can i control the volume of a specific software in the windows Volume Mixer?
Here is a similar thing done, which can be easily used for muting the system sounds

System Sound Level in UWP

I have searched through documentations, but cannot find a way to figure out either the system volume or the volume level at which the app would play
Read through:
Sound
ElementSound
Is there a way to find it in UWP?
I need to report volume changes to viewability
Thanks for your interest. Unfortunately, currently there is no better way to report the volume you said. We can only control the app level's volume such as mediaplayperelement volume setting. We do not have any event to listen for system volume changes. We suggest you could make desktop bridge app and use desktop extension part to get system volume and send it to UWP client with AppService.

Full screen WPF App To act as operating system

I realize this might sound a little dubious but I assure you it isn't. I have a client who wants a win 8 pro touch screen app. One of the requirements is that the app is the only thing on the device the user may use. So my question is, can I make it so that the user cannot exit my wpf application? I have it running full screen without toolbars but they could still click on start etc. I essentially want it to run on windows but kind of be its own OS. Any advice is appreciated. Also if this is something that can be handled in group policies or some other way I would love to have that advice as well. Thank you.
You'll need to set Windows 8.1 to run in "Kiosk" mode.
How to enable Kiosk mode in Windows 8.1
The only caveat, is that the app must be a Windows modern app, not WPF.
Windows 8.1 comes with an excellent feature where you can lockdown the
device allowing the user to use only one application. You need to keep
in mind that this application needs to be a modern application and
cannot be a desktop application. So, if you are going to use it for
your customized company application (For e.g. ATMs, Flight Schedule),
the application should be a modern application
There is a product called "Secure Lockdown" from Inteset http://shop.inteset.com/lock-down-windows-7-with-inteset-secure-lockdown that looks like it can be used with a WPF app. I've not used it (yet), but it looks like it should work for your scenario. It's not free, but it reasonably priced at around $20. It says it is compatible with Windows 8 as well.

Change system volume in Windows Phone 8

Up until now I thought that changing the system volume from your app is impossible, until recently a new app called Quite Hours (http://www.windowsphone.com/en-us/store/app/quiet-hours/f347a36b-80c0-430f-8631-e55046ee5a2a) actually did just that in a very neat way.
Does anyone please know how to do that programmatically? I tried using the MediaElement or the xna MediaPlayer and the backgroundAudioPlayer and nothing worked. Any help would be appreciated!
Thank you!
The developers of the apps mentioned in the OP were able to change system volume under WP8.0. Apparently whatever method they used has now been disabled under WP8.1. The following apps now display disclaimers that they no longer work on Windows Phone 8.1: Quiet Hours and Volume Manager
They direct to the following page to vote to allow this functionality: Windows Phone Dev User Voice
Additionally please read the following thread on the MSDN forum: MSDN change system volume Windows Phone 8. This functionality was likely achieved using WASAPI (which I have personally tried, and failed, it does not work, comment if you want my code to try it.), or the developers of the volume apps might have had access to AudioClientRestricted.h. If one had that h file, one would have access to system volume under WP8.1, so I somehow doubt the developers used the h file designated for OEMs because it would work un 8.1.
Talking with James Dailey (who works # MSFT) indicates it is technically possible using WASAPI ISimpleAudioVolume If you read # the bottom of that page there is a comment indicating you must use IAudioEndpointVolume
Added note from James Dailey # MSFT:
AFAIK there is no good way to manipulate the global audio level on
Windows Phone 8.1 (WP8.1). Theoretically you can change the audio
volume of any app that uses the default audio session “zero”. However,
if the app chooses to initialize it’s audio session with a custom
GUID you will not have access to the session volume for its custom
audio session. Again this is theoretical based on my knowledge of the
inner workings of WASAPI. I’ve never actually tried it on the phone.
To manipulate the audio volume of apps using audio session “zero” you
simply initialize your IAudioClient with an AudioSessionGuid parameter
of “{00000000-0000-0000-0000-000000000000}”. You can then use
ISimpleAudioVolume::SetMasterVolume to set the volume for this audio
session. You will need to use C++ / Cx since we do not support
calling WASAPI from managed code.
There currently is no API available for controlling the system volume. You can however control the volume in the elements of your application (via the classes MediaElement, BackgroundAudioAgent).
You can also control the volume on sound effects of your application using XNA API.
See http://msdn.microsoft.com/en-us/library/bb195052%28v=xnagamestudio.30%29.aspx

Windows Phone, Navigate to MusicPlayer

I'm developing WP application, part of which is to play/stream audio files.
I didn't wanted to create my own page to display info of current playing track, so I decided to use Built-in Music's player, using Microsoft.Xna.Framework.Media.MediaPlayer class I created playlists and queued playback. It all works fine, but now I need to navigate to MusicPlayer, when user taps on track in my app, and that's the part I've no idea what to do.
I've tried to navigate to MusicPlayer using Microsoft.Phone.Tasks.MediaPlayerLauncher, but it's not an option, because it...
Needs to receive media location in IsolatedStorage, which means
streaming is impossible
Gets one media at a time, so no playlists
I guess I can't navigate without changing track(or starting over)
Is there any way to navigate to Built-in Music Player's Now Playing page, without interrupting playback?
I think these questions might be helpful/related to what you're looking for:
Detecting and launching an external application from within a Windows Phone 7.1/7.5 application
Launching other applications in Windows phone 7 Programatically
In short, it doesn't seem like third-party apps have permission to access other apps on the phone, probably for security reasons.

Categories