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

xgplayer-mp4

Package Overview
Dependencies
Maintainers
0
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xgplayer-mp4

xgplayer plugin for mp4 transform to fmp4

  • 3.0.20
  • latest
  • Source
  • npm
  • Socket score

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

xgplayer-mp4

简介

xgplayer-mp4模块基于MSE方式实现mp4的播放控制。

MP4播放

import Player from "xgplayer"
import Mp4Plugin from "xgplayer-mp4"
import "xgplayer/dist/xgplayer.min.css"



const player = new Player({
    url,
    id,
    autoplay: true,
    height: window.innerHeight,
    width: window.innerWidth,
    plugins: [Mp4Plugin],
    mp4plugin: {
      maxBufferLength: 30,
      minBufferLength: 10, 
      reqOptions:{
        mode: 'cors',
        method: 'POST',
        headers: { // 需要带的自定义请求头
          'x-test-header': 'rrrr'
        },
      }  
      // ... 其他配置
    }
})

player.on('canplay', ()=>{
    // do something
})

可配置的能力

配置字段默认值含义
maxBufferLength40播放的最大的buffer长度(s)
minBufferLength5播放的最小的buffer长度(s)
disableBufferBreakCheckfalse是否开启卡顿超时检测
waitingTimeOut15s卡顿超时时间
waitingInBufferTimeOut5s在buffer区间内的卡顿超时时间
waitJampBufferMaxCnt3一次播放中在buffer区间内卡顿超时最多可以seek调整几次
chunkSize15625第一次请求的数据的size长度
tickInSeconds0.1驱动下载的timer的时间间隔
segmentDuration5s一次下载数据的最小视频时长
onProcessMinLen1024fetch每次回调数据的最小长度
retryCount2loader请求失败时的重试次数
retryDelay1000重试的时间间隔(ms)
timeout3000loader请求的超时时间(ms)
enableWorkerfalsetransmux是否使用worker

Keywords

FAQs

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