'Returns animation as an HTML5 video tag.
This saves the animation as an h264 video, encoded in base64
directly into the HTML5 video tag. This respects the rc parameters
for the writer as well as the bitrate. This also makes use of the
``interval`` to control the speed, and uses the ``repeat``
parameter to decide whether to loop.'

def to_html5_video(self):

    VIDEO_TAG = u'<video    {size}    {options}>\n        <source    type="video/mp4"    src="data:video/mp4;base64,{video}">\n        Your    browser    does    not    support    the    video    tag.\n</video>'
    if (not hasattr(self, u'_base64_video')):
        with tempfile.NamedTemporaryFile(suffix=u'.m4v', delete=False) as f:
            Writer = writers[rcParams[u'animation.writer']]
            writer = Writer(codec=u'h264', bitrate=rcParams[u'animation.bitrate'], fps=(1000.0 / self._interval))
            self.save(f.name, writer=writer)
        with open(f.name, u'rb') as video:
            vid64 = encodebytes(video.read())
            self._base64_video = vid64.decode(u'ascii')
            self._video_size = u'width="{0}"    height="{1}"'.format(*writer.frame_size)
        os.remove(f.name)
    options = [u'controls', u'autoplay']
    if self.repeat:
        options.append(u'loop')
    return VIDEO_TAG.format(video=self._base64_video, size=self._video_size, options=u'    '.join(options))
