1.0.1 • Published 10 months ago

react-file-player v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

React File Player

A lightweight React component for playing video files.

Features

  • Supports playback of various video formats
  • Simple API with support for basic playback controls
  • Lightweight alternative focused solely on local file playback

Installation

npm install react-file-player

Usage

import React from 'react'
import ReactFilePlayer from 'react-file-player'

// Render a video player
<ReactFilePlayer url='path/to/video.mp4' />

Props

PropDescriptionDefault
urlThe url of a video or audio file to play
playingSet to true or false to pause or play the mediafalse
controlsSet to true or false to display native player controlsfalse
volumeSet the volume of the player, between 0 and 11
mutedMutes the playerfalse
widthSet the width of the player640px
heightSet the height of the player360px

Callback Props

PropDescription
onReadyCalled when media is loaded and ready to play
onStartCalled when media starts playing
onPlayCalled when media starts or resumes playing after pausing or buffering
onPauseCalled when media is paused
onEndedCalled when media finishes playing
onErrorCalled when an error occurs whilst attempting to play media

Methods

MethodDescription
play()Play the video
pause()Pause the video
stop()Stop the video
seekTo(seconds)Seek to the given number of seconds

Development

To build the library:

npm run build

License

MIT


This project is a fork of ReactPlayer, focused specifically on local file playback. It does not support streaming services or other media sources found in the original ReactPlayer.

1.0.1

10 months ago

1.0.0

10 months ago