Description
A responsive media player that is simple, easy to use, and customizable for video, audio, YouTube, and Vimeo for react based on plyr
Plyr React alternatives and similar libraries
Based on the "UI Components" category.
Alternatively, view plyr-react alternatives based on common mentions on social networks and blogs.
-
sortablejs
Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required. -
react-table
π€ Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table -
sweetalert2
β¨ A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies. πΊπ¦πͺπΊ -
TinyMCE
The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular -
AG Grid
The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript. -
downshift π
π A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components. -
react-sortable-hoc
A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable listβοΈ -
react-player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion -
MUI X Data grid
MUI X is a collection of advanced React UI components for complex use cases. Use the native integration with Material UI or extend your design system. They feature state-of-the-art functionality and complex UX workflows for data-rich applications and support a wide range of use cases. MUI X is open coreβbase components are MIT-licensed, while more advanced features require a Pro or Premium commercial license. Components: - Data Grid - Date and Time Pickers - Charts - Tree View -
react-day-picker
DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications. -
react-draft-wysiwyg
A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Plyr React or a related project?
README
Plyr React
A responsive media player that is simple, easy to use, and customizable for video, audio, YouTube, and Vimeo.
You can see a live demo here.
Make sure to select the version for the plyr-react in the dependencies.
Installation
# NPM
npm install plyr-react
# Yarn
yarn add plyr-react
Usage
Ready to use <Plyr /> component
The simplest form of react integration with the plyr is to use the <Plyr /> component, it is best for the static
videos.
import Plyr from "plyr-react"
import "plyr-react/plyr.css"
const plyrProps = {
source: undefined, // https://github.com/sampotts/plyr#the-source-setter
options: undefined, // https://github.com/sampotts/plyr#options
// Direct props for inner video tag (mdn.io/video)
}
function MyPlyrVideo() {
return <Plyr {...plyrProps} />
}
Old version 4 plyr-react
- The path for an import of css styles has been changed in version 5, if you are using the version 4, apply following change in the above code
- import "plyr-react/plyr.css"
+ import "plyr-react/dist/plyr.css"
Ready to use usePlyr hook
If you need the full control over all if possible integration one can imagine, usePlyr is your hook. Here is a simple
and exact Plyr component made with the usePlyr hook. Are curios about how it works follow
this thread and
this proposal.
const Plyr = React.forwardRef((props, ref) => {
const { source, options = null, ...rest } = props
const raptorRef = usePlyr(ref, {
source,
options,
})
return <video ref={raptorRef} className="plyr-react plyr" {...rest} />
})
Accessing the plyr instance using refs
// Function base component
const MyComponent = () => {
const ref = useRef()
useEffect(() => {
console.log("internal plyr instance:", ref.current.plyr)
})
return <Plyr ref={ref} />
}
// Class base component
class MyComponent extends Component {
constructor(props) {
super(props)
this.player = createRef()
}
componentDidMount() {
console.log("internal plyr instance", this.player.current.plyr)
}
render() {
return <Plyr ref={(player) => (this.player.current = player)} />
}
}
API:
Currently the exported APIs contains a latest instance of plyr.
In other words, the passing ref will have access to the player in the structure shown below.
return <Plyr ref={ref} />
// ref can get access to latest plyr instance with `ref.current.plyr`
ref = { current: { plyr } }
// so you can make your player fullscreen π
ref.current.plyr.fullscreen.enter()
Example
You can fork these examples
Javascript example:
Typescript example:
Basic HLS integration Codesandbox
Check out the examples directory for the useHls integration guide.
<video
ref={usePlyr(ref, {
...useHls(hlsSource, options),
source,
})}
className="plyr-react plyr"
/>
Demo: https://react-fpmwns.stackblitz.io
Nightly version of plyr-react:
Contribute
We are open to all new contribution, feel free to read CONTRIBUTING and CODE OF CONDUCT section, make new issue to discuss about the problem, and improve/fix/enhance the source code with your PRs. There is a ready to code Gitpod, you can jump into it from
Support
If you like the project and want to support my work, give star β or fork it.
Thanks
- @realamirhe For provide help for integrate to react-aptor.
- @iwatakeshi For provide help for convert to typescript.
*Note that all licence references and agreements mentioned in the Plyr React README section above
are relevant to that project's source code only.