rtmp【停用】
<h1>rtmp</h1>
<h2>状态</h2>
<blockquote>
<p>Stop</p>
</blockquote>
<h2>使用</h2>
<h3>示例</h3>
<p>DPlayer在线加载直播流(推流时间不固定,可自建测试):<a href="http://menhood.iok.la:8090/">http://menhood.iok.la:8090/</a></p>
<h3>推流</h3>
<p>地址</p>
<pre><code>rtmp://menhood.iok.la:1935/live/自定义名称</code></pre>
<p>设置方式(<strong>OBS</strong>)</p>
<table>
<thead>
<tr>
<th style="text-align: left;">项</th>
<th style="text-align: left;">参数</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">流类型</td>
<td style="text-align: left;">自定义流媒体服务器</td>
</tr>
<tr>
<td style="text-align: left;">URL</td>
<td style="text-align: left;">rtmp://menhood.iok.la:1935/live</td>
</tr>
<tr>
<td style="text-align: left;">流名称(key)</td>
<td style="text-align: left;">hello(可以自定义)</td>
</tr>
</tbody>
</table>
<h3>拉流</h3>
<pre><code>rtmp://menhood.iok.la:1935/live/自定义名称
http://menhood.iok.la:8090/hls/自定义名称.m3u8</code></pre>
<p>DPlayer使用方法(注意跨域问题)</p>
<pre><code class="language-html"><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>DPlayer - rtmp</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://menhood.iok.la:8090/hls/hello.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></code></pre>
<h2>自建</h2>
<p>GitHub:<a href="https://github.com/JasonRivers/Docker-nginx-rtmp">https://github.com/JasonRivers/Docker-nginx-rtmp</a></p>
<pre><code class="language-shell">docker pull jasonrivers/nginx-rtmp #拉取
docker run -p 1935:1935 -p 8090:8080 jasonrivers/nginx-rtmp #构建
docker stop 镜像id #停止
docker start 镜像id #启动
docker exec -it 镜像id /bin/sh #进入镜像</code></pre>