How to use blob urls with Chromecast? - javascript

I am currently experimenting with the google-castable-video component of the Google Web Components of the Polymer library. So far no larger issues. But when I try to stream a video, which has a blob-url as source, the stream on the Chromecast starts buffering, but immediatly stops without showing a frame.
Now i am asking myself, if it is even possible to use an url like blob:http%3A//127.0.0.1%3A8889/fd3e3425-f5ea-48f1-a380-5febf0f071ad with the Chromecast-SDK. If not, are there any alternative ways to load a local video and stream that with this Web-Component? (Excluding existing tools like Videostream, etc.)
Any help appreciated.

The URL you have provided is pointing to the local loopback so when chromecast receives that, it tries to load that from its own local device and clearly that is not what you want. If you want to serve local content from your sender side, you need to embed a local web server in your sender and serve content using that web server; you can search on StackOverflow for prior posts on serving local content to chromecast.

Related

Squarespace Developer Mode adding files

I am in developer mode in the .region file trying to add a background video with the video tag. I put the mp4 file into the template folder and I have been trying to access it through src="video.mp4" and display the video. It doesn't display the video and I am not sure why I can't grab it. When i change the source to any http// video online it works so its not the code. It only doesn't display the video when I try grabbing it from the local folder. Any leads or help would be appreciated. Thank you!
Files that are directly located in the /template folder are not intended to be accessible via http. Instead, put the file within /template/assets and then reference the file as /assets/video.mp4.
If that doesn't help, ensure that the file is even accessible via http by entering http://yoursite.squarespace.com/assets/video.mp4 in the address bar (using your site's correct URL). If you can access the video file, then it will work as a src attribute of a video element. If you cannot access it, then something else is going on: either you haven't uploaded the file or the file name is incorrect.
Another tip: if using the full URL for a file (as opposed to the relative URL), try using https for the protocol in place of http. The correct protocol depends on your site's settings, of course, and whether you are using your built-in or custom domain.
If using the local development server via Node.js (as opposed to the live server, that is, your actual Squarespace site), try pushing/uploading the files to the live server on Squarespace (via Git or SFTP) and then retesting locally. I've found that sometimes this may be required due to caching in the local environment. This will also reveal whether the file you are uploading is too large (the documentation does claim a 1MB limit which may be true, though it may be as large as 5MB or 20MB if the docs are out of date; I cannot recall whether this has changed).
If the file is too large for the /assets folder, then your only other option besides hosting it via a different service entirely is to use the file storage via the Squarespace Config UI, which allows up to 20MB, and referencing your video via that path. You'd have to get the video down to 20MB by shortening, scaling or further compressing it.
If hosting the file via a different service, Cloudinary may be worth considering; a free account may allow up to a 100MB video file and enough bandwidth (assuming your website's traffic is relatively low).

Possible download / upload manager embedded on html page with access to local filesystem

As the title indicates i want to have a certain application get access to the local file system. To describe why i will illustrate my situation:
I am a running a IIS WebApplication with the C# MVC 4 Framework as backend module. The site solely consists of HTML, CSS markup and some JS. The page will be loaded in IE11+ (Edge) only. For the standard procedure of displaying and accessing data from as well as sending data to the server this works quite fine.
On a certain page I want the user to be able to upload a file using a simple file dialog, like the one you can initiate with a simple <input type="file"> tag. I also want to offer the posibility to download files from the server but need to know where files has been saved / will be saved to.
As described on a lot of different websites, just like this one here, the HTML5 File API does a great job but will not be able to return the full qualified filename including the local path directions, same for JS accessing the file object.
As my research confirmed HTML5, JS and also SWF (Flash) will not report detailed information because they are all sandboxed applications or restricted by RFCs. I already unterstood and appreciate the effort to secure my trips to internet.
But in this case do need the paths where a file was upload from and the file has been downloaded to.
So my question is, what is the best way to expose the full path directions for a up- as well as downloaded file to report them back to the server?
Is it possible to embed a SWF object inside HTML which will run inside an Adobe AIR sandbox or is a signed JAVA Applet still the one and only solution to accomblish this security breaking task?
A solution i would also apreciate would be the possiblity to ask the user to get access the file system, like you grant access to the web push service to receive notifications.
Also if there is a possible solution which may suite my circumstances please let me know by adding some simeple examples / revealing some factful links, thanks in advance.

PhoneGap show downloaded image in iframe

I have a PhoneGap application in which I need to download certain images for offline usage and show those inside an iframe. Is this possible and do I need something like CorHTTPD (https://github.com/floatinghotpot/cordova-httpd) to serve the assets locally?
I have been trying to store the files on file system but when I try to show those (even without being inside iframe), those doesn't show. They seem to be loaded (can be seen in network console in remote debugging), though, but (of course) without any headers.
After spending more and more time on this and settings GapDebug correctly to remote debug my application, I was finally able to solve my problem by giving
{responseType: "arraybuffer"}
to AngularJS's $http.get method as config parameter as described here. Now I am able to get the images to ArrayBuffer correctly and from there to base64 encode them to be added inside HTML stored offline. Suitable solution for my case at least..

Amazon CloudFront - Restrict MP3 to play on specific website

I've been trying figure out how to get mp3 files in an Amazon S3 bucket paired with Cloudfront to allow me to stream the files directly on my site but not allow anyone to take the source URL of the mp3s by viewing the source code of the page and then sharing or leeching the link.
Right now, I am using an html5 mp3 playlist from mediaelements.js and the mp3 file is always in the source code. That's fine, but I want to only allow the mp3 to play on my specific website and if the link gets copied from the source and accessed in a different browser it should show an access restricted error.
I tired to update the cloudfront policy to expire within 30 seconds of the page load, but that will ultimately prevent the files from playing once the 30 seconds is over and if the user didn't play one of the tracks prior to that expiration.
Is there another way to do this without putting a time expiration on the cloudfront links?
I think this is what you are looking for: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls-overview.html
Basically you can vend URLs dynamically from your service, and CloudFront will validate signature. You can also set pretty short expiration time to avoid wide distribution of your URL, and restrict IP addresses that might access URL (see Custom Policies section in the referenced document).
It's possible with just few line wizard coding on back-end (private method) ,i prefer to using free tier EC2 instance and configure environment for handle streamable contents for deliver everything clear this way provide a restrict page to someone going to leech or using IDM for donwload your mp3 files.
Example : Grooveshark.com
However still there is some another methods like Owain answer .
Unfortunately, you can't. MediaElements.js may be hosted on your site, but it's being run on the user's computer. So although it looks like they are playing an MP3 via your site, they are actually just downloading a URL from your site and playing it using code running on their computer.
You could write server-side code that went off to S3 and retrieved the MP3 before returning it as if it were a file hosted on your server, but that still wouldn't limit people from copying that link, unless some sort of session were used before returning the file to ensure they're logged in via your site.
But that would mean you can't make use of CloudFront. That's the compromise. Distribute your MP3 via a CDN and improve download performance by hosting the file in an edge location closer to your users, or take advantage of server-side security to ensure your IP isn't hosted by unscrupulous third parties.

ActionScript - load video from users hard drives without server

I need to play on my .swf a movie (h264) from the users' hard drive.
Unfortunately the as3 components only read from URLs or streams, and you can't set the data or load from your c:/ path as the security sandbox stops you. Here is what each component loads:
Video >> netStream
VideoDisplay >> URL
VideoPlayer >> URL
I tried attaching a fileReference.data (byteArray) to all of them but nothing seems to work.
-
my question: Is there a way of doing this without actually uploading the videos (h254) to the server?
-
I have read that it is possible to do a javascript that can upload the data to it and then pass it to the netstream but I can't figure out how to do it myself.
Any hint, hack, idea is welcome.
Many thanks.
With flash 10 you can load files into the player without having to bounce them off the server. Here's a quick tutorial on the subject: http://www.thedesilva.com/2008/11/flash-10-file-reference/
That actually depends on the compile settings of the swf. The rule is that a swf can either read files from a server or it can read files locally. Further, a swf cannot load another swf which has the alternative access.
To get a swf to read off of the hard drive through Flash CS3, open the FLA, go to "Publish settings" and then click "Flash". At the bottom there is a select box which will let you choose whether you want to read local or network files.
The Flex instructions are a bit more involved but they are located here:
http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_04.html
You're running into the Flash Player sandbox security policies here. The only way I can think of to load something locally is to run a separate app that acts as a HTTP server, so you can load the local files through the loopback interface (URL with http://127.0.0.1/)
There is no way of doing this...
Only possible solution is to have an air app.

Categories