I'm trying to adjust the volume of an instance of vlc.MediaPlayer
before playback. Running the below snippet (python3 test.py
) plays five seconds of the audio file path/to/file.m4a
. It appears that audio_set_volume
does actually set the volume of the player, given that the subsequent print statement returns 10; but there's no practical change in volume (whether I set it lower or higher).
# test.py
import vlc
from time import sleep
media_player = vlc.MediaPlayer("path/to/file.m4a")
# Set the volume to 10%
media_player.audio_set_volume(10)
# Returns 10
print("Set volume: " + str(media_player.audio_get_volume()))
media_player.play()
sleep(5)
This similar question doesn't appear to have been resolved.
Versions:
Python==3.10.6
python-vlc==3.0.16120