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

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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1