9.2.1 • Published 1 month ago

react-video-player-extended v9.2.1

Weekly downloads
11
License
MIT
Repository
github
Last release
1 month ago

Introduction

React-video-player-extended supports both development and general user requirements. In addition to the basic video player functionality, react-video-player-extended provides the functionality for marking and selecting frames, jumping back and forth between frames based on the fps.

Install

npm install react-video-player-extended --save
# or
npm i react-video-player-extended
# or
yarn add react-video-player-extended

Example

import React, { Component } from 'react';
import VideoPlayer from 'react-video-player-extended';

class App extends Component {
  state = {
    isPlaying: false,
    volume: 0.7
  };

  handlePlay = () => {
    this.setState({isPlaying: true});
  };

  handlePause = () => {
    this.setState({isPlaying: false});
  };

  handleVolume = value => {
    this.setState({volume: value});
  };

  render () {
    const {isPlaying, volume} = this.state;

    return <VideoPlayer
      url="https://media.w3.org/2010/05/bunny/trailer.mp4"
      isPlaying={isPlaying}
      volume={volume}
      onPlay={this.handlePlay}
      onPause={this.handlePause}
      onVolume={this.handleVolume}
     />
  }
}

Demo

https://amittkSharma.github.io/react-video-player-extended/example/index.html

Features

  • Package supports basic video player functionality like play/pause, volume control and full screen
  • Markers creation, display and selection
  • Jumping back and forth between frames based on FPS (default fps value is 30)
  • Display various settings associated with the video player such as title, fps, volume, repeat, start time
  • Export markers as JSON file.
  • Importing markers from JSON file.

alt text

Props

PropDescriptionDefault
controlsSet visible controls. Available controls: ControlSelectionControlSelection.Play, ControlSelection.Time, ControlSelection.Progress, ControlSelection.Volume, ControlSelection.FullScreen, ControlSelection.AddMarker, ControlSelection.ExportMarkers
heightSet the height of the player'360px'
widthSet the width of the player'640px'
isPlayingSet to true or false to play or pause the mediafalse
volumeSet the volume of the player, between 0 and 10.7
loopSet to true or false to loop the mediafalse
markersSet array of markers. Example: [{id: 1, time: 5, color: '#ffc837', title: 'Marker 1'}][]
timeStartSet the second number to start playing video0
urlThe url of a video
fpsFrame per second30
selectedMarkerSelected markerundefined
viewSettingsArray of SettingSelection displaying various video player settings e.g. Title, FPS, Volume, Repeat, Start Time, Markers Countundefined

Callback Events

PropDescriptionVersion
onPlayCalled when video is started
onPauseCalled when media is paused
onVolumeCalled when volume is changed. Callback contains volume
onProgressCallback contains event, progressProps, ProgressProps is an object containing currentTime, duration and percentage,
onDurationCallback contains duration of the media, in seconds
onMarkerClickCalled when marked is clicked. Callback contains marker object. Example: {id: 1, time: 5, color: '#ffc837', title: 'Marker 1'}
onContinuousMarkerReceivedCallback sending markers continuously, but it will not mark the video timeline. Callback contains marker object. Example: {id: 1, time: 5, color: '#ffc837', title: 'Marker 1'}
onMarkerAddedCallback when a new marker is being added, this API will return a new marker object with current time.8.0.0
onLoadedMetadataCallback is triggered when the video player is loaded with new video, with all the meta-information
onVideoPlayingCompleteCallback triggered when the video is completely played contains progressProps object. Example: {"currentTime":52.209,"duration":52.209,"percentage":100}. Note: This event will not be triggered in case video is being played in loop.8.3.0
Donation

Let's sit together and contribute towards further enhancements Buy me a coffee :coffee:

9.2.1

1 month ago

9.1.0

3 months ago

9.0.0

2 years ago

7.0.4

2 years ago

7.0.3

2 years ago

7.0.2

2 years ago

7.1.0

2 years ago

7.0.8

2 years ago

7.0.7

2 years ago

7.0.6

2 years ago

7.0.5

2 years ago

7.0.9

2 years ago

8.1.0

2 years ago

8.3.0

2 years ago

8.2.0

2 years ago

7.0.12

2 years ago

7.0.13

2 years ago

7.0.10

2 years ago

7.0.11

2 years ago

7.0.16

2 years ago

7.0.14

2 years ago

7.0.15

2 years ago

7.0.1

4 years ago

5.1.0

4 years ago

6.1.0

4 years ago

7.0.0

4 years ago

5.0.0

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.0.0

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago