Live Streaming with Youtube and USB WebCam

In this tutorial you learn to insert a dual-state widget button, connected to the function that starts or stops youtube live streaming.

Press AutoRun button in system menĂ¹ bar for open the control panel

SgneepBox-script:

( 1 ) connect usbcam to raspberry Pi3

( 2 ) press WIN + F11 to open sgneepBox editor

( 3 ) copy and paste code in IDE


# Set USBCAM Microphone ( use arecord -l for device list )

if don't use Seedstudio Respeaker close pulseaudio with this command: sudo killall pulseaudio


Copy and paste to SgneepBox-IDE

# Example One:

youtube_hw 1

youtube_url rtmp://x.rtmp.youtube.com/****

youtube_key 3ms1-fgvx-b235-3d5za

youtube_stream 320x200

#

# end...


Example Two:

Streaming Function + two button for start and stop stream:

in sgneepBox Script Editor :

# start streaming ( use button widget):

button_xy bt0 460 451

button_dim bt0 40 40

button_img bt0 button_blue.jpg

button_press bt0 button_red.jpg

button_unpress_call bt0 youtube_stream

button_call bt0 youtube_stream

button_run bt0

#

# stop streaming ( use button widget)

button_xy bt1 460 451

button_dim bt1 40 40

button_img bt1 button_blue.jpg

button_press bt1 button_red.jpg

button_unpress_call bt1 youtube_stream

button_call bt1 youtube_stream

button_run bt1

#

# make subfunction with name 'youtube_stream' and add:

# Set USBCAM Microphone ( use arecord -l for device list )

youtube_hw 1

# Set USBCAM AV Streaming

youtube_url rtmp://x.rtmp.youtube.com/****

youtube_key 3ms1-fgvx-b235-3d5za

youtube_stream 320x200

#

# make subfunction with name 'youtube_stream' and add:

# Set USBCAM Microphone ( use arecord -l for device list )

#

#

#

# make subfunction with name 'youtube_stop' and add:

youtube_kill

( 4 ) Launch this script with RUN/RUN SCRIPT in main menĂ¹ of SgneepBox-IDE