1.1.0 • Published 3 years ago

@folly-systems/custom-react-player v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Custom React Player

A simple and lightweight video player component that helps you customize controls for your videos.

📸 Screenshots and Videos

Screenshot 2021-07-16 at 6 26 56

📦 Install

Yarn

yarn add @folly-systems/custom-react-player

npm

npm i @folly-systems/custom-react-player

🔨 Usage

ES5

var CustomizableVideoPlayer= require('@folly-systems/custom-react-player');

function MyComponent(){
    var videoLink = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
    
    return(
        <div>
	    <CustomizableVideoPlayer url={videoLink} />
	</div>
    )
}

module.exports = MyComponent;

ES6

import CustomizableVideoPlayer from '@folly-systems/custom-react-player'

export const MyComponent=()=>{
    const videoLink = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
    
    return(
        <div>
	    <CustomizableVideoPlayer url={videoLink} />
	</div>
    )
}

🎬 Demo Page

https://folly-systems.github.io/custom-react-player-example-app/

🎨 Props

PropDescriptionDefaultRequired
urlThe url of the videoTrue
heightHeight of the video player in px400False
widthWidth of the video player in px500False
playingThe video state can be changed using this object    status: Setting this property true plays the video and false pauses the video    time: Current playing time of the video can be changed using this property    speed: Playback speed of the video can be changed using this property(from 1-10).falseFalse
roundedSet true for rounded edges for the video playerfalseFalse
playerTypeSet "small" for smaller video player and "big" for larger video player    (It changes the size of video control icons)smallFalse
getVideoProgressDetailsThe function will be called initially when the component loads and it will receive an object which has methods to get the video details {getPlaybackSpeed, getCurrentTime, getPlayingStatus}    getPlaybackSpeed: This method returns playback speed of the video    getCurrentTime: This method returns current playing time of the video   getPlayingStatus: This method returns a boolean value depending on the videos playing statusFalse
controlsCustomize any of the video controls by using these option:  fullscreen {show:true/false , icon: Custom icon}   ◦ show(false/true): false will hide the fullscreen icon. By default the icon is visible.   ◦ icon: Add your custom fullscreen icon using this option.  playPause {show:true/false , playIcon: Custom play con, pauseIcon: Custom pause icon}   ◦ show(false/true): false will hide the play and pause icon. By default the icon is visible.   ◦ playIcon: Add your custom play icon using this option.   ◦ pauseIcon: Add your custom pause icon using this option.  playbackSpeed {show:true/false , color: Custom color}   ◦ show(false/true): false will hide the playback speed icon. By default the icon is visible.   ◦ color: Change color of the playback speed text.  volume {show:true/false , icon: Custom icon}   ◦ show(false/true): false will hide the volume icon. By default the icon is visible.   ◦ icon: Add your custom volume icon using this option.  time {show:true/false}   ◦ show(false/true): false will hide the time. By default the time is visible.   ◦ color: Change color of the time text.undefinedFalse
handleFullscreenThis function will be called when user clicks on fullscreen icon {getPlaybackSpeed, getCurrentTime, getPlayingStatus}    getPlaybackSpeed: A function that returns the current playback speed    getCurrentTime: A function that returns the current video time.    getPlayingStatus: A function that returns true if video is playing or else falseFalse
onVideoProgressThis function will be called whenever the video progress event is triggered. This function will get object that has details about the video status{isPlaying, currentTime, speed, totalTime}    speed: The current playback speed    currentTime: The current video time.    isPlaying: True if video is playing or else false    totalTime: Total video durationFalse

🖥 Environment Support

  • Chrome
  • Firefox
  • Safari
  • Edge

✨ Features

  • 🦋 Lightweight. It has no additional dependencies other than React.
  • 🔨 Provides lots of customization for your videos.
  • 🎨 Makes use of CSS modules.
  • 🛡 Written in TypeScript.

🔐 License

MIT. Copyright (c) 2021 folly-systems.