I want to control the external running Windows Media Player application using C#. For example, I want to send the play or pause command to the process of the running exe-file "%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe", which was started by the user and is playing a playlist. How can this be done instead of embedding a windows media player control?
Related
I have Gridview when i click play it will play audio file it will get directory from database and play the audio by opening windows media player it working fine in visual studio i am using System.Diagnostics.Process in my code.I hosted application in IIS where OS is Windows 7 when i try to play its not opening windows media player and not playing audio file.
I had seen suggestions in Internet where i need to give permission to IIS admin Service to interact with desktop applications but i hadn't seen any IIS admin Service in Services.msc.
Any one can suggest me
Instead of calling a desktop application, you can use javascript or the HTML audio tag.
There's a js library called Howler (https://github.com/goldfire/howler.js/), it makes easier to play audio from the browser.
In your gridview, you can have a column that has a button to play the audio, this button has an attribute that contains the audio path
Something like this:
<button data-audiosrc="pathtoaudio.mp3">Play audio</button>
Then you use this tag to call the howler to play the audio.
This is one approach.
Another one is to publish these files to an IIS web application and you can call it by the browser http://AudioIISApp/youraudio.mp3 (for example), will open another tab, so the user can listen or download.
This second is more easy and faster to implement!
I am looking for a way to launch/run windows store apps on windows 10/8.1 from C#.
Examples of the apps I am trying to run are
Calculator
Photos
Settings
Note: in Windows 10 these are no longer standard .exe files that can be executed by double clicking or calling Process.Start() as they are now windows store apps.
I have tried to use IApplicationActivationManager but I cannot find decent documentation with examples of how to use it.
There are several ways to do it. The easiest way is to use Process.Start and the URL or file handlers.
For example this will open the Video app:
Process.Start("microsoftvideo://");
Or the Store on the updates page:
Process.Start("ms-windows-store:updates");
Or the Photos app:
Process.Start("ms-photos://");
There are several more handles, some of them can you find here. You can find the names when you open the registry key HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId. Look for the CustomProperties key. It has an attribute Name. That is the one to use.
Some other useful pointer can be found on SU: How do I run a Metro-Application from the command-line in Windows 8?.
I found a cool way to run every Windows Universal apps which downloaded via Windows Store or preinstalled.
Each Windows 10 Universal app has an AUMID which stands for 'Application User Model ID'.
PowerShell Command to get all AUMID:
get-StartApps
Output:
PS C:\> get-StartApps
Name AppID
---- -----
Skype Microsoft.SkypeApp_kzf8qxf38zg5c!App
Snip & Sketch Microsoft.ScreenSketch_8wekyb3d8bbwe!App
Mail microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Calendar microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Movies & TV Microsoft.ZuneVideo_8wekyb3d8bbwe!Microsoft.ZuneVideo
OneNote for Windows 10 Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim
Photos Microsoft.Windows.Photos_8wekyb3d8bbwe!App
Video Editor Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry
Maps Microsoft.WindowsMaps_8wekyb3d8bbwe!App
Alarms & Clock Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
Voice Recorder Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App
Feedback Hub Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe!App
Xbox Game Bar Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App
Camera Microsoft.WindowsCamera_8wekyb3d8bbwe!App
Microsoft Store Microsoft.WindowsStore_8wekyb3d8bbwe!App
Weather Microsoft.BingWeather_8wekyb3d8bbwe!App
Cortana Microsoft.549981C3F5F10_8wekyb3d8bbwe!App
Instagram Facebook.InstagramBeta_8xx8rvfyw5nnt!Instagram
...
So now, you can start any universal app via its AUMID like this:
explorer shell:appsfolder\[AUMID]
For example, if you want to execute Skype:
explorer shell:appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App
Now it's the time to back to Csharp:
Process.Start("explorer shell:appsfolder\Microsoft.BingWeather_8wekyb3d8bbwe!App");
The Windows Weather App will execute.
I have a Windows 8.1 app where I need to play audio, also when the app is in background and under lockscreen.
In Package.appxmanifest, in the declarations section I add Background Task and set it to Audio. So far so good, the audio playback continues when U switch from the app to another app or to the desktop.
Now I need the playback to also continue under lockscreen, so I add the Badge Logo assets, and set Lock screen notifications: badge, so the app can work under lockscreen. But the project does not build:
App manifest defines lock screen notifications without specifying one of appropriate background task types: timer, control channel, push notification, or location.
But I do not need any of those functionalists. Adding one, like location, just so it builds and works seems really strange.
What is the correct setup to allow the app to play audio under lockscreen?
Windows 7 has per-application volume controls that let you mute applications individually. How can I mute and unmute an application from a console app?
You'll want to use the IAudioSessionManager2 COM interface. Have a look at Vista Core Audio API Master Volume Control that wraps some of the new Core Audio APIs. The console project therein enumerates active audio sessions and lets you tweak volume and mute status of an active audio session.
I'm in the process of creating a desktop screen capture application. I'm using a Timer to poll for screen changes. Can I detect if the desktop has changed through a Windows API?
As far as I know there is no easy API for this. The only way to do it more efficiently would be to use a mirror driver which would capture all screen events (e.g., the way remote desktop does it).
You could try the UltraVNC mv2 mirror driver: http://www.uvnc.com/products/mirror-driver.html