from pygame import mixer
# Starting the mixer
mixer.init()
# Loading the song
#File location
mixer.music.load("Python\Bekhayali - Kabir Singh.mp3")
# Setting the volume
mixer.music.set_volume(0.7)
# Start playing the song
mixer.music.play()
while True:
print("[Pause 'p'] [Resume 'r'] [Exit 'e' ]")
song = input(" ")
if song == 'p':
# Pausing the music
mixer.music.pause()
elif song == 'r':
# Resuming the music
mixer.music.unpause()
elif song == 'e':
# Stop the mixer
mixer.music.stop()
break
Comments
Post a Comment