Code for playing audio files:
Code: Select all
import vlc
instance = vlc.Instance()
player = instance.media_player_new()
media = instance.media_new('path/to/mp3')
player.set_media(media)
player.play()
Code: Select all
import vlc
instance = vlc.Instance()
player = instance.media_player_new()
media = instance.media_new('path/to/mp3')
player.set_media(media)
player.play()
Code: Select all
import vlc
def setup_player(name):
vlc_instance = vlc.Instance()
player = vlc_instance.media_player_new()
media = vlc_instance.media_new(name)
player.set_media(media)
player.play()
setup_player('dvd:///O:/') # for no disc menu: 'dvdsimple:///O:/' for audio cd: 'cdda:///O:/' - "O:/" is the optical drive
while True:
pass
Code: Select all
import vlc
def setup_player(name):
vlc_instance = vlc.Instance()
player = vlc_instance.media_player_new()
media = vlc_instance.media_new(name)
player.set_media(media)
player.play()
setup_player('dvd:///H:/') # for no disc menu: 'dvdsimple:///O:/' for audio cd: 'cdda:///O:/' - "O:/" is the optical drive
while True:
pass
Code: Select all
import vlc
def setup_player(name):
vlc_instance = vlc.Instance()
player = vlc_instance.media_player_new()
media = vlc_instance.media_new(name)
player.set_media(media)
player.play()
setup_player('cdda:///H:/') # for no disc menu: 'dvdsimple:///O:/' for audio cd: 'cdda:///O:/' - "O:/" is the optical drive
while True:
pass
that is not right!for audio cd: 'cdda:///O:/'
Code: Select all
import vlc
Player = vlc.MediaPlayer("cdda:///O:/", ":cdda-track=3")
Player.play()
while True:
pass
Code: Select all
import vlc
def setup_player():
instance = vlc.Instance()
player = instance.media_player_new()
medialist = instance.media_list_new()
listplayer = instance.media_list_player_new()
listplayer.set_media_player(player)
for i in (range(1,10)): # the second value for range() can be set without problem also higher
track = instance.media_new("cdda:///O:/", (":cdda-track=" + str(i)))
medialist.add_media(track)
listplayer.set_media_list(medialist)
listplayer.play()
setup_player()
while True:
pass
This is perfect, although I still had to change "O" to "H" before the CD's would play. Thank you very much for the help!@Undefinedmaniac:
With this code you can play a single Track:
With this code you can play a Audio-CD:Code: Select all
import vlc Player = vlc.MediaPlayer("cdda:///O:/", ":cdda-track=3") Player.play() while True: pass
Code: Select all
import vlc def setup_player(): instance = vlc.Instance() player = instance.media_player_new() medialist = instance.media_list_new() listplayer = instance.media_list_player_new() listplayer.set_media_player(player) for i in (range(1,10)): # the second value for range() can be set without problem also higher track = instance.media_new("cdda:///O:/", (":cdda-track=" + str(i))) medialist.add_media(track) listplayer.set_media_list(medialist) listplayer.play() setup_player() while True: pass
Return to “Development around libVLC”
Users browsing this forum: No registered users and 6 guests