blob: 54bfb6dad9f32f26772a99b8705123fbeb301af6 [file] [log] [blame]
from __future__ import print_function
from twitchstream.outputvideo import TwitchBufferedOutputStream
import numpy as np
if __name__ == "__main__":
with TwitchBufferedOutputStream(
twitch_stream_key="live_997764549_DZ2u2aAJTz7VFGASm8REuzeLyhRUzA",
width=1920,
height=1080,
fps=30.,
verbose=True,
enable_audio=True) as videostream:
frame = np.zeros((480, 640, 3))
while True:
if videostream.get_video_frame_buffer_state() < 30:
frame = np.random.rand(1080, 1920, 3)
videostream.send_video_frame(frame)
if videostream.get_audio_buffer_state() < 30:
left_audio = np.random.randn(1470)
right_audio = np.random.randn(1470)
videostream.send_audio(left_audio, right_audio)