summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/media4svg/example/beamer-example.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/media4svg/example/beamer-example.tex')
-rw-r--r--macros/latex/contrib/media4svg/example/beamer-example.tex99
1 files changed, 73 insertions, 26 deletions
diff --git a/macros/latex/contrib/media4svg/example/beamer-example.tex b/macros/latex/contrib/media4svg/example/beamer-example.tex
index d356dfcf53..e5e3b99eda 100644
--- a/macros/latex/contrib/media4svg/example/beamer-example.tex
+++ b/macros/latex/contrib/media4svg/example/beamer-example.tex
@@ -1,5 +1,15 @@
\documentclass[dvisvgm,hypertex,aspectratio=169]{beamer}
+\usetheme{default}
+\makeatletter
+\defbeamertemplate*{frametitle}{mydefault}{%
+ \nointerlineskip\vspace{1ex}{\usebeamerfont{frametitle}\insertframetitle}%
+ \ifx\insertframesubtitle\@empty\else{\usebeamerfont{framesubtitle}\\\insertframesubtitle}\fi%
+ \vspace{-0.8ex}%
+}
+\makeatother
+\setbeamersize{text margin left=0.0333\paperheight,text margin right=0.0333\paperheight}
+
\usefonttheme{serif}
\usepackage[british]{babel}
@@ -7,8 +17,8 @@
\usepackage{menukeys,siunitx,calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% PageDown, PageUp key event handling; navigation symbols <--, -->,
-% mouse cursor autohide on idle
+% slide navigation via keyboard and mouse click/mouse wheel, mouse cursor
+% autohide on idle; navigation symbols <--, -->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[totpages]{zref}
\usepackage{fontawesome5}
@@ -20,28 +30,56 @@
<defs>%
<script type="text/javascript">%
<![CDATA[%
- var svgRoot=document.getElementsByTagName('svg')[0];%
var cursorTimer;%
+ var downOnLink=false;%
+ var downOnRoot=false;%
+ function islink(tg){return (tg.tagName=='a') ? true : tg.parentNode ? islink(tg.parentNode) : false;};%
document.addEventListener('mousemove', function(e){%
- e.preventDefault();e.stopPropagation();%
- svgRoot.style.cursor='initial';%
- if(e.target!=svgRoot){%
- e.target.style.cursor='inherit';%
- }%
- try{clearTimeout(cursorTimer);}catch(err){};%
- cursorTimer=setTimeout(function(){e.target.style.cursor='none';},3000);%
+ if(islink(e.target)||e.target.getAttribute('class')=='annot'||e.target.tagName=='video'){%
+ e.target.style.cursor='pointer';}else{e.target.style.cursor='default';}%
+ try{clearTimeout(cursorTimer);}catch(err){};%
+ cursorTimer=setTimeout(function(){e.target.style.cursor='none';},3000);%
+ });%
+ document.addEventListener('mousedown', function(e){%
+ if(islink(e.target)) downOnLink=true;%
+ else downOnRoot=true;%
+ });%
+ document.addEventListener('mouseup', function(e){%
+ if(downOnLink||!downOnRoot){downOnLink=false;return;}%
+ downOnRoot=false;%
+ \ifnum\thepage<\ztotpages
+ if(!e.shiftKey) document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage+1\relax}.svg');%
+ \fi%
+ \ifnum\thepage>1
+ if(e.shiftKey) document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage-1\relax}.svg');%
+ \fi%
+ });%
+ document.addEventListener('wheel', function(e){%
+ \ifnum\thepage<\ztotpages
+ if(e.deltaY>0){%
+ document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage+1\relax}.svg');%
+ }%
+ \fi%
+ \ifnum\thepage>1
+ if(e.deltaY<0){%
+ document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage-1\relax}.svg');%
+ }%
+ \fi%
});%
document.addEventListener('keydown',function(e){%
- if(e.key=='PageDown'||e.key=='ArrowDown'||e.key=='ArrowRight'){%
\ifnum\thepage<\ztotpages
- document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage+1\relax}.svg');%
+ if(e.key=='PageDown'||e.key=='ArrowDown'||e.key=='ArrowRight')%
+ document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage+1\relax}.svg');%
\fi%
- }else if(e.key=='PageUp'||e.key=='ArrowUp'||e.key=='ArrowLeft'){%
\ifnum\thepage>1
- document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage-1\relax}.svg');%
+ if(e.key=='PageUp'||e.key=='ArrowUp'||e.key=='ArrowLeft')%
+ document.location.replace('\jobname-\zeroPad{\ztotpages}{\the\numexpr\thepage-1\relax}.svg');%
\fi%
- }%
- });%
+ if(e.key=='Home')
+ document.location.replace('\jobname-\zeroPad{\ztotpages}{1}.svg');%
+ if(e.key=='End')
+ document.location.replace('\jobname-\ztotpages.svg');%
+ });%
]]>%
</script>%
</defs>%
@@ -65,7 +103,7 @@
}%
}%
% helper macro \zeroPad : zero-pads integer according to template,
-% e. g. 123 --> 00123 if template is `99999`
+% e. g. 123 --> 00123 if template is `99999`
% #1: arbitrary integer number as template specifying the
% width, e. g. `987654' for a width of 6 digits
% #2: the number to be formatted
@@ -98,7 +136,7 @@
\begin{frame}[fragile]
\titlepage\footnotesize
\makebox[0.3\linewidth]{\hrulefill}\\[1ex]
-Navigate with \keys{PageUp} \& \keys{PageDn}, toggle Full-Screen with \keys{F11}.\\[2ex]
+Toggle Full-Screen with \keys{F11}, navigate with \keys{PageUp} \& \keys{PageDn}, mouse click or mouse wheel.\\[2ex]
To build this presentation from the source, run:\vspace{-2ex}
\begin{verbatim}
dvilualatex beamer-example
@@ -109,7 +147,7 @@ dvisvgm --bbox=papersize --font-format=woff2 --zoom=-1 --page=- --linkmark=none
\end{frame}
\begin{frame}[fragile]{Video file}
- Embedded local video file from package \emph{mwe}
+embedded local video file from package \emph{mwe}
\begin{verbatim}
\includemedia[width=24em,height=13.5em]{}{example-movie.mp4}
\end{verbatim}
@@ -119,18 +157,27 @@ dvisvgm --bbox=papersize --font-format=woff2 --zoom=-1 --page=- --linkmark=none
\end{frame}
\begin{frame}[fragile]{Remote video}
- Video streamed from URL
+video streamed from URL and YouTube player with two videos played in a loop
\begin{verbatim}
-\includemedia[width=24em,height=13.5em,url]{}{%
-https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm}
+\includemedia[width=16em,height=9em,url,controls]{}{%
+ https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm}
\end{verbatim}
- \begin{center}
- \includemedia[width=24em,height=13.5em,url]{}{https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm}
- \end{center}
+\begin{verbatim}
+\includemedia[width=16em,height=9em,youtube,controls,loop,
+ autoplay,muted]{}{OSPyXTjIrnk,9HQfauGJaTs}
+\end{verbatim}
+\vspace{1ex}
+\begin{columns}[onlytextwidth,b]
+ \begin{column}{0.49\linewidth}
+ \includemedia[width=16em,height=9em,url,controls]{}{https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm}
+ \end{column}
+ \begin{column}{0.49\linewidth}
+ \includemedia[width=16em,height=9em,youtube,controls,loop,autoplay,muted]{}{OSPyXTjIrnk,9HQfauGJaTs}
+ \end{column}
+\end{columns}
\end{frame}
\begin{frame}[fragile]{Player control}
-
The standard player controls (option `\verb+controls+') take a lot of space of the media display. Therefore, it is not recommended to enable them. Nevertheless, interactivity is still provided through touch or left mouse button click, and through the keyboard as summarized in the table.
Click on the media display to start playback. To pause playback, press the left mouse button on the media display. Release it to resume playback. To pause playback permanently, press the left mouse button on the media display and move the mouse out while keeping the button pressed.