How to start/stop movie from macro?

LibO’s support for video is mediocre but it still seems to be the least-bad option for presentations on Linux with movies embedded. However I would really like to be able to control playback of an embedded (ok, technically ‘linked’) movie during the presentation. Ideally this would include things like seeking to different times but for starters it would be nice to just be able to play, pause, and stop. Right now the closest I can get is by adding custom animation actions (a la this answer). But this is not so great because you can’t play/pause an indeterminate amount of times; at best you can put in a lot of “toggle pause” actions and hope they are enough at presentation time. But then when you want to go to the next slide you need to hit Alt+PgDn instead of just clicking, fine if you are at the keyboard but if you are using a presentation remote, probably not possible…

So it seems that it should be possible to create a macro and have it run when a shape on the same slide as the video is clicked. I can figure out how to get a handle to the actual video object but I can’t see how I would actually do anything (play/pause/seek/stop) with this object in hand. I’ve looked at OOME but Impress video files don’t seem to be covered. Looking at the video object in the variable inspector in LibO’s IDE didn’t reveal anything useful either.

Here’s the code I have that finds the video object based on its name (‘video’). How do I make the video start from the macro?

function PlayVideo

dim oPages
opages = ThisComponent.getDrawPages()

dim thispage
thispage = oPages.getByIndex(1)

dim i
dim oShape
for i = 0 to thispage.getCount()
	oShape = thispage.getByIndex(i)
	if oShape.Name = "video" then
		' here is where I don't know what to do!
		exit function
	end if
next

msgbox("video element not found")

end function

Hi @PatrickBouffard,

Still looking for an answer here? I seem that you’ve looked at Pitonyak’s materials – I know those can be quite helpful!