1.1.0 • Published 11 months ago

react-player-youtube v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

react-player-youtube

Version typescript code style: prettier

A Simple player like youtube

Demo

https://marvelous-starship-013ffe.netlify.app/

Installation

npm i react-player-youtube --save

Feature

  • Support load video mp4, m3u8, ...
  • Custom UI streaming video
  • Multiple qualities
  • FullScreen cross browser support
  • Mini mode
  • Subtitles
  • Speed control

Usage

import { VideoPlayerProvider } from 'react-player-youtube';
import App from './App';

<VideoPlayerProvider>
  <App />
</VideoPlayerProvider>;
import { VideoPlayer } from 'react-player-youtube';

const urlVideo =
  'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8';
const typeVideo = 'application/x-mpegURL';
const source = {
  src: urlVideo,
  type: typeVideo,
};

const playerRef = useRef();

<VideoPlayer ref={playerRef} source={source} />;

Props

PropDescriptionTypeRequire
privateKeyA private key for video componentnumberfalse
sourceInclude URL and type of a video to play{ type: string; src: string }true
optionsOverride player default configurationVideoJsPlayerOptions;false
subtitlesList subtitlesSubtitleItem[]false
isStreamingSet player to stream videoVideoJsPlayerOptions;false
adsAdsense for videoAdsfalse
onReadyCallback to call after init player() => voidfalse
onExpandCallback to call open player with normal mode() => voidfalse
onMiniCallback to call open player with mini mode() => voidfalse
onDestroyCallback to close the player() => voidfalse
miniPlayerFooterthe element is below the mini playerReactElementfalse

Types

NameTypeReference
VideoJsPlayerOptionshttps://videojs.com/guides/options/
SubtitleItem{ isDefault?: boolean; value: string; label: string; url: string }
Ads{ type: AdsType; adsMarker: AdMarker[] }
AdsType'CSAI' or 'SSAI'
AdMarker{ startTime: number; endTime: number }

Control Button

NameKey
Setting ButtonSettingButton
Previous ButtonPrevButton
Next ButtonNextButton
Mini Player ButtonMiniPlayerModeButton
Theater Mode ButtonTheaterButton
Expand ButtonExpandButton
Close Mini Mode ButtonCloseButton

Issues

If you have some bug or have any feature request, feel free to submit an issue on the github repo.

Contributing

We welcome your contribution! Fork the repo, make some changes, submit a pull-request! See the contribution guidelines before creating a pull request.

License

MIT

1.1.0

11 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago