I wanted to share a neat trick that I found to be working great for OpenOffice Impress presentations. I’m using the Presenter Console under Ubuntu, i.e. two screens, and wanted to show on mouse click videos at full screen resolution (on the video beamer screen, of course). In addition to that, I wanted to include videos with a relative path, i.e., relative with respect to the presentation (.odp) file. I finally managed to do this by writing a generic makro which calls a bash script that runs mplayer. For each video file in the presentation, I added an additional one-liner makro with the video path. Then, in the presentation, I would insert an image (e.g., sample frame of the video, but this can also be anything else, text, buttons etc.) and add a makro action (right click on the object or image -> interaction -> action at mous click = run macro) which would correspond to the makro containing the (relative) path to the video I would like it to play.
Now, here is the BASIC code for the makros:
Sub RunVideo(videoName as String) 'get the path of the document dim odoc as object odoc = thiscomponent sURL = odoc.url i = Len(sURL) do while Mid(sURL, i, 1)<>"/" i = i - 1 loop thePath = Left(sURL, i) 'cut "file://" from the path thePath = Right(thePath, Len(thePath) - 7) 'create the command + params that we need cmd = thePath + "videos/play.sh" params = thePath + "videos/" + videoName 'msgbox cmd + " " + params Shell(cmd, 2, params) End Sub Sub DemoVideo RunVideo("demo.avi") End Sub
In the makro RunVideo, I get the path name of the current .odp file and combine it with the relative video path (I always add the subdirectory video/ assuming that all videos are in this directory beneath the current .odp presentation file). I finally call the bash script play.sh with the absolute path to the video file.
The bash script (assumed to be located at videos/play.sh) to call mplayer looks like this:
#!/bin/bash mplayer -xineramascreen 0 -fs -zoom $1
The option -xineramascreen 0 displays the video on the correct screen. I ran into some troubles when my externel display resolution was too high. So in case mplayer does not play the video right, try to set down the resolution (to, e.g., 800×600). If the video comes on the wrong screen, just change the 0 to 1 and try again.
Hope that helps somebody else, as well !
© 2018 Alex' Homepage | Theme by Eleven Themes