Reputation: 830
I sure this could be a stupid question after all but i have a personal project in mind, i want to develop a app web with a html5 video that buffer video from a server service of hosting files (mega.co.nz), Mega provided an API for basis operations, what i want is that simply, buffering video but i have vague knowledges for all that concern in streaming matters, i search exhaustively but i didn't find much things or maybe i'm very ambiguos searching these terms, i would desire if anyone could post me resources of pages that talk about streaming buffering under javascript and html5, i would be so grateful :)
Regards!
Upvotes: 3
Views: 3085
Reputation: 14093
I am not sure whether I totally got it. If what you want is displaying a video hosted by a remote serice in an HTML5
page, this is the way we generally do it :
<video width="width_in_pixels" height="height_in_pixels" controls>
<source src="your_url.mp4" type="video/mp4">
<source src="your_url.ogg" type="video/ogg">
<!-- a list of the different mime types available for your video -->
</video>
Here is a list of the supported video formats by HTML5.
EDIT :
While certain webservices such as Mega are providing encrypted, temporary Urls, what we do at my company is using a streaming proxy. We used a small HTTP server internally that can receive requests such as :
http://streaming_server/fetch?url=<a_url>&type=youtube-api&api-version=1
The above example works for Youtube urls we want to convert to a continuous stream of data. The server is internally converting the public url to the .mp4 one and sends back through HTTP the data he is receiving from Youtube's server.
So, what you could do, is write a modular streaming server (so it could work with Mega or Fileserve or whatever) yourself which would be able to handle a particular request for handling Mega's API like our does for Youtube :
http://your_streaming_server/fetch?type=mega-api&file_id=<id>&file_key=<key>
This will forward the file raw data to the client. This is just an example and credentials management or other security aspects of the retrieval are up to you, but you get the idea.
Delegating the responsability of downloading data to a third party service is a good idea, since this will decouple your code from specific functional parts and will provide the same service across all your client applications.
Upvotes: 5