How can I play audio stream without saving it into the file with pyglet?

前端 未结 1 1552
梦毁少年i
梦毁少年i 2020-12-20 01:02

Now I have these libraries: requests, pyglet, pyaudio

How can I play an audio stream using ones, for example, from

相关标签:
1条回答
  • 2020-12-20 01:45

    If you just want to play a file (audio/video) from a url without saving, you can use vlc as below.
    Details on vlc are here

    You can install vlc (on windows) as

    pip install python-vlc
    

    Source Code

    import vlc
    
    url = 'http://ic7.101.ru:8000/c15_3'
    #define VLC instance
    instance = vlc.Instance('--input-repeat=-1', '--fullscreen')
    
    #Define VLC player
    player=instance.media_player_new()
    
    #Define VLC media
    media=instance.media_new(url)
    
    #Set player media
    player.set_media(media)
    
    #Play the media
    player.play()
    
    0 讨论(0)
提交回复
热议问题