JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 74
  • Score
    100M100P100Q71615F
  • License MIT

Package Exports

  • rc-dplayer
  • rc-dplayer/dist/index.js
  • rc-dplayer/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rc-dplayer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rc-dplayer

This is a wrapper of DPlyer;

It contains hls.js and flv.js,you can play your video directly.

Install

npm

npm install rc-dplayer

pnpm

pnpm install rc-dplayer

Examples

import { Player as RcDPlayer } from "@/index";

const App = () => {
  return (
    <RcDPlayer
      src="/test.mp4"
      options={{
        autoplay: true,
      }}
    />
  );
};

Props

name type description default
src string Video source . -
mseType MseType MSE type . MseType.default
autoLoad boolean Auto load video when it`s true and src exits. true
options DPlayerOptions The other options of DPlayer . -
customControllers CustomController[] Custom controller -
onEnded () => void Ended event of DPlayer . -
onError () => void Error event of DPlayer . -

Interface

export enum MseType {
  hls = "m3u8",
  flv = "flv",
  default = "default",
}
type ControllerPosition = "left" | "right";

export interface CustomController {
  key: Key;
  position: ControllerPosition;
  component: ReactNode;
  onClick?: (event: ReactMouseEvent<HTMLDivElement, MouseEvent>) => void;
}

Ref methods

name type description
load (url?: string, mseType?: MseType) => DPlayer Load video by yourself .

License

rc-dplayer is released under the MIT license.