RTradeLtd / Temporal

☄️ Temporal is an easy-to-use, enterprise-grade interface into distributed and decentralized storage
https://temporal.cloud
MIT License
227 stars 40 forks source link

Streaming Video (and/or SRC attributes directly in DOM) #468

Closed Clay-Ferguson closed 4 years ago

Clay-Ferguson commented 4 years ago

I know Temporal provides 'storage' of certain amounts of data for a certain price, however I was unable to find information in whether it's ok, or doable, to use Temporal to host what is essentially the bandwidth for serving the data to multiple different users, and how is the bandwidth cost accounted for, in a scenario where someone (like me) is creating a video streaming service?

Also is there a way to make ordinary IMG tags have a SRC= on them that works. So basically I'm also not even sure what best practice is for 'consuming' resuorces (serving files) other than what's here:

https://gateway.temporal.cloud/ipns/docs.api.temporal.cloud/ipfs.html#post-download-file35

UPDATE: To clarify, regarding video streaming, I mean just having the 'video' tag in the HTML and making that point to some Temporal service to get the data? You know, just basic 'video' tag support.

bonedaddy commented 4 years ago

So we only charge for storage, no bandwidth charges; Since we primarily run out of our own datacenter we are extremely fortunate to not have to worry about bandwidth charges. If our ISP does try and throttle our bandwidth, simple phone call complaining to them fixes that up.

As such it's entirely up to you whether or not you want to use our servers as the "source of video" or just as a backup of your video. The one thing to note though is that all of our servers are located in Canada. If you have users coming from Europe there might be some increased latency. An offset to this would be loading content from publicly available gateways in Europe and streaming content from them.

Also is there a way to make ordinary IMG tags have a SRC= on them that works. So basically I'm also not even sure what best practice is for 'consuming' resuorces (serving files) other than what's here: https://gateway.temporal.cloud/ipns/docs.api.temporal.cloud/ipfs.html#post-download-file35 UPDATE: To clarify, regarding video streaming, I mean just having the 'video' tag in the HTML and making that point to some Temporal service to get the data? You know, just basic 'video' tag support.

For this your best bet will be using the IPFS HTTP API proxy we have (i think). In theory that download call will work, but it doesn't do streaming or anything so requires you downloading the full thing first.

Alternatively you can load content through our gateway which should support streaming.

Clay-Ferguson commented 4 years ago

I'm not quite sure what you mean by saying "our gateway" does support streaming. Is there some document I missed in your website that discusses how access that gateway? Frankly I'm not enough of a networking expert to really even know what you mean by "our gateway". I know gateways are nodes on a network, but you seem to have some very specific nuanced meaning to that which goes over my head (I'm a coder with 30 yrs experience, just not a hardcore network expert).

Are you saying there IS some url out there, on your servers, that can support the 'video' tag in HTML ?

Of course even if the answer to that is "yes" I think you're also saying there's just no guarantee on bandwidth, etc, so I might need to look for other solutions/hosts, if I want to have bandwidth.

bonedaddy commented 4 years ago

I'm not quite sure what you mean by saying "our gateway" does support streaming. Is there some document I missed in your website that discusses how access that gateway? Frankly I'm not enough of a networking expert to really even know what you mean by "our gateway".

I mean our IPFS gateway https://gateway.temporal.cloud/ipfs or https://gateway.temporal.cloud/ipns, some gateways disable video streaming, like cloudflare's IPFS gateway. If you try to load a video file and I believe music files cloudflare's gateway will block that vs ours which we allow

Are you saying there IS some url out there, on your servers, that can support the 'video' tag in HTML ?

All of them should, it just depends on what you're looking for. If you download the file from your API, it would require downloading the entire file first before you could play the content. If you load the video from our IPFS gateway, then I think it will work? Im not too familiar on how gateways handle streaming of content, but if you load a video file from our gateway you won't have to download the entire file first as you do with our API. Alternatively you can look into using the IPFS HTTP API which supports stream enabled API calls.

Of course even if the answer to that is "yes" I think you're also saying there's just no guarantee on bandwidth, etc, so I might need to look for other solutions/hosts, if I want to have bandwidth.

I'm not sure what I said that conveyed this? Perhaps I phrased my response incorrectly, but we don't charge users for bandwidth and we dont have bandwidth limitations.

Clay-Ferguson commented 4 years ago

This may be TMI (sorry) but here goes....

I'm working on a social-media & file-sharing app which I originally had working with IPFS by running an instance if IPFS in my docker container like this:

https://github.com/Clay-Ferguson/quantizr/blob/master/docker-compose-prod.yaml

So my app can save/read all IPFS files thru that local dockerized instance (that I run on my server using docker compose right alongside my web app) of GO-IPFS and accessing all the standard REST endpoints of IPFS. The problem to solve, being: My tiny $20/mo Linode instance won't scale...(I'm an individual w/ no sponsorship)

But I think based on what you're saying about your gateway is that I can make calls directly to your gateway, and all the IPFS endpoints are going to be there!!! That means all my IPFS gateway code will work, just pointed to your instance (gateway), instead of to my internal docker IPFS instance. Amazing! (assuming I'm right)

I'm about to dig in deeper to see if this is all true! Thanks for your patience, and your explanations!

UPDATE:

Yes I just did confirm accessing urls like this works in IMG tags, and even VIDEO tags!!! I just watched a video stream! https://gateway.temporal.cloud/ipfs/[hash] So this clears up all confusion I had!

bonedaddy commented 4 years ago

This may be TMI (sorry) but here goes....

Personally I'm a fan of providing as much information as possible, generally speaking it helps resolve things a bit faster, as there is likely to be less rounds of back/forth so not a problem

The problem to solve, being: My tiny $20/mo Linode instance won't scale...(I'm an individual w/ no sponsorship)

Yea that is definitely a problem with IPFS right now, unless you've got beefy hardware you will have a hard time supporting load

But I think based on what you're saying about your gateway is that I can make calls directly to your gateway, and all the IPFS endpoints are going to be there!!! That means all my IPFS gateway code will work, just pointed to your instance (gateway), instead of to my internal docker IPFS instance. Amazing! (assuming I'm right)

Well this depends on how you are using the gateway. Gateways technically enable read-only access to the IPFS HTTP API by default, and have the capabilities of being run in "writeable mode" which essentially allows you to access the underlying IPFS HTTP API. For security reasons we only support accessing /ipfs and /ipns paths via the gateway which means you can't access the underlying read-only IPFS HTTP API calls, even though the gateway is running in read-only mode.

For example you can try going to https://gateway.temporal.cloud/api/v0/ls (which is a valid IPFS HTTP API command) and you'll get redirected to https://temporal.cloud

Yes I just did confirm accessing urls like this works in IMG tags, and even VIDEO tags!!! I just watched a video stream!

Awesome good to hear. If everything is resolved let me know and I can close the ticket, otherwise let me know what I can do to help resolve it.

Clay-Ferguson commented 4 years ago

Yes we can close the ticket. I now have ability for my users to upload (using your IPFS proprietary javascript API, directly from the browser), and then I just use the 'gateway'-based URL for viewing/playing the uploaded content. So that covers everything 100%! I now have a complete media platform that scales!!

I hope to be driving some business to you/Temporal (if I can start getting more users), because my app will now require user to have Temporal.Cloud account in order for them to do their storage.

bonedaddy commented 4 years ago

Awesome glad to hear it works.

I hope to be driving some business to you/Temporal (if I can start getting more users), because my app will now require user to have Temporal.Cloud account in order for them to do their storage.

:rocket: Best of luck to your application. We're more than happy to tweet links to people's applications that are built ontop of Temporal, let me know if this is something you're interested in and I'll get it tweeted out.

Clay-Ferguson commented 4 years ago

I wanted to modify a couple of things before responding to this, but yes that would be a huge boost and very much appreciated if Temporal tweeted about 'quantizr.com' and it's ability to upload to Temporal Cloud, and the fact that Quantizr expects the user to create a Temporal account to upload files!!

bonedaddy commented 4 years ago

:rocket: I'll get this out shortly