How to create a direct public link to my videos - html

I have over 100+ short videos for my project and I need to make direct public links to each of them. I’m not looking to embed videos. I’m looking for links I can make like on the Apache server but a faster process. Similar to this: http://clips.vorwaerts-gmbh.de/VfE_html5.mp4

There are many different server technologies which will allow you serve static content like mp4 files.
For example node.js supports simple static servers - https://expressjs.com/en/resources/middleware/serve-static.html
A very simple example form the above link can be as basic as:
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic('public/ftp', { 'index': ['default.html', 'default.htm'] }))
app.listen(3000)
You just need to set the correct directory on your server in the app.use.. line.
Note this will not support HLS or DASH, which are adaptive bit rate streaming technologies (see here: https://stackoverflow.com/a/42365034/334402). For that you will need a specialised streaming server, but it sounds like your use case is simpler than this.

You can try Amazon S3 Bucket.
You just need to upload your video files over there,make some configurations and you are good to go.
Speed will be pretty fast as it is hosted on S3.
You can upload files through this tutorial.
https://docs.sumerian.amazonaws.com/tutorials/create/beginner/s3-video/

Related

how to cache html document in AWS

I am working on a project that let users to create their own web pages. I have two options in my mind store the html code in mysql db, or create html doc in the file systems of the server.
I am looking for speed and efficiently as the html codes will be loaded a lot of times.
my question is what would be the best approach? I will use AWS as cloud. Is there any feature in AWS that can help with caching of html docs? would using CDN can help in this case?
Use S3 for static files(Static web hosting) and use cloudfront for cache.
The best approach would be to use AWS S3 to store your html files and use AWS CloudFront CDN to cache the content at edge locations.
For more details check Using CloudFront with Amazon S3.
If you have your own domain and would like to have a valid certificate you could use https://www.cloudflare.com/ssl next you could just store your static page in an AWS S3 bucket, follow this guide: http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html
so at the end, you have something like:
(internet) ---> cloudflare(CDN + SSL) ---> AWS S3
More info also can be found here: https://support.cloudflare.com/hc/en-us/articles/200168926-How-do-I-use-Cloudflare-with-Amazon-s-S3-Service-

Linking to S3 file without URL - Rails - aws-sdk

I have an S3 account, on which are stored videos which I need to play using an HTML5 Video element inside a rails application.
Is it possible for me to be able to load the videos into the player without making the video public and directly linking to it?
I have the gem aws-sdk and I read through the documentation and didn't find any information about this.
Excuse me? How is it unclear what I'm asking? It's not really possible to make it clearer so I guess I'll basically restate what I already said.
I need to be able to this:
<video src="<url of file on S3>"> without making the file public in S3 so anybody can download it.
Look ar presigned URLs. Use the Presigner in the ruby sdk on the server to generate a presigned URL (for get method) for the key and insert that into the html.
There is an article page about doing this using the aws-sdk.
http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjectPreSignedURLRubySDK.html
I've only ever used Paperclip to do so.
https://github.com/thoughtbot/paperclip/wiki/Restricting-Access-to-Objects-Stored-on-Amazon-S3
To access private content in S3 from your rails application, there are multiple approaches available
Create a Sign URL using Ruby AWS SDK from your Rails Backend and return the URL to the browser so that your HTML5 player can access them
Using AWS STS and AWS Ruby SDK at Rails Backend, generate a temporarily access token (Which has grants to s3 bucket) and return it to the browser, where browser can use AWS JS SDK + Token to request the file
For better performance use AWS Cloufront RTMP distributions for the Videos which serves the files from S3 with Signed URLs and Origin Access Identity limiting public access

Playing local HTML5 audio from an external server on desktop

My problem corresponds with the following hypothetical situation:
I have a website with a blog, which stores a playlist of music (just the filenames). I can edit this playlist remotely, for example from my phone when I am on the move. The content of the website is stored in a database on the server (MySQL), which cannot be accessed remotely.
When I get home and I am writing on my blog, I want to play the files in the list, on the same website, by using HTML5 audio. The files are located on my local computer at home. Hence I want to access these local files through my website.
An example of how I am addressing a local file is file:///M:/music.mp3.
The whole set-up works if I work from localhost, so I don't think it is a coding issue.
The problem is that both Firefox and Chrome, my favourite browsers, do not allow third party websites to access my local files without my active input.
It makes sense that the construction above is prevented by user agents due to security issues. I was hoping to find a solution in the fact that I use browser integrated HTML5 audio; IMO, there would be no security issue since the files that are loaded by HTML5 audio cannot be accessed via DOM, so some proper coding of the browsers would have left some breathing room here.
Some extra conditions:
I am looking for the blog and the music player to remain integrated.
I don't want to store my music files remotely.
I don't want to set up a local server.
Perhaps there is a way to add a security exception for my website to my browser, but this seems no longer the case for Firefox.
Any suggestion is most welcome!
I would suggest taking a look at the File System API. It's a very new API that's currently only working with chrome unfortunately :/
What you can basically do is request for access to the local filesystem using window.requestFileSystem() or window.webkitRequestFileSystem(), which has a success callback with a FileSystem object. Using this objects root (a Directory Entry object) you can look up the file using root.getFile(). This has a callback with a FileEntry object. You can then use this file entry to get the actual File object using fileEntry.file() and pass that into a FileReader object to get the data url. Untested example below, probably not perfect and you probably have to tweak with webkit prefixes.
// when file system loads
function onFs(fs){
// locate file
fs.root.getFile('M:/music.mp3', {/*options*/}, function(fileEntry){
// get file / blob
fileEntry.file(function(file) {
// read file
var reader = new FileReader();
reader.onload = function(event) {
var dataUrl = event.target.result;
// create new audio object with data url
// e.g. <audio src="dataUrl" />
};
reader.readAsDataURL(file);
// handle error
} , onError);
// handle error
}, onError);
}
// Opening a file system with temporary storage
window.requestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, onFS, onError);
(I'd like to also mention, I've never used the File System API, but it seems promising)

How to create HTML5 100% offline applications?

Sometimes I need to write a small program just to represent some data in a chart, or similar stuff. I have been wanting to do this kind of things through the browser, with HTML5. I think it would be nice to use its canvas to create a nice UI for simple apps.
I have read some articles related to offline applications with HTML5, but they focus on downloading all the data you need and save it to the cache to use it offline later. You even need to set up an Apache server (or similar) to create your app.
I don't need my app to be online, just in my computer. I just want to create a simple application, nothing to do with internet at all.
How can I do this? Is it even possible or worthy? Is there any "Hello world!" tutorial about this around there?
Something like Mozilla Prism would be good for displaying the content as an application.
There's no need to have a web server like Apache for just displaying HTML5/Javascript in a browser. You can just have it all in a folder on your desktop and then load it in the browser with the file:// protocol.
For example file://C:/Documents and Settings/YourUser/Desktop/YourApp/index.html would open an HTML file in a folder called YourApp on your user's desktop.
If you ever find you need to read static HTML+Javascript files locally then I'd recommend using this python command in the console:
python -m SimpleHTTPServer
It launches a simple HTTP server (who'd of guessed) that serves files from the current working directory. Effectively, it's the same as launching an apache webserver, putting some static assets in /var/www/... etc. etc.
You could also just browse to the assets at file:///some/folder; however, most browsers will prevent javascript from using AJAX when files are loaded in that way, which will manifest as a bunch of bugs when you go to load it.

Multithread http file uploads

Is it possible to multithread file uploads using http post requests (not ftp)? Are there any flash or java uploaders that take advantage of multithreaded uploads?
It is possible, and I'm sure there are several Flash and Java applets that supports it. It's just a matter of creating separate connections. Here's one of the results I found using Google:
http://www.uploadify.com/
HTML5 MultiFile uploads and this is example:
http://safron.su/playground/html5uploader/
P.S. This example is designed to load the picture.