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

usc-player-new

v1.3.1

Published

**注意: 此版本播放器需要在HTTPS环境下使用**

Downloads

4

Readme

usc-player-new 新版播放器

注意: 此版本播放器需要在HTTPS环境下使用

Features

  • 📢 HTTPS免插件
  • 📝 支持两种使用场景
  • 🚀 快速, 低延时
  • 🧬 断线自动重连

安装和使用说明

  1. 脚本方式引入, 播放器对象实例 new UscPlayerNew.Player()

<script src="/path/to/usc-player-new.iife.js"></script>
function newPlayer() {
  const box = document.createElement('div')
  document.querySelector('body').appendChild(box)
  const player = new UscPlayerNew.Player(box)
  player.play(url, code)
}
newPlayer()
  1. es方式引用 播放器对象实例 new Player()

安装npm包

pnpm install usc-player-new

引入播放器 使用script标签需要注意 type="module"

import { Player } from 'usc-player-new'
// 使用方式与上面脚本方式引入相似
// const player = new UscPlayerNew.Player(box)
// 替换为
const player = new Player(box)

播放器属性

  • box 容器 播放器初始化参数, 一般使用div标签即可
  • canvas 播放器画布 用以渲染视频
  • audio 视频是否有声音 默认值 false 触发事件后为true
  • muted 视频是否静音 默认值 true
  • filled 视频是否填充容器 默认值 false
  • recording 视频是否在手动录制中 默认值 false
  • recordFilename 录制的文件名 用于下载录制文件
  • retry 视频重试次数 默认值 3

播放器方法

1. player.mute()

参数true/false 启用静音/打开声音 无参数为切换

2. player.play(url, code)

url: 播放地址 (ws或wss协议) code: 播放码流

3. player.stop()

当前关闭播放器

4. player.fill()

参数true/false 填充容器/原始分辨率 无参数为切换

5. player.capture(filename)

可选参数 filename 默认值为时间戳 截图 分辨率为当前画面的渲染分辨率

6. player.refresh()

在播放状态下, 刷新当前播放器

7. player.record(filename)

可选参数 filename 默认值为时间戳 在播放状态下, 开始录制

8. player.recordEnd()

在录制状态下, 停止录制 录制文件下载接口: api/video/downloadTemp 详情搜索接口文档

播放器事件

1. player.on('error', (err) => {})

播放失败 err: { code reason } 错误码code 加载错误码 错误原因reason 错误信息 触发error后,播放器会尝试重新播放

2. player.on('stop', (err) => {})

播放停止 与error事件的区别: stop事件后播放停止

3. player.on('audio')

声音事件 播放后获取视频声音后触发

4. player.on('data')

开始播放 播放后开始渲染后触发

License

MIT License.