Last active
          February 15, 2022 08:48 
        
      - 
      
- 
        Save thanasi/ad31f798b747629e717bcebd2cad15cf to your computer and use it in GitHub Desktop. 
    Embed a local video file in a Jupyter Notebook
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ######################################### | |
| # using cell magic | |
| ######################################### | |
| %%HTML | |
| <div align="middle"> | |
| <video width="80%" controls> | |
| <source src="path/to/my.mp4" type="video/mp4"> | |
| </video></div> | |
| ######################################### | |
| # explicitly calling the HTML renderer: | |
| ######################################### | |
| from IPython.display import HTML | |
| HTML(""" | |
| <div align="middle"> | |
| <video width="80%" controls> | |
| <source src="path/to/my.mp4" type="video/mp4"> | |
| </video></div>""") | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
This snippet is a bit outdated now. The
IPython.displaymodule now contains classes for embedding local and remote video content.https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html