加入 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();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化