Cannot read Volume property on UWP
Summary
Reading the Volume
property of the media player always returns 0 while actual audio is playing. Setting the Volume
property has no effect on either the property itself or the actual audio level. In addition, the VolumeChanged
event is never invoked.
Setting the property or handling the VolumeChanged
event only works with a LibVLC build newer than this commit and after muting the media player once.
Minimal project and steps to reproduce
Clone the UWP repo here and the .NET 40 repo here and simply run the projects. The debug output should show the volume and volume changes appropriately on .NET while the UWP sample simply reads 0.
What is the current bug behavior?
The Volume
property reads 0 and setting it has no effect, no matter if this is done before or after playing (by handling the Playing
event). The VolumeChanged
event is never invoked.
What is the expected correct behavior?
Volume
should read the actual volume level, which is 100 after creating a new media player. Setting the volume level of the media player should change the property and the actual volume accordingly, no matter if this is done before or after playing media. The VolumeChanged
event should be invoked whenever the property is changed.
If the volume is supposed to be persistent after a restart, which is how it behaves on LibVLC.Windows, this should also work on UWP (and be documented).
Does it work on other plaforms? Does it work with the official VLC apps?
It works with the .NET 40 sample, however there are two caveats: 1) the volume on the next startup will be the volume which was set the last time the program ran, and 2) the VolumeChanged
event handler is called three times per change.
Relevant logs and/or screenshots
Environment
- OS: Windows 10 Education
- Version: 1909
- Device: Laptop
- LibVLC version and architecture: 3.3.0 x64 for UWP sample, 3.0.11 x64 for .NET 40 sample
- LibVLCSharp version: 3.4.9
Possible fixes
N/A