Microsoft.Toolkit.Win32 icon indicating copy to clipboard operation
Microsoft.Toolkit.Win32 copied to clipboard

Win32WebViewHost replaces application's Audio Session ownership

Open vhanla opened this issue 6 years ago • 5 comments

I'm submitting a...

  • Bug report (I searched for similar issues and did not find one)

Current behavior

System sound mixer shows Win32WebViewHost process as the owner instead of the application containing the WebView control. IAudioSessionEnumerator. win32webviewhost

It also affects WebNotifications, because clicking on the notification, it will open an empty window with title "Win32WebViewHost" instead of focusing the application containing that webview. webnotification

Expected behavior

Application's process listed in IAusioSessionEnumerator, i.e. in the system's audio mixer dialog window instead of Win32WebViewHost.

Also WebNotification showing the proper application's name as well the callback to bring the application to the foreground.

Minimal reproduction of the problem with instructions

Navigate to any website that emits sound, YouTube, etc. Open the Volume Mixer (right click the volume icon in systray -> select Volume Mixer). There will be listed Win32WebViewHost instead of our application name, if more than one application, using WebView, there will be listed as many as applications using webview + sound are running. win32webviewhost

And about web notification callback action: Navigate to Google Play Music webapp. Turn in settings the web notifications and refresh, accept the permission request. It will show the notification. Click the notification. It will open a windows titled Win32WebViewHost and will close after a second or less. win32webviewhostapp

Environment

Nuget Package(s): 

Package Version(s): 

Windows 10 Build Number:
- [ ] Anniversary Update (14393) 
- [ ] Creators Update (15063)
- [ ] Fall Creators Update (16299)
- [x] Insider Build (build number: 17134)

App min and target version:
- [ ] Anniversary Update (14393) 
- [ ] Creators Update (15063)
- [ ] Fall Creators Update (16299)
- [x] Insider Build (17134)

Device form factor:
- [x] Desktop
- [ ] Mobile
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [x] 2017 (version: 15.7.1)
- [ ] 2017 Preview (version: )

vhanla avatar May 10 '18 20:05 vhanla

Reported to Edge team. #17469179

rjmurillo avatar May 10 '18 21:05 rjmurillo

Note: the string "Win32WebViewHost" has been replaced with "Desktop App Web Viewer"

rjmurillo avatar Oct 09 '18 23:10 rjmurillo

@joshholmes FYI

rjmurillo avatar Oct 24 '18 18:10 rjmurillo

Is there any way to catch the event when clicked on notification popup to focus my application instead of launching the Desktop App Web Viewer?

vhanla avatar May 18 '19 04:05 vhanla

This audio session ownership issue is also a problem in our environment. Ideally Win32WebViewHost shouldn't appear in the system sound mixer window, but if that's too difficult to fix, then we would consider it solved enough for our purposes if WebView supported at least an audio volume property that allows us to get and set the volume of WebView, like this:

class WebView
{
    ...
    public double AudioVolume { get; set; }
    // Optional:   public bool IsAudioVolumeMuted { get; set; }
    ...
}

For more info on the volume topic, please look at https://github.com/MicrosoftEdge/WebViewFeedback/issues/41

verelpode avatar Oct 17 '19 18:10 verelpode