npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xgplayer-mp4-loader

v3.0.17

Published

MP4Loader 可以自定义加载单个 MP4 文件。

Downloads

1,350

Readme

MP4Loader

MP4Loader 可以自定义加载单个 MP4 文件。

API

参数

{
  vid: '', // 视频 id,默认为 视频 url
  moovEnd: 8000, // moov 盒子结束
  segmentDuration: 5, // 期望的一个视频分片时长,实际会在该时长附近
  maxDownloadInfoSize: 30, // 最大下载信息数组记录大小
  cache: null, // 自定义 cache 对象
  loaderType: LoaderType.FETCH, // loader 类型,默认 fetch,不支持时会自动降级为 xhr
  retry: 0, // 重试次数
  retryDelay: 0, // ms,每次重试间隔
  timeout: 0, // 请求超时时间,默认不设置
  request: null, // 请求 Request 对象
  onTimeout: undefined, // 超时回调钩子
  onRetryError: undefined, // 单次重试回调钩子
  transformRequest: undefined, // 请求前会调用,可用来修改请求参数
  transformResponse: undefined, // 响应后会调用,可以修改响应对象
  url: '', // mp4 地址
  params: undefined, // url 查询参数,为普通对象
  method: 'GET', // 请求方法
  headers: {}, // 自定义 header
  body: undefined, // post 请求体
  mode: undefined, // 同 fetch
  credentials: undefined, // 同 fetch
  cache: undefined, // 同 fetch
  redirect: undefined, // 同 fetch
  referrer: undefined, // 同 fetch
  referrerPolicy: undefined, // 同 fetch
  integrity: undefined, // 同 fetch
}

属性

const loader = new Loader()

loader.vid // 视频 vid,用于缓存 key
loader.meta // 视频元数据
// {
//   videoCodec, // 视频编码字符串
//   audioCodec, // 音频编码字符串
//   width, // 宽度
//   height, // 高度
//   audioChannelCount, // 音频通道数
//   audioSampleRate, // 音频采样率
//   duration, // 视频时长
//   moov // MP4Parser moov 对象
// }
loader.downloadInfo // 网络下载信息数组
// {
//   startTime, // 开始下载时间戳
//   endTime,   // 结束下载时间戳
//   size,      // 下载数据大小
//   range      // range 范围 [start, end]
// }
loader.cache // loader 当前的 cache 对象

方法

loadMeta