1

I wish to embed audio files in PDFs produced by XeTeX so that the user can click on a graphic (different for each recording) and hear the audio file. And I want the resulting PDFs to work in as many PDF viewers on as many OSes as possible. Also, I'd like the triggering graphic to remain visible during and after playback.

So far, I've tried the following:

  • beamer's multimedia package: Doesn't work with XeTeX.
  • attachfile and attachfile2: Don't permit playback.
  • movie15: Was superseded by media9 5+ ago.
  • media9:
    • Audio in PDFs it produces doesn't work on any Linux PDF readers.
    • Doesn't work on modern Acrobat Reader versions (XI and later) without installing Flash plugin (and Flash is scheduled to be discontinued, to boot).
    • The files it produces can't even be loaded by Sumatra PDF Reader.
    • Foxit reader can play the audio, but it doesn't show the trigger images ever again (these are large pictures, unique to each audio file, and not a speaker or playback icon).

So in short, only one of these options even works partially, and it doesn't do so on Linux, on modern versions of Acrobat on Windows, or on many other Windows PDF viewers. Plus, it depends on a technology (Flash) that is slated to be discontinued in 2 1/2 years anyway.

What other options exist?

Here's an MWE:

\documentclass{book}

\usepackage[
    xetex,
    activate=onclick,
]{media9}

\begin{document}
    \includemedia[
        width=1\linewidth,
        addresource=test.mp3,
        flashvars={source=test.mp3 & autoPlay=false},
    ]{\includegraphics[height=15cm]{test.png}}{APlayer.swf}
\end{document}

closed as primarily opinion-based by user36296, Mico, Stefan Pinnow, CarLaTeX, TeXnician Oct 23 '17 at 11:54

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I should add that the media9 PDFs crash both Acrobat Reader 11 and Acrobat Reader DC with Flash Player installed, after listening to any given audio file more than two or three times. – Gil Williams Oct 9 '17 at 6:07
  • Did you test also with pdflatex and lualatex as engine? And what is the format of the audio files? Can you provide an example and example code? – Ulrike Fischer Oct 9 '17 at 7:38
  • @UlrikeFischer I need to use XeTeX. pdfLatex isn't viable because I need to use several hundred UTF-8 symbols with great frequency, and the backslash codes are illegible in such situations. And LuaLaTeX cannot properly typeset several of the most common diacritics I need. – Gil Williams Oct 9 '17 at 7:58
  • 1
    The error is that \includegraphics is not defined. Didn't you test your example? Beside this: on windows I don't have problems with the examples in the documentation in the adobe reader. But the documentation is quite clear about the problems with the pdf viewers on linux -- and if the viewer don't support this, there is not much a package can do. You could only try the simple ` \href{run:test.mp3}{text displayed}` approach. – Ulrike Fischer Oct 9 '17 at 10:42
  • 1
    That's not really a tex question. Imho the main question is if pdf is really the best format for what ever you want to achieve. – Ulrike Fischer Oct 9 '17 at 12:07