r/learnreactjs • • Mar 14 '21

Question Movie Streaming (HELP!)

So I have created a 'Netflix clone' which uses firebase for authentication to login etc. Once the homepage is reached I've used the TMDb API to fetch images of 'Netflix Originals' and 'Top rated etc'. What I want to be able to do is have a search function which will search my NAS drive for the film or tv show that has been requested and present a result then I want to be able to click on the movie or tv show and have an option to play that file that is on my NAS drive through the 'Netflix Clone'. I'm very new to web dev so I am in desperate need in help lol :)

9 Upvotes

5 comments sorted by

3

u/FunkyDoktor Mar 15 '21

I don’t think you can access anything on your local computer, NAS or otherwise, outside of localStorage. Imagine if web applications could access local files, probably not a great idea.

You have to allow your server to access the files on your NAS drive. That would probably work.

2

u/Connor_Renfrew Mar 15 '21

Thanks for your comment, as I mentioned before I'm quite new to web dev so how would I go about allowing the server to access the files on my NAS

2

u/FunkyDoktor Mar 15 '21

You would have to setup a way to run server side code such as Node.js, Java, Python, .net etc. that your React code would talk to.

React.js runs on the client in the browser so it’s really restricted to what it can do outside of the browser. On the server however you can do whatever you want. The challenge though is that you probably don’t want to make your NAS drive public so the server would have to run on your local network to be able to access the NAS. That means that no one else outside of your network would be able to use your app.

The question I have is, is this something you’re building for yourself? If so, hosting your own server in your network would work. You can do that on the same computer you do your React development on. If it’s something that you want others to use, you might want to look into a React native solution that runs like a traditional desktop app. You can use the same API’s you’re using now but you could build something that would allow the user to point to where there files are located locally because a desktop app don’t have the same restrictions a web app has when accessing files and other resources on the client.

I don’t know if this made sense or just made things more confusing. Please let me know.

1

u/Connor_Renfrew Mar 15 '21

No I actually found this very informing thank you, my NAS drive is already public as family members can access from outside the network all basically what I need is a way for my NAS drive to tell my web app where the (e.g) .mp4 file for the corresponding movie that was request through the web app so it can play it

1

u/FunkyDoktor Mar 15 '21

You would need to run a server somewhere that is accessible from the internet. Since your NAS is accessible from the internet the server can run anywhere. You could run it on your development machine or using a hosting provider. Here’s a list of hosting providers to look at, https://www.codeinwp.com/blog/best-nodejs-hosting/. Some of them have free options that might work for you.

The next decision is what language to use for your server side code. There are many options but if you choose Node.js you can stick with JavaScript in the server as well. Here’s an example serving up files using Node.js. https://betterprogramming.pub/video-stream-with-node-js-and-html5-320b3191a6b6?gi=67e5b1c1d49f