blob: 54bfb6dad9f32f26772a99b8705123fbeb301af6 [file] [log] [blame]
Samuel Shuert36336c12023-11-29 17:17:57 -05001from __future__ import print_function
2from twitchstream.outputvideo import TwitchBufferedOutputStream
3import numpy as np
4
5if __name__ == "__main__":
6 with TwitchBufferedOutputStream(
7 twitch_stream_key="live_997764549_DZ2u2aAJTz7VFGASm8REuzeLyhRUzA",
8 width=1920,
9 height=1080,
10 fps=30.,
11 verbose=True,
12 enable_audio=True) as videostream:
13
14 frame = np.zeros((480, 640, 3))
15
16 while True:
17 if videostream.get_video_frame_buffer_state() < 30:
18 frame = np.random.rand(1080, 1920, 3)
19 videostream.send_video_frame(frame)
20
21 if videostream.get_audio_buffer_state() < 30:
22 left_audio = np.random.randn(1470)
23 right_audio = np.random.randn(1470)
24 videostream.send_audio(left_audio, right_audio)