The component that streams content from the cloud 🤕☁✨
This component represents the electron app running in the cloud that streams to our stream-consumer. It will be able to send a UI to and receive input from the stream-consumer web app running on a browser.
Our service is compatible with any standard WebRTC signaling implementation. If you need a simple one that communicates over HTTP/1.1, webrtc-signal-http is a good option.
Our service can be configured using a dotenv file - .env
containing one environment variable
key and value per line. For example KEY=value
. Below are the possible options:
SERVICE_URL
(string) - the web service address (to render)TURN_URL
(string) - a turn addressTURN_USERNAME
(string) - a turn usernameTURN_PASSWORD
(string) - a turn password credentialPOLL_URL
(string) - a signaling server base addressPOLL_INTERVAL
(number) - a signaling poll interval in msHEIGHT
(number) - the window heightWIDTH
(number) - the window widthEXP_HIDE_STREAMER
(boolean) - experiment flag for hiding the streamer windowTWILIO_ACCOUNT_SID
(string) - a Twilio AccountSid required to get a Network Traversal Service TokenTWILIO_AUTH_TOKEN
(string) - a Twilio AuthToken required to get a Network Traversal Service Token
Our service supports both coturn and Twilio's STUN/TURN service.
In the dotenv file, if TWILIO_ACCOUNT_SID
and TWILIO_AUTH_TOKEN
values are set, our service will attempt to get a turn server from Twilio. Otherwise, you can leave them empty to use a stun server or coturn turn server.
Our service follows electron security guideline and enables the following behaviors:
- Enabling contextIsolation, which allows scripts running in the renderer to make changes to its javascript environment without worrying about conflicting with the scripts in the electron API or the preload script.
- Blocking mouse middle-clicking, which opens a new window and makes our remote input stop working.
- Disabling popup dialog for file downloading (when clicking on a link) so that it doesn't interfere with the streamer window.
- Displaying warning about using insecure http protocol or when the streamer window navigates to a new origin, which is different from the
SERVICE_URL
.
How to get stream-provider up and running. ⚙
Note: Your
.env
file should be in the stream-provider package directory (next topackage.json
) - for more details see the Configuration section above. Note: OurDockerfile
has a defined display resolution of1920x1080
- You may change this as needed.
You'll need docker to build and run. Once you have it, you can build and run:
Note: the following must be run from the root directory of this repository (probably
browserd
on disk)
# build the container (and source)
docker build . -f components/stream-provider/Dockerfile -t browserd:local
# run
docker run -it --env-file ./components/stream-provider/.env browserd:local
Note: Your
.env
file should be in the project directory (next topackage.json
) - for more details see the Configuration section above.
You'll need Node LTS (v10.x.x)
and npm
(bundled with the node installer) to build and run. Once you have
those, you can install dependencies and run:
# use lerna to hoist dependencies and link local dependencies
npx lerna bootstrap --hoist
# build
npx lerna run build
# run
npm run start