Giter VIP home page Giter VIP logo

ovenspace's Introduction

OvenSpace

What is OvenSpace?

OvenSpace is Sub-Second Latency Streaming Demo Service using OvenMediaEngine as a streaming server, OvenPlayer as a player, and OvenLiveKit as a live streaming encoder. OvenSpace allows you to stream your Webcam, Microphone, and Screen with Sub-Second Latency using WebRTC in your browser. You can also stream your video using an external live encoder that supports RTMP and SRT. And viewers can choose to watch the video over the WebRTC or LLHLS protocol.

Demo

In the current demo service, 9 people can broadcast at the same time and many viewers can watch.

Please visit the OvenSpace Demo and experience Sub-Second Latency Streaming.

Features

  • Ingest
    • WebRTC (Webcam, Microphone, Screen Sharing in the browser without plug-ins)
    • RTMP, SRT
  • Streaming
    • Sub-Second Latency Streaming using WebRTC
    • Low Latency Streaming using LLHLS
  • Large-scale and High-definition
  • Available on Desktop and Mobile Browsers without Plugins
  • Can be configured to use your own OvenMediaEngine

Installation

OvenSpace installation is described below.

Requires Python 3.6 or higher

OvenSpace can run using the Flask web framework in a Python 3.6+ environment. However, if your operating system does not have Python 3.6 or later installed, you need to install it.

Install OvenSpace

Clone the repository and navigate into the project directory

$ git clone https://github.com/AirenSoft/OvenSpace.git && cd OvenSpace

Create a virtual environment for Python. Make sure you are using Python 3.6 or a higher version, and activate the virtual environment. A detailed explanation is here.

$ python -m venv venv
$ source venv/bin/activate

Install all required Python modules for OvenSpace.

(venv) $ pip install -r requirements.txt

This completes the OvenSpace installation.

Check out the Quick Start section below to get started with OvenSpace for development or testing.

Quick Start

Launch OvenMediaEngine using docker

You can use Server_no_tls.xml to run OvenMediaEngine with docker with the command below in the project directory.

$ docker run -d -p 3333:3333 -p 3478:3478 -p 8081:8081 -p 10006-10010:10006-10010/udp -v $PWD/Server_no_tls.xml:/opt/ovenmediaengine/bin/origin_conf/Server.xml airensoft/ovenmediaengine:latest

Launch OvenSpace

Start OvenSpace using the preset ovenspace.cfg for OvenMediaEngine running with the Docker above. OvenSpace runs on the built-in development server of Flask.

(venv) $ python OvenSpace.py

You can check the OvenSpace running at http://localhost:5000.

This quick start is a simple method for testing and development purposes. Running OvenSpace in a real environment is described in the Deploy OvenSpace.

Configuration

OvenSpace Configuration

The ovenspace.cfg file allows you to configure the settings needed to connect with the OvenMediaEngine from the OvenSpace. The settings are as follows:

OME_HOST = 'your.oven_media_engine.com'

OME_API_ENABLE_TLS = 'true'
OME_API_PORT = '8082'
OME_API_ACCESS_TOKEN = 'your_api_access_token'

OME_VHOST_NAME = 'default'
OME_APP_NAME = 'app'
OME_STREAM_NAME = 'stream'

OME_RTMP_PROVIDER_PORT = '1935'

OME_SRT_PROVIDER_PORT = '9999'

OME_WEBRTC_PROVIDER_ENABLE_TLS = 'true'
OME_WEBRTC_PROVIDER_PORT = '3333'

OME_WEBRTC_PUBLISHER_ENABLE_TLS = 'true'
OME_WEBRTC_PUBLISHER_PORT = '3333'

OME_LLHLS_PUBLISHER_ENABLE_TLS = 'false'
OME_LLHLS_PUBLISHER_PORT = '3333'

OME_HOST

Set the OvenMediaEngine's domain or IP address. For a TLS connection, set the domain.

OME_API_ENABLE_TLS

'true' or 'false'. Determines whether to use TLS when calling OvenMediaEngine's REST API.

OME_API_PORT

Sets the port of OvenMediaEngine's REST API Server. If you set OME_API_ENABLE_TLS to 'true' use the TLSPort of OvenMediaEngine API Server.

OME_API_ACCESS_TOKEN

Sets the token to be used for authentication when calling the OvenMediEngin REST APIs.

OME_VHOST_NAME

Sets the virtual host of OvenMediaEngine that OvenSpace will use.

OME_APP_NAME

Sets the application name of OvenMediaEngine that OvenSpace will use.

OME_STREAM_NAME

Sets the stream name that OvenSpace will use to send or receive streams to the OvenMediaEngine. If OME_STREAM_NAME is set to 'stream-', OvenSpace sends and receives streams in the format 'stream-0', 'stream-1', 'stream-2'.

OME_RTMP_PROVIDER_PORT

Sets the port of RTMP Provider.

OME_SRT_PROVIDER_PORT

Sets the port of SRT Provider.

OME_WEBRTC_PROVIDER_ENABLE_TLS

'true' or 'false'. Determines whether to use TLS when signalling with OvenMediaEngine's WebRTC Provider.

OME_WEBRTC_PROVIDER_PORT

Sets the signalling port of WebRTC Provider. If you set OME_WEBRTC_PROVIDER_ENABLE_TLS to 'true' use the TLSPort of WebRTC Provider.

OME_WEBRTC_PUBLISHER_ENABLE_TLS

'true' or 'false'. Determines whether to use TLS when signalling with OvenMediaEngine's WebRTC Publisher.

OME_WEBRTC_PUBLISHER_PORT

Sets the signalling port of WebRTC Publisher. If you set OME_WEBRTC_PUBLISHER_ENABLE_TLS to 'true' use the TLSPort of WebRTC Publisher.

OME_LLHLS_PUBLISHER_ENABLE_TLS

'true' or 'false'. Determines whether to use TLS when playback OvenMediaEngine's LLHLS Publisher.

OME_LLHLS_PUBLISHER_PORT

Sets the playback port of LLHLS Publisher. If you set OME_LLHLS_PUBLISHER_ENABLE_TLS to 'true' use the TLSPort of LLHLS Publisher.

OvenMediaEngine Configuration

When not using TLS, the minimum settings of OvenMediaEngine's Server.xml required for OvenSpace is: Server.xml

Deploy OvenSpace

When trying to use OvenSpace in the real world, browsers only allow access to user devices such as webcams when they have a secure connection, so OvenSpace must be serviced over HTTPS.

If OvenSpace is serviced with HTTPS, of course, signaling with OvenMediaEngine must also use TLS. This section describes how to service OvenSpace with HTTPS using NGINX and TLS settings for OvenMediaEngine.

To serve OvenSpace over HTTPS, we need a domain name and SSL certificate.

Setting TLS on OvenMediaEngine

We need to make OvenMediaEngine's REST API Server, WebRTC Provider, and WebRTC Publisher work with TLS. You may find it helpful to refer to this manual and links of OvenSpace configuration.

After all the minimal setting of OvenMediaEngine's Server.xml will look like Server.xml

Launch OvenSpace (Advanced)

In the Quick Start section. We used Flask's built-in development server to run OvenSpace.

When deploying OvenSpace, WSGI HTTP Server called Gunicorn is used in consideration of performance. Gunicorn is installed while installing OvenSpace.

You can run OvenSpace on Gunicorn with this command.

Don't forget to set OME_API_ENABLE_TLS, OME_WEBRTC_PROVIDER_ENABLE_TLS, OME_WEBRTC_PUBLISHER_ENABLE_TLS to 'true' in ovenspace.cfg.

$ source venv/bin/activate
(venv) $ gunicorn --bind 0.0.0.0:5000 --worker-class eventlet -w 1 --threads 1 OvenSpace:app

Or execute run.sh script. This script runs gunicorn as a background process.

Nginx Setup

We will set up SSL certification on Nginx and have Nginx forward all requests to OvenSpace.

server {
    listen       443 ssl;
    server_name  www.yourdomain.com;

    ssl_certificate /your/path/to/cert_file.crt;
    ssl_certificate_key /your/path/to/key_file.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers   on;

    # Forward all requests to OvenSpace.

    location / {
        proxy_pass http://127.0.0.1:5000;
    }

    location /socket.io {
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://127.0.0.1:5000/socket.io;
    }
}

# Redirect http request to https
server {
    listen       80;
    server_name  www.yourdomain.com;

    rewrite ^(.*) https://www.yourdomain.com$1 permanent;
}

Once everything is set up, you can see the OvenSpace running at https://www.yourdomain.com, and the deployment is complete.

For more information

License

OvenSpace is licensed under the MIT license.

About AirenSoft

AirenSoft aims to make it easier for you to build a stable broadcasting/streaming service with Sub-Second Latency. Therefore, we will continue developing and providing the most optimized tools for smooth Sub-Second Latency Streaming.

Would you please click on each link below for details:

ovenspace's People

Contributors

getroot avatar lee-hammer99 avatar sangwonoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ovenspace's Issues

Launch OvenSpace (Advanced)

Hi!

I am trying to run ovenspace with TLS certificates and Nginx but the OvenmediaEngine server returns the following error:

[[2022-03-09 17:20:30.157] E [SPAPIServer-T80:1916] OpenSSL | tls.cpp:193 | An error occurred while accept SSL connection: [OpenSSL] error:0A000418:SSL routines::tlsv1 alert unknown ca (167773208)
[2022-03-09 17:20:30.158] E [SPAPIServer-T80:1916] OpenSSL | tls_server_data.cpp:108 | An error occurred while accept TLS connection: error code: 1]

I detail below the steps followed and the configuration set up.

NGINX CONFIGURATION

First I set up the recommended NGINX configuration and restart NGINX.

server {
    listen       443 ssl;
    server_name  my_domain;

    ssl_certificate /your/path/to/my_cert_file.crt;
    ssl_certificate_key /your/path/to/my_key_file.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers   on;

    location / {
        proxy_pass http://127.0.0.1:5000;
    }

    location /socket.io {
        proxy_http_version 1.1;
        proxy_buffering off;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass http://127.0.0.1:5000/socket.io;
    }
}

server {
    listen       80;
    server_name  my_domain;

    rewrite ^(.*) https://my_domain$1 permanent;
}

I generated the self-signed certificates with openssl for the machine, where server_name is the name of the machine.

OVENMEDIAENGINE CONFIGURATION

After that I make OvenMediaEngine's REST API Server, WebRTC Provider, and WebRTC Publisher work with TLS and restart OvenMediaEngine.

<Managers>
		<Host>
			<Names>
				<Name>*</Name>
			</Names>

			<TLS>
				<CertPath>path/to/my_cert_file.crt</CertPath>
				<KeyPath>path/to/my_cert_file.crt</KeyPath>
				<!-- <ChainCertPath>airensoft_com_chain.crt</ChainCertPath> -->
			</TLS>
		</Host>
		<API>
			<AccessToken>my_access_token</AccessToken>
		</API>

</Managers>

<Domain>
		<Names>
			<Name>*</Name>
		</Names>
		<TLS>
			<CertPath>path/to/my_cert_file.crt</CertPath>
			<KeyPath>path/to/my_key_file.key</KeyPath>
			<!-- <ChainCertPath>path/to/file.crt</ChainCertPath> -->
		</TLS>
</Domain>

Finally, I set up the OvenSpace configuration and run the .py file.

OVENSPACE CONFIGURATION

Finally, I set up the OvenSpace configuration and run the .py file.

OME_HOST = 'machine_name'

OME_API_ENABLE_TLS = 'true'
OME_API_PORT = '8082'
OME_API_ACCESS_TOKEN = 'access-token'

OME_VHOST_NAME = 'default'
OME_APP_NAME = 'app'
OME_STREAM_NAME = 'stream'

OME_WEBRTC_PROVIDER_ENABLE_TLS = 'true'
OME_WEBRTC_PROVIDER_PORT = '8333'

OME_WEBRTC_PUBLISHER_ENABLE_TLS = 'true'
OME_WEBRTC_PUBLISHER_PORT = '8333'

BROWSER CONSOLE

When I access the address 'https://machine_name' from the browser, it returns the following error in the browser console:

[/getStreams:1 Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR)
ovenspace.js:486 Could not get streams from OME.]

OVENSPACE LOGS

The OvenSpace logs are follows:

  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 327-571-840
    (1969) wsgi starting up on http://0.0.0.0:5000
    (1969) accepted ('127.0.0.1', 36050)
    127.0.0.1 - - [09/Mar/2022 17:19:59] "GET / HTTP/1.0" 200 7553 0.006798
    (1969) accepted ('127.0.0.1', 36052)
    127.0.0.1 - - [09/Mar/2022 17:19:59] "GET /static/css/ovenspace.css HTTP/1.0" 30 4 163 0.002619
    (1969) accepted ('127.0.0.1', 36054)
    127.0.0.1 - - [09/Mar/2022 17:19:59] "GET /static/img/ovenspace_bi.svg HTTP/1.0" 304 166 0.001761
    (1969) accepted ('127.0.0.1', 36056)
    127.0.0.1 - - [09/Mar/2022 17:19:59] "GET /static/js/ovenspace.js HTTP/1.0" 304 162 0.001767
    (1969) accepted ('127.0.0.1', 36058)
    127.0.0.1 - - [09/Mar/2022 17:19:59] "GET /favicon.ico HTTP/1.0" 404 375 0.00051 0
    (1969) accepted ('127.0.0.1', 36060)
    (1969) accepted ('127.0.0.1', 36062)
    127.0.0.1 - - [09/Mar/2022 17:20:02] "GET /getStreams HTTP/1.0" 500 443 0.027744
    (1969) accepted ('127.0.0.1', 36064)
    127.0.0.1 - - [09/Mar/2022 17:20:02] "GET /getStreams HTTP/1.0" 500 443 0.011921
    (1969) accepted ('127.0.0.1', 36066)
    127.0.0.1 - - [09/Mar/2022 17:20:02] "GET /static/img/ovenspace.ico HTTP/1.0" 30 4 163 0.001610
    (1969) accepted ('127.0.0.1', 36068)
    127.0.0.1 - - [09/Mar/2022 17:20:05] "GET /getStreams HTTP/1.0" 500 443 0.015352
    (1969) accepted ('127.0.0.1', 36070)
    127.0.0.1 - - [09/Mar/2022 17:20:07] "GET /static/img/ovenspace.ico HTTP/1.0" 30 4 163 0.001209
    (1969) accepted ('127.0.0.1', 36072)
    127.0.0.1 - - [09/Mar/2022 17:20:07] "GET /getStreams HTTP/1.0" 500 443 0.012447
    (1969) accepted ('127.0.0.1', 36074)
    127.0.0.1 - - [09/Mar/2022 17:20:10] "GET /getStreams HTTP/1.0" 500 443 0.012753
    (1969) accepted ('127.0.0.1', 36076)
    127.0.0.1 - - [09/Mar/2022 17:20:12] "GET /getStreams HTTP/1.0" 500 443 0.015085
    (1969) accepted ('127.0.0.1', 36078)
    127.0.0.1 - - [09/Mar/2022 17:20:14] "GET /static/css/ovenspace.css HTTP/1.0" 30 4 163 0.001055
    (1969) accepted ('127.0.0.1', 36080)
    127.0.0.1 - - [09/Mar/2022 17:20:15] "GET /getStreams HTTP/1.0" 500 443 0.012835
    (1969) accepted ('127.0.0.1', 36084)
    127.0.0.1 - - [09/Mar/2022 17:20:17] "GET /getStreams HTTP/1.0" 500 443 0.014948
    (1969) accepted ('127.0.0.1', 36086)
    127.0.0.1 - - [09/Mar/2022 17:20:20] "GET /getStreams HTTP/1.0" 500 443 0.011937
    (1969) accepted ('127.0.0.1', 36088)
    127.0.0.1 - - [09/Mar/2022 17:20:22] "GET /getStreams HTTP/1.0" 500 443 0.013110
    (1969) accepted ('127.0.0.1', 36090)
    127.0.0.1 - - [09/Mar/2022 17:20:25] "GET /getStreams HTTP/1.0" 500 443 0.012097
    (1969) accepted ('127.0.0.1', 36092)
    127.0.0.1 - - [09/Mar/2022 17:20:27] "GET /getStreams HTTP/1.0" 500 443 0.011840
    (1969) accepted ('127.0.0.1', 36094)
    127.0.0.1 - - [09/Mar/2022 17:20:30] "GET /getStreams HTTP/1.0" 500 443 0.015287
    127.0.0.1 - - [09/Mar/2022 17:20:31] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 200 0 28.837320

OVENMEDIAENGINE LOGS

Furthermore, in the OvenMediaEngine logs, I get the error mentioned at the beginning of this message:

[[2022-03-09 17:20:30.157] E [SPAPIServer-T80:1916] OpenSSL | tls.cpp:193 | An error occurred while accept SSL connection: [OpenSSL] error:0A000418:SSL routines::tlsv1 alert unknown ca (167773208)
[2022-03-09 17:20:30.158] E [SPAPIServer-T80:1916] OpenSSL | tls_server_data.cpp:108 | An error occurred while accept TLS connection: error code: 1]

Integrate OvenSpace into OvenMediaEngine Stream/player

Hi!

I'm using OME to stream review sessions with clients.

Currently, I use it in conjunction with ZOOM for communicating.

Would it be possible to integrate OvenSpace directly into my OME stream, so that my clients and I can talk, see each other and the stream all through the 1 Player page/stream?

Thank you

[object event] shown when clicking "start sharing"

This could be a naive question, but whenever I try to click start sharing, nothing happens except a red "[object event]" text is shown under the preview box.
For now I'm only following the steps shown in quick start but things just seems to not work for me. I'm also confused about the reason to run an OME container because even if I shut the container down, the webpage gives me the exact same response. It could have been me to connect the wrong ports (maybe), but I would love any advice or tips to make the demo work.
Thanks in advance for any help :)

Edit:
Seems like I've made some error in my Server.xml file, resolved after fixing it

'eventlet' invalid or not found

I am trying to run OvenSpace on Ubuntu with Python3.10 without success. Still getting:
Error: class uri 'eventlet' invalid or not found
I already tried several version of enventlet from 0.28.0 up to 33.1 without success.

Error: class uri 'eventlet' invalid or not found

[Traceback (most recent call last):
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/gunicorn/util.py", line 99, in load_class
    mod = importlib.import_module('.'.join(components))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/gunicorn/workers/geventlet.py", line 10, in <module>
    import eventlet
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/__init__.py", line 17, in <module>
    from eventlet import convenience
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/green/socket.py", line 21, in <module>
    from eventlet.support import greendns
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/support/greendns.py", line 66, in <module>
    setattr(dns, pkg, import_patched('dns.' + pkg))
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/support/greendns.py", line 61, in import_patched
    return patcher.import_patched(module_name, **modules)
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/patcher.py", line 132, in import_patched
    return inject(
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/eventlet/patcher.py", line 109, in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
  File "/home/anubis/OvenSpace/venv/lib/python3.10/site-packages/dns/namedict.py", line 35, in <module>
    class NameDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
]

Error starting locally

Followed exact the readme.
Server gives

[2024-01-31 23:35:00.069] I [OvenMediaEngine:1] Config | config_manager.cpp:239  | Trying to set logfile in directory... (/var/log/ovenmediaengine)
[2024-01-31 23:35:00.069] I [OvenMediaEngine:1] Config | config_manager.cpp:261  | Trying to load configurations... (origin_conf/Server.xml)
[2024-01-31 23:35:00.071] E [OvenMediaEngine:1] OvenMediaEngine | main.cpp:295  | An error occurred while load config: [Config] Unknown item found: Application.publishers.SessionLoadBalancingThreadCount in origin_conf/Server.xml

No changes. I followed exactly.

There is 1 error the Server.xml is not named Server.xml and docs still say

$ docker run -d -p 3333:3333 -p 3478:3478 -p 8081:8081 -p 10006-10010:10006-10010/udp -v $PWD/Server_no_tls.xml:/opt/ovenmediaengine/bin/origin_conf/Server.xml airensoft/ovenmediaengine:latest

Server_no_tls.xml

I tried firefox and chrome on OSX.

Both fail.

Any suggestions what might be the solution for this? thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.