JSPM

rtc-streamer

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q7912F
  • License MIT

webrtc-streamer

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)
})