2

I spent a few days researching and reading articles of firebase, firebase Cloud Storage, nodejs, canvas, javascript, apis, etc. but what I found is complicated and I think there is an easier way to do it. Can someone guide me to get an easy solution?

It could be implemented with nodejs from the backend at the moment I receive the download URL or with javascript from the interface at the moment I am loading the video.mp4 file.

The upload of the video is done by File with the method ".put(file)" and not by blob.

It could be done from the client side with the "File" interface or from the server side with node.js.

Enmanuel
  • 443
  • 4
  • 7
  • What's the question? When you say *The upload of the video is done by File *, do you mean like the js [File](https://developer.mozilla.org/en-US/docs/Web/API/File) class object? If so, then it's just a Blob, so what you wanted to do with a Blob can be done directly with a File. However, what is .put ? The file extension? The http method you use to send your data to the server? – Kaiido Nov 12 '17 at 03:24
  • The put() method takes files through the JavaScript File and Blob APIs and uploads them to Cloud Storage. [Firebase/Storage](https://firebase.google.com/docs/storage/web/upload-files) – Enmanuel Nov 12 '17 at 03:52
  • Alright, but then *"What is the question?"* And a File is a Blob. – Kaiido Nov 12 '17 at 04:32
  • Question; What would be the best way to extract an image or a thumbnail from a video? The File interface inherits methods from the Blob interface, it is not exactly the same. It could be done from the client side with File or from the server side with node.js, thanks for your interest @kaiido – Enmanuel Nov 12 '17 at 14:44
  • A File is a Blob. A Blob is not a File. The main differences are that File do have a `name` and a `lastModified` properties. All you can do with a Blob canbe done with a File. The only API where it does matter if it is a Blob or a File is `FormData.append()`, where it will use the File's name automatically, where you would have to pass it as the third argument of `append(keyName, Blob, filename)`. – Kaiido Nov 13 '17 at 00:38
  • And for what is the best way to generate a thumbnail of a video, it will depend on what you want to do with this thumbnail. As you said, it can be done server-side (look at ffmpeg) or on the front-side (look at CanvasRenderingContext2D). We can't know for you what's the best in your case. – Kaiido Nov 13 '17 at 00:53
  • Discuss whether they are the same or not is nonsense, is like saying that jquery is the same as javascript, "File" is an interface that was developed for something and logically has different qualities, anyway is your opinion and I respect it, but I do not think the same. – Enmanuel Nov 14 '17 at 10:56
  • A File is a Blob. All you can do with a Blob can be done with a File directly. You say it would be simpler if it was a Blob, well you are lucky, a File is a Blob. It's not a matter of opinions, just a fact. – Kaiido Nov 14 '17 at 11:03
  • On the other hand, the most correct and easiest way for my needs would be; with vanilla js, enter the .mp4 in a ` – Enmanuel Nov 14 '17 at 11:19
  • What was the first hand? ([I do know](https://stackoverflow.com/a/32708998/3702797) how to get a thumbnail from a video in js, thanks) But depending on what you want to do with this thumbnail, it may not be the best thing to do it on the front-side. – Kaiido Nov 14 '17 at 11:24
  • But really the goal would be to do it in the easiest way possible and I find it strange that "Fireabse-tools" has no other option for this problem, so here I am asking, I'm not a firebase expert and there is something that escapes us. – Enmanuel Nov 14 '17 at 11:29
  • The best way to do it is for the user to see the clipped image without problems and the Firebase STORAGE upload the image without problems, I think it would be like that [Codepein example](https://codepen.io/anon/pen/jawRbg) Although I'm still looking for something better and that some Firebase expert can clarify – Enmanuel Nov 14 '17 at 11:48
  • maybe useful: https://stackoverflow.com/questions/43750325/getting-a-thumbnail-from-a-video-using-cloud-functions-for-firebase – driedler Jul 06 '18 at 00:18

0 Answers0