New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0
  • unpublished
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

webrtcPlayer

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

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

用法

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

在js中引入调用创建:

import {webrtcPlayer} from './dist/webrtc-player.es.js'

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

new webrtcPlayer(optinos) optinos配置参数

  • url 视频地址
  • video 视频dom或者dom id
  • autoplay 是否自动播放
  • streamingMediaType type:'srs'|...流媒体类型(srs必传,其他流媒体可不传)
  • onPlay 视频开始播放回调
  • onPause 视频暂停播放回调

new webrtcPlayer(optinos) API

实例 optinos支持以下方法和属性

  • new webrtcPlayer(options).play() 播放
  • new webrtcPlayer(options).stop() 暂停
  • new webrtcPlayer(options).destroy() 销毁(在外部定义变量赋值时 let play = new webrtcPlayer(options) 在调用destroy后 将play也置为null play=null)

构建

如何构建min文件 在dist包中会生成打包文件和类型文件

npm run build

yarn build

pnpm build

FAQs

Package last updated on 26 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