I'm trying to embed a video in my thesis using the media9 package and have found that the behaviour of the mediacommand playPause changes depending on whether the embedded file is a swf or mp4 format.

For an SWF file the video is only paused when the mouse-button is held down while for an MP4 file a single mouse-click pauses the video.

Does anyone know why the behaviour is different and what I need to do to get the mp4 behaviour for SWF files?

(I realise that the obvious answer is to convert my SWF file to MP4 however I have spent the better part of 6 hrs trying to do that. Although I can convert the file using ffmpeg, for some reason it doesn't display once embedded even though the example file included with media9 does.)

A MWE showing the difference in behaviour is as follows. Note that I'm using MiKTeX 2.9, pdfTeX and TeXnicCenter all (re)installed a couple of weeks ago.






The above contours.swf file may be accessed at this link.

Any help will be greatly appreciated.

  • Welcome to TeX.sx! You can upload the video to a sharing service (such as dropBox or equivalent) and add the link to your post. This way anyone capable of providing assistance can download it. Commented Mar 3, 2013 at 15:17
  • Indeed FFmpeg, is not able to recode the SWF into MP4. Could you try to produce it in another intermediate file format, say MPEG or uncompressed AVI?
    – AlexG
    Commented Mar 4, 2013 at 11:51

1 Answer 1


The playPause media command can only be executed by VPlayer.swf loaded in the RichMedia Annotation labelled random.

playPause is one of a small number of interface functions (API) implemented in VPlayer.swf (and APlayer.swf, by the way). You may have a look into the sources VPlayer.mxml and APlayer.mxml that ship with media9.

If you wanted to add API functions to contours.swf, you would have to program them in ActionScript, which is the programming language behind Flash, and compile them into contours.swf. Interface functions are added to a Flash application by means of the ExternalInterface.addCallback(...) ActionScript method.

The reason why your swf pauses while pressing the mouse button is that you simply keep AdobeReader busy by this action. You could press the button anywhere on the page with the same effect. You don't really call a dedicated function within your SWF.

BTW, the YouTube Player (see first example in the documentation media9.pdf) provides a completely different set of interface functions (documented here). playPause isn't implemented there either, but playVideo and pauseVideo are, amongst others. Thus, you would have to insert two \mediabuttons for pausing and resuming playback:

    enablejsapi=1    % enables yt player api used in media buttons
]{}{https://www.youtube.com/v/Mdc3o7wOwNA?rel=0}   % online Flash file (YouTube Player)

\mediabutton[mediacommand=yt1:playVideo]{\fbox{\strut Play}}
\mediabutton[mediacommand=yt1:pauseVideo]{\fbox{\strut Pause}

PS: contours.swf doesn't need to be added as a resource, it is already the main Flash application executed by activating the RichMedia Annotation.

How did you create contours.swf? FFmpeg can't decode it.

  • Alex, thanks for your reply, unfortunately I'm now not sure how best to proceed. I created contours.swf using TecPlot360 which is a software package used for visualisation of large scientific computational datasets (e.g. CFD, FEA results)
    – luke
    Commented Mar 4, 2013 at 12:08
  • @luke: Pleased to meet you, I am using CFD myself, don't have experience with TecPlot, though. Can you tell TecPlot to output numbered bitmap sequences instead of SWF? I am pretty sure this should be possible.
    – AlexG
    Commented Mar 4, 2013 at 12:13
  • the available file formats are avi, flv, swf, mpeg-4, raster metafile and wmv. Yesterday I tried exporting to avi and using FFmpeg to convert to mp4 (with libx264 as recommended in the media9 manual) but once embedded the movie would only show a blank page.
    – luke
    Commented Mar 4, 2013 at 12:25
  • @luke. Try FLV. It is supported by the FlashPlayer plug-in and thus by VPlayer.swf. Make sure the file name used in the addresource option is the same as the one used with the source FlashVar.
    – AlexG
    Commented Mar 4, 2013 at 12:29
  • that seems to have worked!! I could have sworn that I tried that yesterday... though, after several hours of stuffing around and googling I was pretty tired and frustrated. Thanks very much.
    – luke
    Commented Mar 4, 2013 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .