Package Exports
- rtc-streamer
- rtc-streamer/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rtc-streamer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
- 支持 TypeScript
- 与 SRS 服务结合使用
开始
安装
npm i rtc-streamer --save
使用
拉流
import { SrsRtcPlayerAsync } from "rtc-streamer";
const srs = new SrsRtcPlayerAsync();
const video = document.getElementsByTagName("video");
video.srcObject = srs.stream;
srs.play(`webrtc://192.168.18.140/test/test`).catch((error) => {
console.log(error);
});
推流
import { SrsRtcPublisherAsync } from 'rtc-streamer'
const srs = new SrsRtcPublisherAsync()
srs.publish(`webrtc://192.168.18.140/test/test`).catch((error: any) => {
console.log(error)
})