0.3.3 • Published 5 years ago

react-sticky-video v0.3.3

Weekly downloads
28
License
MIT
Repository
github
Last release
5 years ago

Installation

yarn add react-sticky-video

Props

Basic Configuration

NameTypeDefaultDescription
urlstringundefinedThe URL of the video to embed. (current supported source: file, Youtube, Dailymotion)
widthnumber640The width of the video's display area.
heightnumber360The width of the video's display area.
playerVarsobject--The object's properties identify player parameters that can be used to customize the player, more details are given below.
captionsarray[]URLs for WebVTT caption files
originalControlsboolfalseUse original video controls UI.

Example

File Source - Demo
Supported playerVars
NameTypeDefaultDescription
autoplayboolfalseSpecifies that the video will start playing as soon as it is ready
loopboolfalseSpecifies that the video will start over again, every time it is finished
mutedboolfalseSpecifies that the audio output of the video should be muted
import React from 'react';
import StickyVideo from 'react-sticky-video';
import 'react-sticky-video/dist/index.css';

const App = () => (
  <StickyVideo
    url="trailer_400p.ogg"
  />
);
Youtube - Demo
Supported playerVars
import React from 'react';
import StickyVideo from 'react-sticky-video';
import 'react-sticky-video/dist/index.css';

const App = () => (
  <StickyVideo
    url="https://www.youtube.com/watch?v=XXXXXXXXXXX"
  />
);
Dailymotion - Demo
Supported playerVars
import React from 'react';
import StickyVideo from 'react-sticky-video';
import 'react-sticky-video/dist/index.css';

const App = () => (
  <StickyVideo
    url="https://www.dailymotion.com/video/XXXXXXX"
  />
);

stickyConfig

NameTypeDefaultDescription
widthnumber320The width of the sticky video's display area.
heightnumber180The width of the sticky video's display area.
positiononeOf(['top-right', 'top-left', 'bottom-right', 'bottom-left'])'bottom-right'The position of the sticky video

Example - Demo

import React from 'react';
import StickyVideo from 'react-sticky-video';
import 'react-sticky-video/dist/index.css';

const App = () => (
  <StickyVideo
    url="XXXXXXXXXXX"
    stickyConfig={
      width: 480,
      height: 270,
      position: 'top-left',
    }
  />
);

WebVTT Captions

Example - Demo

import React from 'react';
import StickyVideo from 'react-sticky-video';
import 'react-sticky-video/dist/index.css';

const App = () => (
  <StickyVideo
    url="https://youtu.be/Fkd9TWUtFm0"
    captions={[
      {
        src: 'ted-en.vtt',
        label: 'English',
        default: true,
      },
      {
        src: 'ted-zh-TW.vtt',
        label: '中文',
      },
    ]}
  />
);