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

react-jessibuca

v1.2.0

Published

Jessibuca Player for React

Downloads

508

Readme

React Jessibuca

介绍

基于 Jessibuca 封装的 react 播放组件

使用说明(必看)

  1. 安装 react-jessibuca

    npm i react-jessibuca
  2. 打开项目目录中的 node_modules/react-jessibuca/static 文件夹,或者在最新发布的版本中下载 dist.zip,并解压

  3. decoder.jsdecoder.wasm 复制到你的静态资源中,两者必须处于同一目录

  4. 稍后将 decoder 设置为你的 decoder.js 路径地址

  5. 引入组件并使用

    import JessibucaPlayer from "react-jessibuca"
    
    <JessibucaPlayer width={400} height={300} src="http://xxx.xxx/xxx" decoder="http://xxx.xxx/decoder.js" />
  6. 或者全局设置 decoder

    // 入口文件 index.ts
    import { setDecoder } from "react-jessibuca"
    
    setDecoder("http://xxx.xxx/decoder.js")

参数

export interface PlayerEvent {
    onLoad?: () => void
    onTimeUpdate?: (ts: number) => void
    onVideoInfo?: (data: VideoInfo) => void
    onAudioInfo?: (data: AudioInfo) => void
    onLog?: (msg: any) => void
    onError?: (err: ERROR) => void
    onKBps?: (value: number) => void
    onStart?: () => void
    onTimeout?: (error: TIMEOUT) => void
    onLoadingTimeout?: () => void
    onDelayTimeout?: () => void
    onFullscreen?: (fullscreen: boolean) => void
    onPlay?: () => void
    onPause?: () => void
    onMute?: (mute: boolean) => void
    onStats?: (stats: Stats) => void
    onPerformance?: (performance: 0 | 1 | 2) => void
    onRecordStart?: () => void
    onRecordEnd?: () => void
    onRecord?: (data: any) => void
    onRecordingTimestamp?: (timestamp: number) => void
    onPlayToRenderTimes?: (times: PlayToRenderTimes) => void
}

export interface ControlOptions {
    /** 是否显示全屏按钮 */
    fullscreen?: boolean
    /** 是否显示截图按钮 */
    screenshot?: boolean
    /** 是否显示播放暂停按钮 */
    play?: boolean
    /** 是否显示声音按钮 */
    audio?: boolean
    /** 是否显示录制按 */
    record?: boolean
}

export interface PlayerProps extends PlayerEvent {
    className?: string
    style?: CSSProperties
    /** 视频宽度 */
    width?: number

    /** 视频高度 */
    height?: number

    /** 视频地址 */
    src: string

    /** 播放器配置 */
    config?: PlayerConfig

    /** 是否开启调试 */
    debug?: boolean

    /** 是否静音,建议同时使用 onMute 事件来监听更改 */
    mute?: boolean

    /** 视频填充模式 */
    objectFit?: "fill" | "contain" | "cover"

    /** 是否全屏,建议同时使用 onFullscreen 事件来监听更改 */
    fullscreen?: boolean

    /** 解码器 decoder.js 地址 */
    decoder?: string

    /** 加载文字 */
    loadingText?: string

    /** 解码模式,详见 https://jessibuca.com/document.html#usemse */
    decodeMode?: "useMSE" | "useWCS" | "wasm"

    /** 当前超过并发限制时,回调 */
    onExceed?: (concurrency: number) => void

    /** 是否开启控制栏 */
    controls?: boolean | ControlOptions

    /** 音量大小 */
    volume?: number
}