You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Spatial Navigation to fast forward/reverse/play/stop video using remote on SmartTV. I tried but it doesn't work on TizenOS and WebOS Simulator. I don't know where the problem is. I tried to find a specific example but there is none. Hope to receive help from everyone. Thanks
import{useEffect,useMemo,useRef}from'react';importvideojsfrom'video.js';import'video.js/dist/video-js.css';exportconstVideoJSPlayer=({ options, onReady })=>{constvideoRef=useRef(null);constplayerRef=useRef(null);constmergedOptions=useMemo(()=>{return{autoplay: true,controls: false,responsive: true,muted: false,fluid: true,errorDisplay: false,html5: {vhs: {overrideNative: !videojs.browser.IS_SAFARI,enableLowInitialPlaylist: true,},nativeAudioTracks: false,nativeVideoTracks: false,},spatialNavigation: {enabled: true,horizontalSeek: true,},// Default smooth seeking to falseenableSmoothSeeking: true,disableSeekWhileScrubbingOnMobile: true,
...options,};},[options]);useEffect(()=>{if(!playerRef.current){constvideoElement=document.createElement('video-js');videoElement.classList.add('vjs-big-play-centered');videoRef.current.appendChild(videoElement);constplayer=videojs(videoElement,mergedOptions,()=>{videojs.log('Player is ready');onReady?.(player);});playerRef.current=player;playerRef.current.spatialNavigation.start();// TODO}else{constplayer=playerRef.current;player.autoplay(mergedOptions.autoplay);player.src(mergedOptions.sources);}// eslint-disable-next-line react-hooks/exhaustive-deps},[mergedOptions,videoRef]);// Dispose the Video.js player when the functional component unmountsuseEffect(()=>{constplayer=playerRef.current;return()=>{if(player&&!player.isDisposed()){player.dispose();playerRef.current=null;}};},[playerRef]);return(<divdata-vjs-player><divref={videoRef}/></div>);};
The text was updated successfully, but these errors were encountered:
If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
I use Spatial Navigation to fast forward/reverse/play/stop video using remote on SmartTV. I tried but it doesn't work on TizenOS and WebOS Simulator. I don't know where the problem is. I tried to find a specific example but there is none. Hope to receive help from everyone. Thanks
The text was updated successfully, but these errors were encountered: