python - Switch media while streaming with libVLC. -


streamer.py

import vlc # libvlc import time  class streamer():     def __init__(self):         self.instance = vlc.instance()         sout = "#transcode{acodec=mp3,ab=128,channels=2,samplerate=44100}:http{dst=:8090/streamer.mp3}"         self.media_files = ["file.mp3", "file2.mp3"]         self.instance.vlm_add_broadcast("0", self.media_files[0], sout, 0, none, true, false)         self.instance.vlm_add_broadcast("1", self.media_files[1], sout, 0, none, true, false)         self.instance.vlm_play_media("0")         time.sleep(10)         self.instance.vlm_stop_media("0")         self.instance.vlm_play_media("1")         time.sleep(10)  rs = rasstreamer() 

player:

i using jplayer (demo-8) @ client end.

the problem:

as stop media "0" , play media "1" stops player , have press play button again. there way switch media without stopping player?

preface: i'm no expert on streaming; know i've learned researching how use libvlc.

in between stopping 1 media , starting next one, stream of data physically ends , begins again. in, there short period of time when nothing being broadcast, player stops. theoretically, append new stream previous one, provided have same encoding , container format (as 2 streams do). however, don't think libvlc's bindings support this.

so think best bet make client periodically tries reconnect stream when stream ends.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -