24.7.4-85-gce1c417 • Published 9 months ago

@flussonic/flussonic-dvr-player v24.7.4-85-gce1c417

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

flussonic-dvr-player

Flussonic DVR Player is a JavaScript library for playing video archives and live streams. It relies on Flussonic backend.

Installation

Install flussonic-dvr-player from NPM by running the command:

npm install --save @flussonic/flussonic-dvr-player

or using Yarn:

yarn add @flussonic/flussonic-dvr-player

Usage

You can use the DVR Player as a React component:

import DvrPlayer from '@flussonic/flussonic-dvr-player';
import '@flussonic/flussonic-dvr-player/dist/fonts/font.css';

export const DVRPlayer = ({ options }) => {
  const player = useRef(null);

  useEffect(() => {
    const DVR = DvrPlayer.load(options, player.current);

    return function cleanup() {
      const { DvrInstance } = DVR;
      if (DvrInstance) {
        const instance = DvrInstance();
        if (instance) {
          instance.props.close();
        }
      }
    };
  }, [options]);

  return <div id="dvr-player" ref={player} style={{ height: '100%' }} />;
};

or use it with a script tag:

<head>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@flussonic/flussonic-dvr-player/dist/fonts/font.css">
  <script src="https://cdn.jsdelivr.net/npm/@flussonic/flussonic-dvr-player/dist/FlussonicDvrPlayer.js"></script>
</head>
<body>
  <div id="dvr-player"></div>
  <script type="text/javascript">
    const options = {
      name: 'YOUR_STREAM_NAME', // replace it with your stream name
      streamer_http: window.location.protocol + '//' + window.location.host,
      query: window.location.search.replace(/^\?/, ''),
    };
    const player = document.getElementById('dvr-player');
    window.onload = function () {
      window.FlussonicDvrPlayer = FlussonicDvrPlayer.default.load(options, player);
    };
  </script>
</body>

Where:

player - HTML container for the player

options - a plain object, that can include:

required:

  • name - stream name
  • streamer_http - the streamer's URL

additional:

  • tokenName - custom token name (token by default)
  • token - authorization token
  • streamer_rtmp - the stream's rtmp URL
  • autoPlay - enable autoplay (true|false)
  • fixedRange - locks the timeline on a current episode (true|false)
  • proto - playback type for a live (mse | hls), mse by default
  • from - start time of playback (utc in sec)
  • to - stop time of playback (utc in sec)
  • play_duration - stops playback after some playback duration (sec)
  • thumbnails_enabled - enable/disable thumbnails (true|false)
  • locale - player locale (ru | en)
  • zoom - initial zoom for the timeline (sec)
  • debug - debug mode (true|false)
  • tracks - starting tracks for the live playback (string, example: v2a1)
  • timeLineElement - external HTML container for the timeline
  • onMediaInfo(data) - callback for getting media info data object
  • onEvent(name, data?) - callback for player events, returns the event name and the possible data about it
  • panzoom - zoom for video element (true|false)
  • noMenu - render timeline menu element (true|false)
  • centeredSeek - timeline seek with auto-centering (true|false)
  • motionUrl - url for motion events
  • enableMp4Download - enable/disable download video segments (true|false)
  • statsSendEnable - enable sending stats (true|false)
  • statsSendTime - stats data sending interval (sec)
  • localtime - use local user time (true|false)
  • export_limit - export episode selection time limit (sec)
  • start_track - adaptive track selection (lowest | best)
  • dvr - dvr mode (true|false)
  • enoughBufferTime - enough buffer time to disable a loading indicator (sec)

mosaic play mode:

  • streams - an array of stream names for mosaic
  • multiTimeline - enable split timeline mode (true|false)
  • streamingChannels - a plain object, that can include:
    • renderTitles - show titles of streams (true|false)
    • streams - an array of objects, that can include:
      • subName - name of the stream
      • address - stream may have its own address on the other Flussonic server
      • main - should be selected first (true|false)
      • auth_token - token name with a token (token=${token})
      • order - order of the playback window (number)

Methods

  • play() - starts the playback
  • stop() - stops the playback, sets srcObject of <video> to null
  • restartPlayer() - restarts playback
  • changeLanguage(lang) - changes the language
24.7.4-85-gce1c417

9 months ago

24.7.4-78-g4a085d7

9 months ago

24.7.4-74-g7c715ad

9 months ago

24.7.4-76-g5358a52

9 months ago

24.7.4-61-g6b13a0a

10 months ago

24.7.4-63-g55c51b1

9 months ago

24.7.4-59-gd7f7326

10 months ago

24.7.4-66-ged5e04c

9 months ago

24.7.4-72-g666a2bb

9 months ago

24.7.4-57-g13107eb

10 months ago

24.7.4-51-g41c9d1d

10 months ago

24.7.4-55-g5b05fe4

10 months ago

24.7.4-48-g0224a6c

11 months ago

24.7.4-46-ge19539b

11 months ago

24.7.4-44-g0736c81

11 months ago

24.7.4-42-g503b95e

11 months ago

24.7.4-38-g3c010c6

11 months ago

24.7.4-36-gd17b0b1

11 months ago

24.7.4-37-ge64acf4

11 months ago

24.7.4-34-g3eab63a

11 months ago

24.7.4-32-gc4d5694

11 months ago

24.7.4-30-gd15d65a

11 months ago

24.7.4-28-g66daeae

11 months ago

24.7.4-25-ged83b8e

11 months ago

24.7.4-22-g2d5add0

11 months ago

24.7.4-20-g29f79e0

12 months ago

24.7.4-18-gc527cc0

12 months ago

24.7.4-16-g163ad84

12 months ago

24.7.4-14-ge46e9f8

12 months ago

24.7.4-12-g5d14f00

12 months ago

24.7.4-10-g9dd0fc3

12 months ago

24.7.4-8-gc6035c2

12 months ago

24.7.4-6-g2041dfa

12 months ago

24.7.4-2-ge9de30d

12 months ago

24.7.4-0-g8bfc57b

12 months ago

24.7.3-15-gff7191e

12 months ago

24.7.3-13-gb5ff375

12 months ago

24.7.3-11-g647fcaa

12 months ago

24.7.3-9-g8324d47

12 months ago