# Mouse Control of 360 Video in Beamer?

I am making a mesh of Games of Thrones video for 360 video, motivated by Zuckerberg's video today about GoT where you can move mouse 360 in the beginning, in Matlab. I am thinking where to show the output. I can generate any format from the code but not sure if the user interaction can be hold in any beamer's output formats, as I can understand in the discussion here about Beamer and JavaScript in a web browser.

I would like to embed such a 360 mouse control in my beamer presentation, stub here, for instance, in any format. HTML is sufficient and can be done with Beamer (here). There may be some elements missing in Beamer which does not allow the user interaction. In such a case, I would like to understand what.

Example of Mark's 360 GoT video

Pseudocode

%% Sources
% https://tex.stackexchange.com/q/98446/13173 for 2D animation
\documentclass{article}

\usepackage{pgfplots}
\usetikzlibrary{ocgx}
\tikzset{ocg button/.style={circle,inner sep=.25em,switch ocg with mark on={#1}{}}}
\tikzset{base/.style={baseline=-0.5ex}}

\newcommand{\function}{x ...}
\newcommand{\buttonUp}[2]{\tikz[base]\node[fill=#2!30,ocg button=#1]{};}
\newcommand{\buttonDown}[2]{\tikz[base]\node[fill=#2!30,ocg button=#2]{};}
\newcommand{\buttonLeft}[2]{\tikz[base]\node[fill=#2!30,ocg button=#3]{};}
\newcommand{\buttonRight}[2]{\tikz[base]\node[fill=#2!30,ocg button=#4]{};}

\begin{document}
\begin{minipage}[b][0.5\textheight][c]{0.2\textwidth}
...
\end{minipage}%

\end{document}


## Planning Document

• Is Flash Flex sufficient?
• I like Java API. How well does Java Flex compare to it?
• Blender. [JohannesB]

## 2D Mesh and viewer on .tex Document

• Data. Panorama.
• Package. animate.
• Stepping by 1°. This would require only 180 frames, keeping PDF size small.

## 3D Mesh and Viewer on .tex Document

• Data. 3D Panorama. I think this can be only a picture. How to get/make such a data?
• Package. animate.
• Stepping by 10°. This would require only 36x18=648 frames, not expanding PDF size.

Thread about making the datatype here in Stackoverflow. [AlexG] The azimuth has a range of 0° to 360° while elevation ranges from -90° to +90° for a sphere and from 0° to +90° for the northern hemisphere. With 10° stepping in both coordinates this makes 36x18 for the whole sphere and 36x9 for the hemisphere. ASCII example of equispaced font where 9 (=18/2) panorama pictures of the hemisphere on top of each other for each angle; everything can be in one picture

1 2 3 4 ... 34 35 36
___2D-panorama #1__ 1
___2D-panorama #2__ 2
________etc________ 3
___________________ 4
___________________ ...
___________________ 8
___2D-panorama_ #9_ 9


• stepping angle
• projection algorithm without loosing data
• .png lossless compression

How can you have mouse control of video element in Beamer?

• Honestly, as far as i am cocerned, this question could might as well be asking how to dig holes in your garden with an unplugged electrical chainsaw. Apart from the fact, that you could use the blade for shoveling, or attach some small spade using cable binders, using a real shovel seems to be the sane approach here. – Johannes_B Apr 24 '16 at 12:49
• As i said, i think using a pdf with flash is the wrong approach. A penguin is a good swimmer and you can mount wings on it and make it fly but ... the result might not be satisfactory. – Johannes_B Apr 24 '16 at 13:52
• Perhaps it would be more constructive to ask @Johannes_B where shovels are to be had or which kind of shovel would be best for hole-digging in the relevant type of garden soil? – cfr May 17 '16 at 13:59
• If i have understand it correctly, TeX (and so LaTeX) are (mainly) for typesetting static text, the pdf format allows stuff like Flash thingies to be included in pdf. In my point of view, that does not mean that LaTeX (just because it can generate a pdf) is also the tool to generate something flashy interactive like a video. – Johannes_B May 17 '16 at 16:03
• I would certainly have a look at Blender though, those guys from the Blender community can do miracles – Johannes_B May 17 '16 at 16:03

A simple panorama viewer for panoramic images with a fixed z-axis can be built using the animate package. (AR required.)

The example uses a 360° image downloaded here.

Clicking the buttons changes the view by 10°, [shift]+click by 1°.

\documentclass{standalone}
\usepackage{animate}
\usepackage{media9}
\usepackage{MnSymbol}
\usepackage{graphicx}
\usepackage{xsavebox}

\begin{document}
\xsavebox{PanoramaImg}{\includegraphics[width=\linewidth]{potw1130a}}%
\xsavebox{PanoramaImg}{\thePanoramaImg\thePanoramaImg}%
\raisebox{-0.5\height}{\mediabutton[
jsaction={
if(event.shift) frm--;
else frm-=10;
if(frm<0) frm+=360;
}
]{\Huge$\triangleleft$}}%
\raisebox{-0.5\height}{%
\begin{animateinline}[label=myPanorama,step,nomouse]{1}
\multiframe{360}{dStep=0pt+\dimexpr\linewidth/360\relax}{
\makebox[1.78\height][l]{\hspace{-\dStep}\makebox[0pt][l]{\thePanoramaImg}}
}
\end{animateinline}%
}%
\raisebox{-0.5\height}{\mediabutton[
jsaction={
]{\Huge$\triangleright$}}%

• @Masi : The next problematic step would be the projection of the spherical data onto the rectangular viewport. This is beyond animate, I am afraid. For animate, you need a fixed set of pre-fabricated frames to choose from (with the arrow keys). – AlexG May 18 '16 at 10:24
• @Masi: For example: If you restrict yourself to one hemisphere and you want to be able to freely step by 1° in azimuthal and in polar directions each. With animate this would require a total of 360x180=64800 pre-built frames, since we cannot do projection on the fly. – AlexG May 18 '16 at 10:44