5 Star 35 Fork 13

nygula / Node-Media-Server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test_rtmp_client.js 913 Bytes
一键复制 编辑 原始数据 按行查看 历史
illuspas 提交于 2018-06-24 17:29 . u
const NodeRtmpClient = require('./node_rtmp_client');
let rc = new NodeRtmpClient('rtmp://192.168.0.10/live/stream');
let rp = new NodeRtmpClient('rtmp://192.168.0.20/live/stream');
rc.on('audio', (audioData, timestamp) => {
rp.pushAudio(audioData, timestamp);
});
rc.on('video', (videoData, timestamp) => {
rp.pushVideo(videoData, timestamp);
});
rc.on('script', (scriptData, timestamp) => {
rp.pushScript(scriptData, timestamp);
});
rc.on('status', (info) => {
console.log('player on status', info);
if(info.code === 'NetStream.Play.UnpublishNotify') {
rc.stop();
}
});
rc.on('close', () => {
console.log('player on close');
rp.stop();
});
rp.on('close', () => {
console.log('publisher on close');
rc.stop();
});
rp.on('status', (info) => {
console.log('publisher on status', info);
if (info.code === 'NetStream.Publish.Start') {
rc.startPull();
}
});
rp.startPush();
1
https://gitee.com/nygula/Node-Media-Server.git
git@gitee.com:nygula/Node-Media-Server.git
nygula
Node-Media-Server
Node-Media-Server
master

搜索帮助