krassowski / jupyter-manim

manim cell magic for IPython/Jupyter to show the output video
MIT License
194 stars 11 forks source link

On google colab, blob the files instead of base64coding them. #19

Open Kreijstal opened 4 years ago

Kreijstal commented 4 years ago

The problem is that base64coding videos will make the webpage slower and consume way more memory, but there is a better way, blobing the files. Here is a google colab showing it off https://colab.research.google.com/drive/1FF6AHXu0L6nQw-LF8LymRotfcKfBI5Vh?usp=sharing if you see the url of the video, you will see that it is a blob. https://stackoverflow.com/questions/61982233/how-to-get-url-from-google-collab-file-inside-the-workspace/61984094#61984094 A SE question explaining the issue too.

Alternatively, allow a callback function for the url of the file once is completed, the callback will contain the custom code.

krassowski commented 4 years ago

Sounds ok. I would welcome and review a pull request implementing this as an another option if you wish to make one.

Kreijstal commented 4 years ago

Right now I'm very busy :( but, sure if I get the time, I'll be able to work on it (I'm a still nooby in python) but no promises.

Scoder12 commented 4 years ago

How does this work on colab? The issue of not being able to connect to the container using localhost is the entire reason the base64 method is used. When I run your demo on colab, all I get is the following: image

Kreijstal commented 3 years ago

@Scoder12 good question, I think it works by creating a webworker, and the webworker send the requests automatically, that "localhost" you're seeing, is not actually connecting to your localhost, it should be intercepted by the browser and know it's a connection between the main thread, and the webworker. (this is how from google.colab import files does this, so I just read the code to figure it out) image It worked again on my system, however.