Reputation: 15
I've been researching and i did not found anything about that.
I need a chrome application that will run on Chrome OS be able to download a file (image, mp3, video, etc) and then display the content as HTML.
I mean if the app download a video, then play it on a video tag. The same for a image...download it and display on img tag.
Thanks!!
Upvotes: 1
Views: 1631
Reputation: 834
I also worked with this issue, here a working example of saving to filesystem + showing on screen:
var video = document.getElementById("video");
fetch('http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_20mb.mp4')
.then(function(response) {
return response.blob();
})
.then(function(myBlob) {
var objectURL = URL.createObjectURL(myBlob);
video.src = objectURL;
var config = {type: 'saveFile', suggestedName: chosenEntry.name};
chrome.fileSystem.chooseEntry(config, function(writableEntry) {
writeFileEntry(writableEntry, myBlob, function(e) {
output.textContent = 'Write complete :)';
});
});
})
Upvotes: 1
Reputation: 77523
See Chrome App documentation on Handling external content. It provides a good overview.
A short version:
blob:
(you can plug it into a <video src="...">
, for instance).Upvotes: 0