summaryrefslogtreecommitdiff
path: root/texmf-dist/source/latex/rmannot/examples/rma/tst_flv_asjs.tex
blob: 650bcb9f541275d1ae2729cdafbb8ad033eddf8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
\documentclass{article}
\usepackage{amsmath}
%
% the driver line is not necessary if you
% have aebpro.cfg configured to your driver.
%
\usepackage[%
%    driver=dvips,
    web={nodirectory,pro,tight,usesf},
    eforms,graphicxsp={showembeds}
]{aeb_pro}
\usepackage{rmannot}

\margins{.25in}{.25in}{24pt}{.25in} % left,right,top, bottom
\screensize{5in}{5.5in}             % height, width

\DeclareDocInfo
{
    title=The \texttt{rmannot} Package\texorpdfstring{\\[1ex]}{: } The Scripting Bridge,
    author=D. P. Story,
    university=Acro\negthinspace\TeX.Net,
    email=dpstory@acrotex.net,
    subject={Demo of the rmannot package, SWF movies},
    keywords={Adobe Acrobat, JavaScript, Adobe FLEX 3, ActionScript},
    talksite=\url{http://www.acrotex.net},
    talkdate={July 2008},
    copyrightStatus=True,
    copyrightNotice={Copyright (C) \the\year, D. P. Story},
    copyrightInfoURL=http://www.acrotex.net
}
\talkdateLabel{Published:}

\def\AcroTeX{Acro\!\TeX}

% Place \AcroVer{11} in rmannot.cfg, or uncomment line below
%\AcroVer{11}
% The argument corresponds to the version of Acrobat you have

%
% Convenience command pointing to the rich media files, this needs
% to be edited to point to its location on your system.
%
\newcommand{\myRMFiles}{C:/Users/Public/Documents/My TeX Files/tex/latex/aeb/aebpro/rmannot/RMfiles}
\saveNamedPath{horse1}{\myRMFiles/horse1.flv}
\makePoster[hiresbb]{aebmovie_poster}{aebmovie_poster}
\makePoster[hiresbb]{horse1_poster}{horse1_poster}



\parindent=0pt\parskip6pt\pagestyle{empty}


\begin{document}

\maketitle

%\previewtrue

When playing a FLV movie or a MP3 music clip, you can use Acrobat
form buttons to control the media clip through the scripting bridge
that connects Acrobat JavaScript to Flash ActionScript. Acrobat uses
two SWF files that play FLV and MP3, these are
\texttt{VideoPlayer.swf} and \texttt{AudioPlayer.swf}.  You can
communicate with these two SWF using the \texttt{callAS} method of
the \texttt{AnnotRichMedia} object, as documented in the
\textsl{JavaScript for Acrobat API Reference} guide.

The \texttt{callAS} method passes function names have been exposed
(to external use) using the \texttt{ExternalInterface.addCallback}
in ActionScript. These exposed methods are
\texttt{multimedia\_play}, \texttt{multimedia\_pause},
\texttt{multimedia\_rewind}, \texttt{multimedia\_seek},
\texttt{multimedia\_nextCuePoint},
\texttt{multimedia\_prevCuePoint}, \texttt{multimedia\_volume}, and \texttt{multimedia\_mute}.

In this demo file, we illustrate the use of
\texttt{multimedia\_play}, \texttt{multimedia\_pause}, and \texttt{multimedia\_rewind}.

Basically, the technique is first to get the AnnotRichMedia object of the target annotation
using either \texttt{Doc.getAnnotsRichMedia()} or \texttt{Doc.getAnnotRichMedia()} methods.
\begin{verbatim}
    var rm = this.getAnnotsRichMedia(this.pageNum)[0];
\end{verbatim}
Here we get the first rich media annotation on the current page.
If we want to play the media, we might do something like this
\begin{verbatim}
    if ( rm ) {
        if (!rm.activated) rm.activated=true;
        rm.callAS("multimedia_play");
    }
\end{verbatim}
If we want to play the media, we might do something like this


\begin{center}
\resizebox{2in}{!}
    {\rmAnnot[poster=aebmovie_poster]{640bp}{480bp}{horse1}}\\[1ex]
    \scriptsize
    \pushButton[\CA{Play}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_play");\r
        }
    }}]{horse1Play}{}{9bp}%
    \pushButton[\CA{Pause}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_pause");\r
        }
    }}]{horse1Pause}{}{9bp}%
    \pushButton[\CA{Rewind}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_rewind");\r
        }
    }}]{horse1Rewind}{}{9bp}
\end{center}
The above video has play, pause, and rewind buttons that use the
scripting bridge to communicate with the underlying
\texttt{VideoPlayer.swf}.\footnote{Video downloaded from
youtube.com.}
 These techniques are for FLV and MP3 files only.
A SWF file would not obey \texttt{multimedia\_play} method, for example.

\end{document}