All Projects → matvp91 → shaka-player-react

matvp91 / shaka-player-react

Licence: MIT license
A simple React component wrapper for shaka-player

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to shaka-player-react

Shaka Player
JavaScript player library / DASH & HLS client / MSE-EME player
Stars: ✭ 5,386 (+6717.72%)
Mutual labels:  hls, video-player, mse, playback, dash, drm, video-streaming, media-source-extension, encrypted-media
Shaka Player Embedded
Shaka Player in a C++ Framework
Stars: ✭ 153 (+93.67%)
Mutual labels:  hls, video-player, playback, dash, video-streaming
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (+402.53%)
Mutual labels:  player, hls, dash, video-streaming
Xgplayer
A HTML5 video player with a parser that saves traffic
Stars: ✭ 4,792 (+5965.82%)
Mutual labels:  player, hls, video-player, dash
Clappr
🎬 An extensible media player for the web.
Stars: ✭ 5,436 (+6781.01%)
Mutual labels:  player, hls, video-player, dash
Rx Player
DASH/Smooth HTML5 Video Player
Stars: ✭ 600 (+659.49%)
Mutual labels:  player, video-player, dash, video-streaming
Hls.js
HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
Stars: ✭ 10,791 (+13559.49%)
Mutual labels:  player, hls, playback, video-streaming
bigscreen-player
Simplified media playback for bigscreen devices
Stars: ✭ 62 (-21.52%)
Mutual labels:  player, playback, dash, video-streaming
Nexplayer unity plugin
Stream videos in HLS & DASH with Widevine DRM using NexPlayer Video Streaming Player SDK for Unity on Android & iOS devices
Stars: ✭ 73 (-7.59%)
Mutual labels:  player, hls, video-player, dash
Magicalexoplayer
The Easiest Way To Play/Stream Video And Audio Using Google ExoPlayer In Your Android Application
Stars: ✭ 171 (+116.46%)
Mutual labels:  player, hls, dash
Openplayerjs
Lightweight HTML5 video/audio player with smooth controls and ability to play VAST/VPAID/VMAP ads
Stars: ✭ 255 (+222.78%)
Mutual labels:  player, hls, dash
React Player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
Stars: ✭ 5,931 (+7407.59%)
Mutual labels:  player, hls, dash
P2p Cdn Sdk Javascript
Free p2p cdn github javascript sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 158 (+100%)
Mutual labels:  player, hls, dash
Vue Video Player
🎞 @videojs component for @vuejs
Stars: ✭ 4,026 (+4996.2%)
Mutual labels:  player, hls, video-player
abr-player
📼 Adaptive Streaming Test Player
Stars: ✭ 13 (-83.54%)
Mutual labels:  player, hls, dash
P2p Media Loader
An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
Stars: ✭ 822 (+940.51%)
Mutual labels:  player, hls, dash
Video.js
Video.js - open source HTML5 & Flash video player
Stars: ✭ 32,478 (+41011.39%)
Mutual labels:  player, hls, dash
shaka-php
🎞 Shaka PHP is a library that uses Shaka Packager for DASH and HLS packaging and encryption, supporting Common Encryption for Widevine and other DRM Systems.
Stars: ✭ 63 (-20.25%)
Mutual labels:  hls, dash, video-streaming
Vime
Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
Stars: ✭ 1,928 (+2340.51%)
Mutual labels:  player, hls, dash
p2p-cdn-sdk-android
Free p2p cdn android github sdk to reduce video streaming costs of live and on demand video using webrtc by upto 90% and improve scalability by 6x - 🚀 Vadootv 🚀
Stars: ✭ 39 (-50.63%)
Mutual labels:  player, hls, dash

Shaka Player React

A React component for Shaka Player, an open-source JavaScript library for adaptive media. It is highly recommended to check the official shaka documentation first.

Installation

npm install shaka-player-react --save

yarn add shaka-player-react

Usage

As seen in the example below, the CSS bundled with shaka-player has been imported separately. This is because shaka-player-react does not require any CSS internally, which keeps you in full control of the styling as if you were not using this React wrapper.

import React from 'react';
import ShakaPlayer from 'shaka-player-react';
import 'shaka-player-react/dist/controls.css';

function App() {
  return <ShakaPlayer autoPlay src="https://streams.com/example.mpd" />;
}

The following ShakaPlayer properties are supported:

Property Description Type
src The MPEG-DASH, or HLS media asset. Is provided to shaka.Player.load on mount or change. String
autoPlay Whether the asset should autoplay or not, directly bound to the HTMLVideoElement element. Boolean
width Width of the player. Number
height Height of the player. Number
playbackRate Sets the speed of the audio/video playback. Number
muted Sets whether the video is muted or not Boolean
loop Sets whether teh audio/video should start over again when finished Boolean
volume Sets the volume of the audio/video Number
className Adds a class to the root element, which is a div. String

Access shaka's player object.

The following is a more advanced setup to illustrate how you can integrate shaka's features in React.

import React, { useRef, useEffect } from 'react';
import ShakaPlayer from 'shaka-player-react';

function App() {
  const controllerRef = useRef(null);

  useEffect(() => {
    const {
      /** @type {shaka.Player} */ player,
      /** @type {shaka.ui.Overlay} */ ui,
      /** @type {HTMLVideoElement} */ videoElement
    } = controllerRef.current;

    async function loadAsset() {
      // Load an asset.
      await player.load('https://streams.com/example.mpd');

      // Trigger play.
      videoElement.play();
    }

    loadAsset();
  }, []);

  return <ShakaPlayer ref={controllerRef} />;
}

Or check the example in this repository.

Integrate with

Next.js

import React from 'react';
import dynamic from 'next/dynamic';

const ShakaPlayer = dynamic(() => import('shaka-player-react'), { ssr: false });

export default function Index() {
  return (
    <div>
      <ShakaPlayer autoPlay src="https://streams.com/example.mpd" />
    </div>
  );
}

When using next/dynamic with { ssr: false }, we'll make sure the component is not interpreted by Next.js SSR. As of today, pre-rendering shaka-player's UI is technically not possible due to the fact that it is not written in React (but in plain Javascript). Although, shaka-player heavily relies on browser API's and serves no real purpose on a backend anyways.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].