title: Defining a function to call a video within Jupyter Notebook
body: <p>I have a small piece of code which displays an mp4 video within the Jupyter notebook. However, I wish to hide this code away within a callable module, so I need to nest it within a function. However, calling the function doesn't send the video to my display.</p>
  
  <pre><code>from IPython.display import HTML
  import base64
  import io
  
  def qq ():
      video = io.open('/Users/.../video.mp4', 'r+b').read()
      encoded = base64.b64encode(video)
      return(HTML(data='''&lt;video width="160" height="120" controls&gt;
      &lt;source src="data:video/mp4;base64,{0}" type="video/mp4" /
      &lt;/video&gt;'''.format(encoded.decode('ascii'))))
  
  qq
  </code></pre>
  
  <p>When I run the code above, I get the following error message:</p>
  
  <pre><code>&lt;function __main__.qq&gt;
  </code></pre>