@bsonntag/react-video
v0.2.0
Published
A react component that handles video properties and methods by prop.
Downloads
9
Readme
@bsonntag/react-video
A react component that handles video properties and methods by prop.
Installation
Using npm:
$ npm install --save @bsonntag/react-video
Using yarn:
$ yarn add @bsonntag/react-video
This module uses react's createRef
API,
so make sure you have at least version 16.3.0 installed.
Example usage
import Video from '@bsonntag/react-video';
import React from 'react';
const App = () => (
<Video
play
src={'https://www.sample-videos.com/video/mp4/480/big_buck_bunny_480p_1mb.mp4'}
volume={0.5}
/>
);
Props
The Video
component supports all
video attributes
plus the following props:
play
- A boolean prop that makes the component callvideo.play()
when true, orvideo.pause()
when false.srcObject
- Can be used to pass a MediaStream to thevideo.srcObject
property.volume
- Sets the value ofvideo.volume
. Must be between 0 and 1.
Contributing
Please feel free to submit any issues or pull requests.
License
MIT