Description
# How to setup
ref: https://hub.docker.com/r/illuspas/node-media-server
1. Install Nodejs
2. mkdir myapp
3. cd myapp
4. npm install node-media-server
5. create app.js and paste this
```js
const NodeMediaServer = require('node-media-server');
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60
},
http: {
port: 8000,
allow_origin: '*'
},
auth: {
api : true,
api_user: 'admin',
api_pass: 'streaming',
}
};
var nms = new NodeMediaServer(config)
nms.run();
```
6. `node app.js`
7. check by heading to `http://your-ip:8000/admin`
# Client side
1. Paste this HTML script
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html, head, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #111;
}
video {
max-width: 100%;
max-height: 100%;
margin: auto;
display: block;
}
</style>
</head>
<body>
<script src="https://cdn.bootcss.com/flv.js/1.5.0/flv.min.js"></script>
<video id="videoElement" controls autoplay></video>
<script>
var videoElement = document.getElementById('videoElement');
var flvPlayer = flvjs.createPlayer({
type: 'flv',
url: 'http://2your-ip:8000/live/YOUR-STREAM-KEY.flv'
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
</script>
</body>
</html>
```
Option