mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 20:52:20 +00:00
Split /app to /stream and /play
This commit is contained in:
parent
f916adc2b4
commit
5f4805bd5c
@ -38,7 +38,7 @@ services:
|
|||||||
- ./ovenmediaengine/conf/Server-docker.xml:/opt/ovenmediaengine/bin/origin_conf/Server.xml:ro
|
- ./ovenmediaengine/conf/Server-docker.xml:/opt/ovenmediaengine/bin/origin_conf/Server.xml:ro
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.ovenmediaengine.rule=Host(`stream.example.com`) && PathPrefix(`/app/`)"
|
- "traefik.http.routers.ovenmediaengine.rule=Host(`stream.example.com`) && PathPrefix(`/play/`)"
|
||||||
- "traefik.http.routers.ovenmediaengine.priority=101"
|
- "traefik.http.routers.ovenmediaengine.priority=101"
|
||||||
- "traefik.http.routers.ovenmediaengine.entrypoints=websecure"
|
- "traefik.http.routers.ovenmediaengine.entrypoints=websecure"
|
||||||
- "traefik.http.routers.ovenmediaengine.tls.certresolver=mytlschallenge"
|
- "traefik.http.routers.ovenmediaengine.tls.certresolver=mytlschallenge"
|
||||||
@ -54,7 +54,7 @@ services:
|
|||||||
- ./nginx/nginx-docker.conf:/etc/nginx/nginx.conf:ro
|
- ./nginx/nginx-docker.conf:/etc/nginx/nginx.conf:ro
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.tcp.routers.rtmp.rule=Host(`stream.example.com`)"
|
- "traefik.tcp.routers.rtmp.rule=HostSNI(`stream.example.com`)"
|
||||||
- "traefik.tcp.routers.rtmp.entrypoints=rtmpsecure"
|
- "traefik.tcp.routers.rtmp.entrypoints=rtmpsecure"
|
||||||
- "traefik.tcp.routers.rtmp.tls.certresolver=mytlschallenge"
|
- "traefik.tcp.routers.rtmp.tls.certresolver=mytlschallenge"
|
||||||
- "traefik.tcp.services.rtmp.loadbalancer.server.port=1925"
|
- "traefik.tcp.services.rtmp.loadbalancer.server.port=1925"
|
||||||
|
@ -18,19 +18,36 @@ stream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Authenticate then stream RTMP
|
|
||||||
# This RTMP server will be used when clients play directly RTMPS.
|
|
||||||
# It also push RTMP stream to OvenMediaEngine to generate WebRTC stream.
|
|
||||||
rtmp {
|
rtmp {
|
||||||
server {
|
server {
|
||||||
listen 127.0.0.1:1925;
|
listen 127.0.0.1:1925;
|
||||||
|
|
||||||
chunk_size 4096;
|
chunk_size 4096;
|
||||||
application app {
|
|
||||||
|
# Application to authenticate incoming stream
|
||||||
|
application stream {
|
||||||
|
# Publish only
|
||||||
|
allow publish all;
|
||||||
|
deny play all;
|
||||||
|
|
||||||
live on;
|
live on;
|
||||||
record off;
|
record off;
|
||||||
push rtmp://127.0.0.1:1915;
|
|
||||||
|
# if publish succeed, it will redirect to /play/
|
||||||
on_publish http://127.0.0.1:8080/rtmp/auth;
|
on_publish http://127.0.0.1:8080/rtmp/auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Application to play stream
|
||||||
|
application play {
|
||||||
|
# Playback only
|
||||||
|
allow publish 127.0.0.1;
|
||||||
|
deny publish all;
|
||||||
|
allow play all;
|
||||||
|
|
||||||
|
live on;
|
||||||
|
record off;
|
||||||
|
|
||||||
|
# Send to OvenMediaEngine
|
||||||
|
push rtmp://127.0.0.1:1915;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,36 @@ events {
|
|||||||
worker_connections 768;
|
worker_connections 768;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Authenticate then stream RTMP
|
|
||||||
# This RTMP server will be used when clients play directly RTMPS.
|
|
||||||
# It also push RTMP stream to OvenMediaEngine to generate WebRTC stream.
|
|
||||||
rtmp {
|
rtmp {
|
||||||
server {
|
server {
|
||||||
listen 0.0.0.0:1925;
|
listen 0.0.0.0:1925;
|
||||||
|
|
||||||
chunk_size 4096;
|
chunk_size 4096;
|
||||||
application app {
|
|
||||||
|
# Application to authenticate incoming stream
|
||||||
|
application stream {
|
||||||
|
# Publish only
|
||||||
|
allow publish all;
|
||||||
|
deny play all;
|
||||||
|
|
||||||
live on;
|
live on;
|
||||||
record off;
|
record off;
|
||||||
push rtmp://ovenmediaengine:1915;
|
|
||||||
|
# if publish succeed, it will redirect to /play/
|
||||||
on_publish http://ghostream:8080/rtmp/auth;
|
on_publish http://ghostream:8080/rtmp/auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Application to play stream
|
||||||
|
application play {
|
||||||
|
# Playback only
|
||||||
|
allow publish 127.0.0.1;
|
||||||
|
deny publish all;
|
||||||
|
allow play all;
|
||||||
|
|
||||||
|
live on;
|
||||||
|
record off;
|
||||||
|
|
||||||
|
# Send to OvenMediaEngine
|
||||||
|
push rtmp://ovenmediaengine:1915;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Pass WebSocket to OvenMediaEngine for WebRTC signalling
|
# Pass WebSocket to OvenMediaEngine for WebRTC signalling
|
||||||
location /app/ {
|
location /play/ {
|
||||||
proxy_pass http://127.0.0.1:3333;
|
proxy_pass http://127.0.0.1:3333;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
|
@ -39,8 +39,8 @@ def auth():
|
|||||||
connect.bind_s(bind_dn, password)
|
connect.bind_s(bind_dn, password)
|
||||||
connect.unbind_s()
|
connect.unbind_s()
|
||||||
app.logger.info("%s logged in successfully", name)
|
app.logger.info("%s logged in successfully", name)
|
||||||
# Remove "?pass=xxx" from RTMP URL
|
# Remove "?pass=xxx" from RTMP URL and redirect to new name
|
||||||
return redirect(f"rtmp://127.0.0.1:1925/app/{name}", code=302)
|
return redirect(f"rtmp://127.0.0.1:1925/play/{name}", code=302)
|
||||||
except Exception:
|
except Exception:
|
||||||
app.logger.warning("%s failed to log in", name)
|
app.logger.warning("%s failed to log in", name)
|
||||||
return 'Incorrect credentials', 401
|
return 'Incorrect credentials', 401
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<b>Serveur :</b>
|
<b>Serveur :</b>
|
||||||
<code>rtmps://{{ config.SITE_HOSTNAME }}:1935/app</code>,
|
<code>rtmps://{{ config.SITE_HOSTNAME }}:1935/stream</code>,
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b>Clé de stream :</b>
|
<b>Clé de stream :</b>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<code>
|
<code>
|
||||||
ffmpeg -re -i mavideo.webm -vcodec libx264 -vprofile baseline
|
ffmpeg -re -i mavideo.webm -vcodec libx264 -vprofile baseline
|
||||||
-acodec aac -strict -2 -f flv
|
-acodec aac -strict -2 -f flv
|
||||||
rtmps://{{ config.SITE_HOSTNAME }}:1935/app/IDENTIFIANT?pass=MOT_DE_PASSE
|
rtmps://{{ config.SITE_HOSTNAME }}:1935/stream/IDENTIFIANT?pass=MOT_DE_PASSE
|
||||||
</code>
|
</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<path fill-rule="evenodd" d="M1.5 13A1.5 1.5 0 0 0 3 14.5h8a1.5 1.5 0 0 0 1.5-1.5V9a.5.5 0 0 0-1 0v4a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 0 0-1H3A1.5 1.5 0 0 0 1.5 5v8zm7-11a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-1 0V2.5H9a.5.5 0 0 1-.5-.5z"/>
|
<path fill-rule="evenodd" d="M1.5 13A1.5 1.5 0 0 0 3 14.5h8a1.5 1.5 0 0 0 1.5-1.5V9a.5.5 0 0 0-1 0v4a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 0 0-1H3A1.5 1.5 0 0 0 1.5 5v8zm7-11a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-1 0V2.5H9a.5.5 0 0 1-.5-.5z"/>
|
||||||
<path fill-rule="evenodd" d="M14.354 1.646a.5.5 0 0 1 0 .708l-8 8a.5.5 0 0 1-.708-.708l8-8a.5.5 0 0 1 .708 0z"/>
|
<path fill-rule="evenodd" d="M14.354 1.646a.5.5 0 0 1 0 .708l-8 8a.5.5 0 0 1-.708-.708l8-8a.5.5 0 0 1 .708 0z"/>
|
||||||
</svg>
|
</svg>
|
||||||
<code>rtmps://{{ config.SITE_HOSTNAME }}:1935/app/{{ path }}</code>
|
<code>rtmps://{{ config.SITE_HOSTNAME }}:1935/play/{{ path }}</code>
|
||||||
<a href="#" id="chatToggle" title="Cacher/Afficher le chat">»</a>
|
<a href="#" id="chatToggle" title="Cacher/Afficher le chat">»</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -47,7 +47,7 @@ player = OvenPlayer.create("player", {
|
|||||||
expandFullScreenUI: true,
|
expandFullScreenUI: true,
|
||||||
sources: [
|
sources: [
|
||||||
{
|
{
|
||||||
"file": "wss://{{ config.SITE_HOSTNAME }}/app/{{ path }}",
|
"file": "wss://{{ config.SITE_HOSTNAME }}/play/{{ path }}",
|
||||||
"type": "webrtc",
|
"type": "webrtc",
|
||||||
"label": "WebRTC Source"
|
"label": "WebRTC Source"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user