1.0.0 • Published 4 years ago

react-picture-in-picture v1.0.0

Weekly downloads
67
License
MIT
Repository
github
Last release
4 years ago

react-picture-in-picture

React Component that allow you to easily implement the Picture-in-Picture API (https://w3c.github.io/picture-in-picture/) in your app

NPM JavaScript Style Guide

alt text

Install

npm install --save react-picture-in-picture

or

yarn add react-picture-in-picture

Usage

import React, { useState } from 'react'

import Reactpip from 'react-picture-in-picture'

const ReactpipExemple = () =>{
  const[active, setActive] = useState(false)
  render () {
    return (
      <>
        <Reactpip isActive= {active} >
          <source src="https://cdn.arnellebalane.com/videos/original-video.mp4"/>
        </Reactpip>
        <button onClick = {() => setActive(!active)}>Toggle Picture in Picture</button>
      </>
    )
  }
}
export default ReactpipExemple

Props

Here the list of all props :

NametypeDescriptionIs required ?Default value
idstringset a custom id to the video playerno'videopip'
isActivebooleanstate that allow to turn on or of the pip modenofalse
callBackSuccessOnEnablefunctionfunction that would be called if the media where successfully go to pip modeno:x:
callBackSuccessOnDisablefunctionfunction called when the pip mode is successfully disabledno:x:
stylestyle objectstyle that would be apply to the video elementno:x:
classNamestringclassName that would be apply to the video elementno:x:
autoplaybooleanenable autoplay on the video playernofalse
controlsbooleanenable or not video controlsnotrue
childrennodechildren element that can be include between the element (eg : < source > tag)no:x:
loopbooleanenable loop play on the videonofalse
mutedbooleanmute the video player soundnofalse
classOnEnablestringcss class that would be activate on the video player when pip mode is enableno:x:

License

MIT © Thomascogez