-
Notifications
You must be signed in to change notification settings - Fork 57
Get and set audio volume #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Good suggestion. We should also consider this in light of things like the Media Transport Controls for UWP apps. Volume but also play, pause, media information etc. |
Re Media Transport Controls -- although in general I like the idea of Play and Pause functions, I'm unsure how that would work when a webpage contains multiple video elements. I think the audio volume issue is simpler in the case of multiple video elements because the volume can simply apply to everything in the webpage. In contrast, if Play and Pause functions exist, and if they cause all video elements to start playing or pause, I'm unsure whether that's what people would want. |
We'll look into the corresponding browser feature where the browser connects to MTC. What we do in this area will likely depend on that feature |
Would those Media Transport Controls also make it possible to ask WebView2 whether it is currently playing any video? Our kiosks have a user inactivity/idle timeout. If no user activity is detected for longer than X minutes, the kiosk and web session is terminated/reset. However this causes a problem when users/employees are watching long training or OH&S videos. The user appears idle because he/she doesn't move the mouse or press any key while watching the long training video, and thus the inactivity timeout occurs and interrupts the playback of the training video. Thus we have a request from a client to (if possible) automatically detect when a video is playing in the WebView/2 and extend the inactivity timeout. For example:
Detecting video playback and controlling the audio volume are 2 actual requests from real-life clients. Especially the audio volume has been requested multiple times. |
Good point. Not sure if its required for MTC connection or not but a good feature request. Thanks. |
Also relevant to volume control: Ideally the WebView2/Chromium process should not appear in the system sound mixer window. Alternatively, if it must appear, then it should appear with the name of the owning app. In contrast / for comparison, EdgeHTML-WebView appears like the following screenshot, which is confusing for end-users. Users don't (and shouldn't have to) understand what "Desktop App Web Viewer" means. Even more confusing for users, when multiple apps or processes use WebView, then "Desktop App Web Viewer" appears multiple times in the volume mixer: However, in our environment, being able to programmatically control the volume of WebView2 is much more important than whether or not it appears in the volume mixer window. And various other issues are much higher priority than audio issues, such as cookie access. |
@vhanla thanks for posting it here :), we'll look into this // fyi @david-risney we were talking about this on twitter https://twitter.com/vhanla/status/1252759195302100993 |
Allowing the audio renderer to be changed or selected via API would be very useful as well. |
I agree that this feature would be very useful. |
Hey folk. We are starting to look at an API to control the media audio. A clarifying question I want to ask - do you want control the volume of a particular media element, individual webview, all webviews you own, or the system volume? Thanks! |
Selecting the audio renderer for each webview. This would allow control of volume and where it is output for every page, just like the way you can with video playback in DirectShow. |
Hi folks on this thread. I am working on implementing the mute/unmute feature. There is a design question I have in mind that was hoping to get some insights from folks requesting the feature. I am debating on whether to make the mute/unmute API async or not. What would be the user cases for the mute and mute API? |
As previously stated, just allow us to specify the audio renderer and then we can do whatever we need, mute, volume up/down etc. |
We wouldn't be able to provide volume change at this point. For the Mute/Unmute, do you need the setting mute finished before unmuting? |
Hi folks on the thread, We can't provide volume control at this moment, but we added ability to mute and unmute webview. Also ability to tell if webview is playing audio, so users can chose to time out or not. We have the spec here: #1658. Please review and add any feedback you have about this API. |
Hi folks, The API is now an experimental API now. Please give it a try if you would like. https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.1018-prerelease https://docs.microsoft.com/en-us/microsoft-edge/webview2/release-notes#101018-prerelease |
I try the api but still the same bahavior process shows as webview2 rather than the app name any idea |
Is there any solution for the .NET versions yet? Summary reminder:
Thanks in advance. |
I'm the developer of EarTrumpet an alternative audio mixer and we are seeing an uptick in Edge/PWA/WebView2(?) users filing bugs on me because I can't control the volume of these apps due to mixed/brokered audio. We need access to Core Audio API-like interfaces on a per-app/process basis. Happy to connect/discuss further. |
Bump, this is sorta irritating having absolutely no way of controlling these subprocesses in userland programmatically. |
Uh oh!
There was an error while loading. Please reload this page.
Every so often, we receive yet another request for a feature that controls the audio volume of the web component. So far, we have been unable to fulfill this request. Can an AudioVolume property (equivalent to the following C# snippet) be added to WebView2?
If you want, you could include the
IsAudioVolumeMuted
property to support a mute/unmute setting, but this isn't strictly essential, because apps can build their own mute/unmute setting atop theAudioVolume
property. Note mute is different to setting theAudioVolume
property to zero.Valid values for the
AudioVolume
property would probably range from 0.0 (meaning 0%) to 1.0 (meaning 100%), but you might decide to also allow values greater than 100% because some volume controls do actually support "overdrive" or "boost" volumes, especially in cases where the source audio material may contain quiet sounds. Your choice.I would find it helpful if the documentation states what scale the volume operates on:
Some audio volume slider widgets operate on a logarithmic scale while others are linear. A way of fixing a poorly performing volume slider is to change it to a logarithmic scale. However if the
AudioVolume
property is already logarithmic but the documentation doesn't state it, then an audio volume slider widget may be accidentally implemented as double log, which again produces a poorly behaving slider, thus clear documentation is helpful.The proposed
AudioVolume
property would control the volume of all audio output produced by WebView2, including the following. Here is a list of tests to be performed after the volume feature is implemented:I have not been able to workaround the lack of volume control by setting the system volume because:
AB#37633577
The text was updated successfully, but these errors were encountered: