def __init__(self, audio_url, video_url, stoken): self.audio_url = audio_url self.video_url = video_url self.stoken = stoken self.audio_client = RTMP(self.audio_url, live=True, token=self.stoken) self.video_client = RTMP(self.video_url, live=True, token=self.stoken) self.audio_client.connect() self.video_client.connect() self.audio_stream = self.audio_client.create_stream() self.video_stream = self.video_client.create_stream() self.recieve_done = False self.continue_recieve = True
def run(self): try: rtmp = RTMP(url='rtmp://127.0.0.1:1935/live/test') print '1' print rtmp print '2' print rtmp.connect() print '3' pkt = rtmp.read_packet() print '4' print pkt print '5' stream = rtmp.create_stream() print '6' print stream # data = stream.read(1024) except RTMPError, e: print e
def test_connect(): with raises(RTMPError): conn = RTMP("rtmp://localhost/app/playpath", live=True) conn.connect()
def test_remote_method(): conn = RTMP("rtmp://localhost/app/playpath", live=True) my_remote_method = conn.remote_method("MyRemoteMethod", block=True) assert callable(my_remote_method) == True assert my_remote_method.__name__ == "MyRemoteMethod"