Google Colab Play Video

Aug 28, 2020
from IPython.display import HTMLfrom base64 import b64encodevideo_path = "/content/test.mp4"mp4 = open(video_path, "rb").read()data_url = "data:video/mp4;base64," + b64encode(mp4).decode()HTML(f"""<video width=400 controls>      <source src="{data_url}" type="video/mp4"></video>""")

NOTE: If the video fail to play, you might need to convert the video format. I supposed there is a size limit as well.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.