libvlc_audio_{get,set}_volume don't always work on winstore/UWP
Getting the volume from the mediaplayer on winstore doesn't work and always reads 0 (even though the volume clearly is playing, and not silent), because the winstore audio output plugin never calls aout_VolumeReport
by itself (not until the volume or mute is set explicitly). On desktop Windows with mmdevice, the actual volume is available right after libvlc_media_player_new
since aout_VolumeReport
is called during MMSession, right after the Open()
callback.
Setting the volume on winstore only works after an unspecified amount of time after the Start()
callback is called (and the media is already playing). The media_playing
event from the media player is dispatched before the winstore plugin even has the chance to open the COM audio interface, and thus there is no way to know when a libvlc_audio_set_volume
call will succeed, or fail because the audio device has not been opened yet. While again, on mmdevice, it works right after libvlc_media_player_new
.
I'm not sure what the best way to solve this would be (or what the intended behaviour of the libvlc_audio_{get,set}_volume
functions is, right after calling libvlc_media_player_new
). Also see: LibVLCSharp#423 (closed).
Edit: volume_changed
event => media_playing
event