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

splayer-react

v1.0.4

Published

A simple and practical video player for Web

Downloads

2

Readme

NPM version

Install

npm i splayer-react

Usage

import SPlayer from 'splayer-react'
<SPlayer 
  options={{ 
    videoSrc: 'https://xxx', 
    width: 'xxx', 
    height: 'xxx', 
    isShowToast: true, 
    pauseButtonPlace: 'center', 
  }} 
/>

Props

| Props | type | description | | - | - | - | | options | VideoOptions | component config | | style | React.CSSProperties | style attribute | | className | string | class | | onProgressMouseDown | (e: VideoAttributes) => void | drag the progress bar callback | | onPlay | (e: VideoAttributes) => void | video start playing callback | | onPause |(e: VideoAttributes) => void| video pause callback | | onTimeChange | (e: VideoAttributes) => void | time change callback | | onEndEd | (e: VideoAttributes) => void | video end callback | | onProgressMouseUp | (e: VideoAttributes) => void | slider release callback | | onError | () => void | play error callback | | onVolumeChange | (e: VideoAttributes) => void | volume change callback | | onQualityChange | (e: QualityKey) => void | quality change callback |

VideoOptions


type pauseButtonPlace = 'bottomRight' | 'center';

type Language = 'zh' | 'en';

type QualityAttributes = {
  name: string;
  url: string;
}

type VideoType = 'h264' | 'hls';

type ToastPosition =
  | 'leftTop'
  | 'rightTop'
  | 'leftBottom'
  | 'rightBottom'
  | 'center';

type ProgressFloatPosition = 'top' | 'bottom';

interface VideoOptions<T = string, K = boolean, U = number> {
  /**
   * @description the width of the video container
   */
  width: U;
  /**
   * @description the height of the video container
   */
  height: U;
  /**
   * @description video source
   */
  videoSrc: T;
  /**
   * @description component theme
   */
  theme?: T;
  /**
   * @description the video poster
   */
  poster?: T;
  /**
   * @description customize what is displayed at the end of the video
   */
  setEndDisplayContent?: React.ReactNode;
  /**
   * @description customize the video loading component
   */
  setBufferContent?: React.ReactNode;
  /**
   * @description customize the video pause button component
   */
  setPauseButtonContent?: React.ReactNode;
  /**
   * @description the position of pause button
   */
  pauseButtonPlace?: pauseButtonPlace;
  /**
   * @description hide the mouse cursor time /ms
   */
  hideMouseTime?: U;
  /**
   * @description whether to show multiple function
   */
  isShowMultiple?: K;
  /**
   * @description whether to show setting function
   */
  isShowSet?: K;
  /**
   * @description whether to show screenshot
   */
  isShowScreenshot?: K;
  /**
   * @description whether to show picture-in-picture function
   */
  isShowPicInPic?: K;
  /**
   * @description whether to show page full screen function
   */
  isShowFullScreen?: K;
  /**
   * @description language
   */
  language?: Language;
  /**
   * @description whether to show pause button
   */
  isShowPauseBtn?: K;
  /**
   * @description the list of video quality
   */
  quality?: QualityAttributes[];
  /**
   * @description video playback format,suport for h264(.mp4,.webm,.ogg),hls(m3u8), the default format is h264
   */
  videoType?: VideoType;
  /**
   * @description whether to show toast component
   */
  isShowToast?: K;
  /**
   * @description the position displayed by Toast, valid when `isShowToast` is true
   */
  toastPosition?: ToastPosition;
  /**
   * @description whether to show progress bar floating layer
   */
  isShowProgressFloat?: K;
  /**
   * @description the position displayed by progress bar floating layer, valid when `isShowProgressFloat` is true
   */
  progressFloatPosition?: ProgressFloatPosition;
}

VideoAttributes

interface VideoAttributes<T = number, K = boolean> {
  /**
   * @description whether to play
   */
  isPlay: K;
  /**
   * @description current time, unit: s
   */
  currentTime: T;
  /**
   * @description total time, unit: s
   */
  duration: T;
  /**
   * @description buffered time, unit: s
   */
  bufferedTime: T;
  /**
   * @description wether to enable picture-in-picture mode
   */
  isPicInPic: K;
  /**
   * @description volume
   */
  volume: T;
  /**
   * @description video playback speed
   */
  multiple: T;
  /**
   * @description whether to end
   */
  isEnded: K;
  /**
   * @description error
   */
  error: null | T;
}

License

MIT License © 2022 Lovell Liu