Reactjs server out of memory problem & so laggy after adding local videos streaming?

Viewed 15

Server was so laggy after adding videos to stream on local server on src folder

1 Answers

The solution was to move the video to public/videos/videoTest.mp4 folder install miui library to use card media component or use any other video & to access them like this:

const videoPath = process.env.PUBLIC_URL; // to fetch an OS(Windows, Mac, Linux) independent path
const videoTest = "/videos/videoTest.mp4";
// install miui library to use card media component or use any other video
 <CardMedia
          height={"100%"}
          component="video"
          controls
          src={videoPath + videoTest}
        ></CardMedia>

& u can also compress videos to make it even faster with tools like handlebreak

Related