@asurraa/sura-ui-video-player
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

vdo.js with react + typescript

support live streaming video local video support

Basic Usage

import { SuraVideoPlayer } from "@src/components/sura-vdo-player/sura-vdo-player";

const TestPage = () => {
  return (
    <>
      <SuraVideoPlayer
        options={{
          autoplay: true,
          controls: true,
          responsive: true,
          fluid: true,
          sources: [
            {
              type: "application/x-mpegURL",
              src: "http://localhost:8000/livelive/live/index.m3u8",
            },
          ],
        }}
      />
    </>
  );
};

export default TestPage;

Usages With Ref

import { SuraVideoPlayer } from "@src/components/sura-vdo-player/sura-vdo-player";
import React from "react";

const TestPage = () => {
  const playerRef = React.useRef(null);

  return (
    <>
      <SuraVideoPlayer
        options={{
          autoplay: true,
          controls: true,
          responsive: true,
          fluid: true,
          sources: [
            {
              type: "application/x-mpegURL",
              src: "http://localhost:8000/livelive/live/index.m3u8",
            },
          ],
        }}
        onReady={(player) => {
          // @ts-ignore
          playerRef.current = player;

          // you can handle player events here
          player.on("waiting", () => {
            console.log("player is waiting");
          });

          player.on("dispose", () => {
            console.log("player will dispose");
          });
        }}
      />
    </>
  );
};

export default TestPage;

Readme

Keywords

none

Package Sidebar

Install

npm i @asurraa/sura-ui-video-player

Weekly Downloads

6

Version

1.0.7

License

none

Unpacked Size

7.33 kB

Total Files

9

Last publish

Collaborators

  • vichea
  • themkimhong
  • lyhourchhen
  • duongkimseng