def METHOD_NAME(self, filename=None, fps=30, directory=None, **kwargs):
    """Create a video recording context, generating the output filename if necessary.
    Code inspired from https://github.com/petrikvladimir/RoboMeshCat.
    """
    if not IMAGEIO_SUPPORT:
        import warnings, contextlib
        warnings.warn("Video context cannot be created because imageio is not available.", UserWarning)
        return contextlib.nullcontext()
    if filename is None:
        if directory is None:
            from tempfile import gettempdir
            directory = gettempdir()
        f_fmt = "%Y%m%d_%H%M%S"
        ext = "mp4"
        filename = time.strftime("{}.{}".format(f_fmt, ext))
        filename = osp.join(directory, filename)
    return VideoContext(self, fps, filename)