Skip to content

WebRTS does not stream through the reverse proxy nginx #4393

Open
@Honepa

Description

@Honepa

Hi, I am trying to implement the following architecture

  1. A container with SRS that does WebRTC translation
  2. The container for processing the input video stream, which is the source of the video stream for the SRS broadcast
  3. Reverse proxy with Nginx, which is the gateway for these two services. At one endpoint, the interface should receive the WebRTC stream, and at the other, data from the second container.

Here is my docker-compose.yml setup :

'''
services:
SRS_TEST_STREAM:
image: ossrs/srs:5
container_name: SRS_TEST_STREAM
environment:
CANDIDATE: 173.50.1.13
command: objs/srs -c conf/rtmp2rtc.conf
stop_grace_period: 10s
expose:
- "1985"
- "1935"
- "8080"
- "8000/udp"
networks:
test_bridge_network:
ipv4_address: 173.50.1.11

video_processing:
depends_on:
- SRS_TEST_STREAM
image: honepa/video_processing:v1
container_name: video_processing
restart: unless-stopped
expose:
- "31001"
volumes:
- config.json:/usr/src/video/config.json
- capture:/usr/src/video/capture
- data:/usr/src/video/data
- run_data:/usr/src/video/run_data
- key.pem:/usr/src/video/key.pem:rw,owner=1000
- cert.pem:/usr/src/video/cert.pem:rw,owner=1000
networks:
test_bridge_network:
ipv4_address: 173.50.1.10
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0']
capabilities: [gpu]
nginx:
depends_on:
- video_processing
- SRS_TEST_STREAM
container_name: nginx_video_processing
image: nginx:latest
ports:
- 31001:80
volumes:
- nginx_default.conf:/etc/nginx/conf.d/default.conf
- key.pem:/etc/nginx/certs/key.pem
- cert.pem:/etc/nginx/certs/cert.pem
networks:
test_bridge_network:
ipv4_address: 173.50.1.13

networks:
test_bridge_network:
driver: bridge
ipam:
config:
- subnet: 173.50.1.0/24
gateway: 173.50.1.1
'''

my nginx setup:

'''
server {

 listen 80 ssl;
 server_name 192.168.89.111;

 ssl_certificate /etc/nginx/certs/cert.pem;
 ssl_certificate_key /etc/nginx/certs/key.pem;

 location /srs/stream {
   proxy_buffering off;
   proxy_pass http://173.50.1.11:1985/rtc/v1/whep/?app=live&stream=livestream;
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";
 }
 

 location ~ /api_ver1/(.*) {
   allow 192.168.10.0/16;
   deny all;
   proxy_pass https://173.50.1.10:31001/$1;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto $scheme;
 }
}

'''

I use this player on the client - https://github.com/Eyevinn/whep-video-component/tree/main

the answer is :
Set video element remote stream to default audio 1 video 1
main.js:432 WebRTC-player Connection failed, reconnecting failed

And I can't connect to the stream, even though the first setup package arrives.

I've tried all the nginx config options, different CANDIDATES, with and without https, nothing works, please help

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnglishNativeThis issue is conveyed exclusively in English.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions