更改 pdfpc 中电影的默认选项

更改 pdfpc 中电影的默认选项

正如你们有些人所知道的pdfpc可让您将电影嵌入到 Beamer Latex 中。电影的默认选项是“自动启动”和“循环播放”。

% Package: textpos is required for textblock*
\usepackage[absolute,overlay]{textpos}
% fullFrameMovie
%
% Arguments:
%
%   [optional]: movie-options, seperated by &
%       Supported options: loop, start=N, end=N, autostart
%   Default: autostart&loop
%
%   1. Movie file
%   2. Poster image
%   3. Any text on the slide, or nothing (e.g. {})
%
% Example:
%   \fullFrameMovie[loop&autostart]{apollo17.avi}{apollo17.jpg}{\copyrightText{Apollo 17, NASA}}
%
\newcommand{\fullFrameMovie}[4][autostart&loop]
{
    {
        \setbeamercolor{background canvas}{bg=black}


        % to make this work for both horizontally filled and vertically filled images, we create an absolutely
        % positioned textblock* that we force to be the width of the slide.
        % we then place it at (0,0), and then create a box inside of it to ensure that it's always 95% of the vertical
        % height of the frame.  Once we have created an absolutely positioned and sized box, it doesn't matter what
        % goes inside -- it will always be vertically and horizontally centered
        \frame[plain]
        {
            \begin{textblock*}{\paperwidth}(0\paperwidth,0\paperheight)
            \centering
            \vbox to 0.95\paperheight {
                \vfil{
                    \href{run:#2?autostart&#1}{\includegraphics[width=\paperwidth,height=0.95\paperheight,keepaspectratio]{#3}}
                }
                \vfil
            }
            \end{textblock*}
            #4
        }
    }
}

我该如何更改此代码以删除自动启动和循环选项,以便我只需单击一下即可播放电影,并在电影结束后再次单击播放?该代码来自 zip 文件中的 sty 文件这里

附言:我找不到一封电子邮件来联系 pdfpc 的开发人员,这就是我在这里发布问题的原因。

答案1

我认为最好的办法是摆脱 sty 文件并将重要命令放入 tex 文件中。

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{} % don't use navigation tools
\usepackage[absolute,overlay]{textpos} %needed for textblock
\usepackage{hyperref}

\begin{document}
{
\setbeamercolor{background canvas}{bg=black}
\begin{frame}[plain] 
  \begin{textblock*}{\paperwidth}(0\paperwidth,0\paperheight)
  \centering
  \vbox to 0.95\paperheight {
    \vfil{
    % Next command is the minimum needed. Everything else is just to keep it in the correct position.
    \href{run:apollo17.avi}{\includegraphics[width=\paperwidth,height=0.95\paperheight,keepaspectratio]{apollo17.jpg}} 
         }
  \vfil  }  
  \end{textblock*}
\end{frame}
}  

\end{document}

只要您单击电影,它就会开始播放。

答案2

看来给定的pdfpc-commands.sty文件不符合其规范。第 35 行内容为:

\href{run:#2?autostart&#1}{\includegraphics[width=\paperwidth,height=0.95\paperheight,keepaspectratio]{#3}}

应该:

\href{run:#2?#1}{\includegraphics[width=\paperwidth,height=0.95\paperheight,keepaspectratio]{#3}}

(删除autostart&)。

这样,您默认会获得自动启动和循环行为(无选项),如果使用空选项字段(),则会获得点击行为[],如下所示:

\fullFrameMovie[]{apollo17.avi}{apollo17.jpg}{\copyrightText{Apollo 17, NASA}}

相关内容