How to Add Video to Impress with Python

I want to write a python macro that adds videos to LibreOffice Impress. So far, I have been able to add images with python, but the script does not work for video files. A demo of my working image script is shown below.

import uno
from com.sun.star.awt import Size
from com.sun.star.awt import Point

def add_page():
    """
    Create a slide for each of the items in folder
    """
    document = XSCRIPTCONTEXT.getDocument()
    MAX_X = 28000
    MAX_Y = 15750
    page = document.DrawPages.getByIndex(0)
    page.Layout = -1

    path = '/home/doakey/Desktop/image.png'
    graphic = document.createInstance('com.sun.star.drawing.GraphicObjectShape')
    graphic.GraphicURL = "file://" + path
    graphic.setSize(Size(MAX_X, MAX_Y))
    graphic.setPosition(Point(0, 0))

    page.add(graphic)

I got it. It’s very similar to adding an image:

import uno
from com.sun.star.awt import Size
from com.sun.star.awt import Point

def add_pages():
    """
    Create a slide for each of the items in folder
    """
    document = XSCRIPTCONTEXT.getDocument()
    MAX_X = 28000
    MAX_Y = 15750
    page = document.DrawPages.getByIndex(0)
    page.Layout = -1

    path = '/home/doakey/Desktop/movie.mp4'

    media = document.createInstance('com.sun.star.drawing.MediaShape')
    media.MediaURL = "file://" + path
    media.setSize(Size(MAX_X, MAX_Y))
    media.setPosition(Point(0, 0))

    page.add(media)