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
Related
i'm creating an application that generates invoice .It uses html and javascript.Every thing is working perfectly but it is not showing logo image.Any help would be appreciated.
You can load resources from your app's bundle via a custom URL scheme, e.g. my_url_scheme://logo.png (replace my_url_scheme with something unique of your choice).
You need to implement a WKURLSchemeHandler and registering it with your WKWebView via -[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]. Your WKURLSchemeHandler will be responsible for handling any requests with the my_url_scheme:// scheme, and can load the appropriate resource from the app's bundle and return it there.
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/
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-
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.
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.