Quickly get a live platform by docker
目录
nginx-rtmp Dockerfile by jasonrivers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
FROM alpine:latest as builder MAINTAINER Jason Rivers <docker@jasonrivers.co.uk> ARG NGINX_VERSION=1.15.3 ARG NGINX_RTMP_VERSION=1.2.1 RUN apk update && \ apk add \ git \ gcc \ binutils \ gmp \ isl \ libgomp \ libatomic \ libgcc \ openssl \ pkgconf \ pkgconfig \ mpfr3 \ mpc1 \ libstdc++ \ ca-certificates \ libssh2 \ curl \ expat \ pcre \ musl-dev \ libc-dev \ pcre-dev \ zlib-dev \ openssl-dev \ curl \ make RUN cd /tmp/ && \ curl --remote-name http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \ git clone https://github.com/arut/nginx-rtmp-module.git -b v${NGINX_RTMP_VERSION} RUN cd /tmp && \ tar xzf nginx-${NGINX_VERSION}.tar.gz && \ cd nginx-${NGINX_VERSION} && \ ./configure \ --prefix=/opt/nginx \ --with-http_ssl_module \ --add-module=../nginx-rtmp-module && \ make && \ make install FROM alpine:latest RUN apk update && \ apk add \ openssl \ libstdc++ \ ca-certificates \ pcre COPY --from=0 /opt/nginx /opt/nginx COPY --from=0 /tmp/nginx-rtmp-module/stat.xsl /opt/nginx/conf/stat.xsl RUN rm /opt/nginx/conf/nginx.conf ADD run.sh / EXPOSE 1935 EXPOSE 8080 CMD /run.sh |
docker run command
1 2 3 4 5 6 7 |
docker run \ -d --restart=always \ --name=rtmp \ -p 1935:1935 \ -p 8080:8080 \ -e RTMP_STREAM_NAMES=live1,live2 \ jasonrivers/nginx-rtmp |
rtmp config infomation
push rtmp address
custom media, rtmp://ipaddress:1935/live1 cpplastream1
pull rtmp address
vlc player, rtmp://ipaddress:1935/live1/cpplastream1
rtmp server status
http://ipaddress:8080/stat
m3u8 player address
http://ipaddress:8080/hls/cpplastream1.m3u8
html dplayer code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>cpp.la</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer@1.25.0/dist/DPlayer.min.css"> <script src="https://cdn.jsdelivr.net/npm/dplayer@1.25.0/dist/DPlayer.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> </head> <body> <div id="dplayer"></div> <input type="text" id="url" value="http://ipaddress:8080/hls/cpplastream1.m3u8"> <button type="button" onclick="load()">载入</button> <script> function load() { var url = document.getElementById('url').value; const dp = new DPlayer({ container: document.getElementById('dplayer'), video: { url: url, type: 'hls' } }); } </script> </body> </html> |
demo show by cpp.la
http://tv.cpp.la/tv.html
by cpp.la 20190118