Live streaming quiz

Write a live quiz

First download the live streaming software obs download link: https://obsproject.com/

Next, install nginx. I am lazy and found a source file called tiangolo / nginx-rtmp directly in docker.  

dockerFIle 写

FROM tiangolo / nginx-rtmp 

COPY nginx.conf /etc/nginx/nginx.conf

remember to develop 1935 port
rtmp is mainly a protocol tcp protocol an extension of nginx an
nginx.conf file add this line of code at the bottom of the line
rtmp { 
server {
listen 1935;
listen [::]: 1935 ipv6only = on;
      chunk_size 4000; // size of the slice
# rtmp Live configuration
   application live {
            live on; 
record off;
}
    #HLS live stream configuration
      application hls { 
live on; // Live
hls on; // Enable hls
hls_path / var / www / hls; // Video stream file save address
hls_fragment 1s;
}
}
}

nginx.conf file added at the top
rtmp_auto_push on; the  basic configuration of 

this line of code

is finished. The next step is to push the stream and
open obs ======》 Settings =======》 Push the stream

 

 

ok

My address is hls, so my live broadcast file will generate the corresponding file under / var / www / hls

 

 

 The html layer page only needs to point to the address of the current file to play, and there will be cross-domain problems.

 If you need to add effects such as watermarks to the live page, just use ffmpeg to process 

 

 The whole project is delayed about 5-10s in my LAN

 

 







 

Guess you like

Origin www.cnblogs.com/jhcyzxx/p/12697494.html