Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webrtc-player

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webrtc-player

webrtcPlayer.js是基于webrtc协议的播放器 兼容各主流流媒体webrtc协议 SRS、ZLM、M7s等

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

webrtcPlayer

webrtcPlayer.js是基于webrtc协议的播放器 兼容各主流流媒体webrtc协议 SRS、ZLM、M7s等

webrtcPlayer.js 基于 JSWebrtc.js 改造而来。

使用说明

1.安装

npm i webrtc-player

2.创建video标签

  <video id="media" src="" muted controls></video>

3.在js中引入 创建实例:

import webrtcPlayer  from 'webrtc-player'

let play;
        play = new webrtcPlayer({
            url: 'webrtc://',
            video: "media",
            // streamingMediaType: 'srs', //如果是srs需要加上这个参数
            autoplay: true,
            onPlay: (e) => {
                console.log('开始播放', e);
            },
            onPause: (e) => {
                console.log('暂停', e);
            }
})

Optinos

webrtcPlayer(optinos)

参数说明类型可选值默认值
url视频地址string--
autoplay是否自动播放boolean--
streamingMediaType流媒体类型(srs必传,其他流媒体可不传)string'srs'|'m7s'...-
onPlay视频开始播放回调Function--
onPause视频暂停播放回调Function--

Events

事件名称说明回调参数
play播放-
stop暂停-
destroy销毁(在外部定义变量赋值时 let play = new webrtcPlayer(options) 在调用destroy后 将play也置为null play=null)-

FAQs

Package last updated on 28 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc