How does it work with React ? (specifically Next.js)
See original GitHub issuewhat i have tried so far :
import React, { Fragment, useState, useEffect } from 'react'
import videojsqualityselector from 'videojs-hls-quality-selector'
import 'videojs-contrib-quality-levels'
import dynamic from 'next/dynamic'
// react-video-js-player import
const VideoPlayer = dynamic(
() => import('react-video-js-player'), { ssr: false }
)
const Index = (props) => {
const [player, setPlayer] = useState(undefined)
useEffect(() => {
// react hook when player is ready
if (player !== undefined) {
player.hlsQualitySelector = videojsqualityselector;
player.hlsQualitySelector({
displayCurrentQuality: true,
});
}
}, [player])
const onPlayerReady = p => {
// react-video-js-player states this returns a videojs instance
console.log("Player is ready: ", p);
setPlayer(p)
}
if (typeof window !== "undefined" && typeof window.navigator !== 'undefined') {
return <VideoPlayer
autoplay
muted
onReady={(p) => onPlayerReady(p)}
bigPlayButton={false}
controls={true}
src={links['1080']}
width="720"
height="420"
/>
}
return (
<Fragment>
Hello World
</Fragment>
)
}
export default Index
The player shows and starts playing but it only has the default controls
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
From React to Next.js
Create a Next.js App · Navigate Between Pages · Assets, Metadata, and CSS · Pre-rendering and Data Fetching · Dynamic Routes · API...
Read more >Next JS vs React: Which Framework to Choose for Front-end?
Next JS offers server-side rendering (SSR), whereas Create React App offers client-side rendering, improving the application performance. Next. ...
Read more >Next.js vs. React: The Difference & Best Frontend Framework
React.js is a JS library, and Next.js is a framework based on React. Sometimes it makes more sense to use React than Next.js...
Read more >Next.js vs React: What are the differences? - Imaginary Cloud
Next.js is an open-source framework designed to work with React, created by Vercel. It claims to be the Web's Software Development Kit with...
Read more >Next.js vs React: Which Framework Is Better For your Front-end?
Every Next.js developer has to know React, every React developer has to know JavaScript, as those are pieces built on top of each...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This worked for me
@AbdelazizEid can you share your package.json or the version of videojs, videojs-hls-quality-selector, videojs-contrib-quality-levels