Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ayan4m1/react-shaka-player

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ayan4m1/react-shaka-player

React video player built with Shaka-Player

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@ayan4m1/react-shaka-player

Build Status npm version npm

React video player built on top of Shaka Player.

DEMO

CODESANDBOX

ROADMAP

EXAMPLE & USAGES

Installation

Use the package manager yarn or npm to install @ayan4m1/react-shaka-player.

yarn add @ayan4m1/react-shaka-player shaka-player

or

npm install @ayan4m1/react-shaka-player shaka-player

Usage

// import the css. Now we have custom ui.css
import "@ayan4m1/react-shaka-player/dist/ui.css";
import { ReactShakaPlayer } from "@ayan4m1/react-shaka-player";

function App() {
  return <ReactShakaPlayer autoPlay={true} src={"https://yourvideohere.mpd"} />;
}

Manual Handle Usage

import "@ayan4m1/react-shaka-player/dist/ui.css";
import { ReactShakaPlayer } from "@ayan4m1/react-shaka-player";

function App() {
  let [mainPlayer, setMainPlayer] = useState({});

  useEffect(() => {
    const { player, videoElement } = mainPlayer;

    if (player) {
      async function play() {
        await player.load("https://yourvideomaster.mpd");
        videoElement.play();
      }
      play();
    }
  }, [mainPlayer]);

  return (
    <div className="App">
      <div className="App-main">
        <ReactShakaPlayer
          playerClassName="player-class-name"
          onLoad={(player) => setMainPlayer(player)}
        />
      </div>
    </div>
  );
}

Props

This is main props for the components:

PropsOptionalDescriptionType
srcNoMPD or HLS to playstring
classNameYesstring of ui overlay classnamestring
autoPlayYesas it describedboolean
superConfigYesThe special configs for Streaming or VOD. Will add more superConfig soon.string ("STREAMING" / "VOD")
configYesChanges configuration settings on Shaka Player. Reference: shaka.extern.PlayerConfiguration. This config will override superConfig.object
uiConfigYesChanges configuration settings for UI elements. Reference: shaka.extern.UIConfiguration. This config will override superConfig.object
onLoadYesCatch Shaka.Player, Shaka.ui.Overlay and HTMLVideoElement for manual usages or improvement of configuration. see: PlayerRefsobject: PlayerRefs => func
onPlayYesCatch when media is playingfunc
onPlauseYesCatch when media is pausedfunc
onEndedYesCatch when video is endfunc
onBufferingYesCatch onBuffering status when playingbool => func
onPlayerErrorYesCatch error when playing. Reference: Shaka.Player.ErrorEvent{Shaka.extern.Error} => func
onStatsChangedYesCatch stats when playing video, including currentTime (current seek position), and currentEndTime (length of video duration if VOD) (in seconds) of media player element [IStats]. Reference: IStats & Shaka.extern.Stats{Shaka.extern.Stats} => func

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Keywords

FAQs

Package last updated on 30 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc