Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing large file in chromecast memory

The problem

I made a receiver application that is just showing a video in loop on the Chromecast. The problem is that the Chromecast doesn't seems to be caching the video in it's cache. So the video keeps getting downloaded every time it finishes a loop and it takes a lot of bandwidth. The video will be hosted on external server so the Chromecast will have to download it from internet every time (I cannot change that spec).

Just for you know, when debugging the receiver application on a desktop chrome application, the video is cached by the browser, so the problem doesn't seems to come from http responses for the caching behaviour.

A solution I explored

I tried to download the video file in ajax and play it. The problem is the Chromecast seems to crash when my Javascript tries to read the responseText field of the xhr when the result has more than 28MB (I tried with a 50MB file (it crashed) and a 28MB file (it didn't crash), the limit could actually be 32MB).

EDIT: I also tried this example and it also makes the chromecast crash...

The question

Is it possible to cache a video of 50-100MB on the Chromecast and prevent it from downloading it every time or is there a memory trick I could be doing to store that video in the Chromecast memory? Loading the video once per application use would be my target result to reduce bandwidth usage.

like image 297
Pierre-Luc Champigny Avatar asked Jul 28 '14 19:07

Pierre-Luc Champigny


People also ask

Can I store files on Chromecast?

Files by Google can now play your locally stored media on a Chromecast display. Files by Google version 1.0. 27 is available now on the Google Play Store and it finally delivers the long-awaited support for Chromecast to all users.

Does Google chromecast have memory?

Speaking of storage, the Chromecast with Google TV comes with only 8GB of storage. You'll have around 5GB of space available out of the box. After installing all of your apps, you'll likely be down to around 4GB of space. You can technically expand the storage on Chromecast.

How do I move apps to external storage on Chromecast?

Under "Device," select Apps. Select the app you want to move. Scroll down and select Storage used. Select your USB drive.

How much storage does the Chromecast with Google TV have?

The Chromecast with Google TV, meanwhile, offers only 8GB of storage, which has notoriously caused problems with the number of apps that users can have installed, how often those apps can be updated, and how often the Chromecast can be updated.


2 Answers

I'm a bit unsure about this answer because I find it a bit too obvious. But I'll give it a try:

You said you had no trouble with a setup where you download 28MB via ajax. Why don't you cut it down even further? You could for example go with 4MB. I'm suggesting this because it may alleviate problems arising from "bursts" of computation as you for example mentioned with reading the responseText field of the xhr object.

After you decided on an appropriate chunk size you could use https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-p5-range-22#section-3 to download your video in parts and then concatenate it in javascript according to your needs. See also Download file in chunks in Chrome Javascript API?

If you have access to the server you could also split the file on the server side such that you can send requests from the client like so:

example.com/movies/my_movie.mp4?chunk=1
like image 158
ben Avatar answered Oct 10 '22 20:10

ben


Try using an Application Cache manifest file to ensure that the file is only downloaded once:

<html manifest="some.manifest">

where some.manifest has the contents:

CACHE MANIFEST
# version 1.0
the_video_to_cache.webm

This will ensure that future HTTP requests for the resource will not cause download. The video will only re-download when the manifest file changes (so you can change the #-prefixed comment string to cause a re-download). Note that the new version will be shown on first page load after the download completes. After an update, the user will see an out-of-date video one time (while the new version downloads) and then see the new version on the next visit.

Note that this may not work if your video is larger that the permitted size of the app cache.

like image 21
apsillers Avatar answered Oct 10 '22 21:10

apsillers