botafar 0.0.10

Last updated:

0 purchases

botafar 0.0.10 Image
botafar 0.0.10 Images
Add to Cart

Description:

botafar 0.0.10

botafar

Add global remote controls and a real time livestream to your projects

Share a link and let others take the controls one by one
Forward the livestream to Twitch or YouTube (optional)
No hardware required, a phone can be used as a camera
Arduino and Raspberry Pi tutorials available
Desktop and mobile browser support, no apps, no signups

It works by decorating existing functions and class methods to respond to user input:
import botafar

j = botafar.Joystick("W","A","S","D")

@j.on_left
def turn_left():
print("left!")

@j.on_right
def turn_right():
print("right!")

# [email protected]_up, on_down, on_center

botafar.run()


Check botafar.com for currently online bots!

Get started

Starting scenario
Let's suppose you have a Python project, main.py, where you have defined two functions greet and target:
def greet():
print("hello")

def target():
print("world")

greet()
target()

When you run main.py it calls those functions, and prints "hello" and "world" to the terminal:
$ python main.py
hello
world

You want be able to share a link through which people can remotely call these functions on your hardware, and see the results in real life through a low-latency livestream (and optionally, on Twitch or YouTube as well).
botafar enables you to do all these things.
Add remote controls and livestreaming

Install the library (help)

pip install --upgrade botafar

On some Debian based operating systems such as Raspberry Pi OS, on you need to have libSRTP and other related network dependencies installed to be installed as well: sudo apt install libnss3 libnspr4 libsrtp2-1 -y

Modify main.py:


Import botafar
Create a control, Joystick in this example, and bind 4 keys from keyboard to it
Use decorators (@-symbol) to select functions to call on user input
Call botafar.run()

import botafar

j = botafar.Joystick("W","A","S","D")

@j.on_left
def greet():
print("hello")

@j.on_right
def target():
print("world")

botafar.run()


Execute the main.py file, and open the returned link in browser. Note that this browser can be on other device, for example the Python program can run on a Raspberry Pi and the browser setup is done on a desktop PC's browser (help).

$ python main.py

Bot running, connect at https://botafar.com/abcde-fghij-klmno


From the browser, press the Try controls -button. Now when you press A and D keys from a keyboard or a touch screen, texts "hello" and "world" get printed on terminal.

$ python main.py

Bot running, connect at https://botafar.com/abcde-fghij-klmno
hello
world
hello
world



Choose a stream source from the browser. It can be a webcam, a phone or a screen share (help).


Give your bot a name and switch it to public


The browser now shows a direct link to your bot you can share with anyone in the world! Others can press keyboard or touch screen to print "hello" and "world" to the terminal, and see the prints through a low-latency livestream.




If you got stuck, have an idea or you found a bug, write about it on the GitHub discussions forum. This tool is still under development, and all feedback is appreciated.

Keep reading if you want to learn how to:

Use more botafar features such as printing text to livestream directly
Remote control servos and LEDs with Arduino or Raspberry Pi
Forward the livestream to Twitch or Youtube through OBS

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.