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

custom-player

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-player

webPlayer base of flvjs

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install custom-player --save-dev
//or
<script src="custom-player"></script>
SZPlayer.createPlayer();

Demo

<div id="container"></div>
import FlvPlayer from 'custom-player';
//直播
const container = document.getElementById('container');
const player = FlvPlayer.createPlayer(container, {
      mode: 'real',
      options: {
        stream: 'http://192.168.2.155:1945/34020000001320000145_771/playback.flv',
        reconnectServer: '',
        deviceId: '',
        appId: ''
      }
    });

//回放
const player = FlvPlayer.createPlayer(container, {
      mode: 'playback',
      options: {
        startServer: '',
        stopServer: '',
        beginTimeStamp: '',
        endTimeStamp: '',
        reconnectServer: '',
        deviceId: '',
        appId: ''
      }
    });

Params

keyvalue
mode'real':直播模式;'playback':回放模式;必填
stream直播流地址,直播模式必填
reconnectServer断流重连服务
deviceId设备ID,回放模式和断流重连必填
appId断流重连必填
startServer起流服务,回放模式必填
stopServer停流服务,回放模式必填
beginTimeStamp回放流起始时间戳,精确到秒(s)
endTimeStamp回放流终止时间戳,精确到秒(s)
streamType回放流类型,默认是flv
recordType录像类型 1 手动录像 2 报警录像 4 录像计划 0或不传 表示所有,选填
saveType1 device or 2 oss,选填

API

const player = FlvPlayer.createPlayer(dom, {
      mode: 'real',
      options: {
        ...
      }
    });

getCurrentTime:获取当前播放时间;

player.getCurrentTime();

screenshot:截图,返回base64图片数据;

player.screenshot();

replaceDevice:设备切换,参数 deviceId,appId 回放模式下有效

player.replaceDevice(deviceId, appId);

replaceStream:视频流切换,参数 stream,deviceId, appId 直播模式下有效

player.replaceStream(stream, deviceId, appId);

Keywords

FAQs

Package last updated on 15 Apr 2020

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