
こんにちは。ビデオ時間を正確なポイントに設定するボタンを取得しようとしています。以下にリストされているコードは、これまで作成したものですが、機能しません。document.getElementById を取得できないためだと思います。これを解決する方法をご存知の方はいませんか?
\documentclass{article}
\usepackage[pdftex]{hyperref}
\usepackage[pdftex]{insdljs}
\usepackage{media9}
\begin{insDLJS}{mydljs}{some comment}
function stop(){
var vid = document.getElementById("bunny.mp4");
vid.currentTime=5;
}
\end{insDLJS}
\begin{document}
\includemedia[width=0.6\linewidth,height=0.6\linewidth,activate=pageopen,
passcontext,
transparent,
addresource=bunny.mp4,
flashvars={source=bunny.mp4}
]{}{VPlayer.swf}
\begin{Form}
\PushButton[onclick={stop();}]{5 sec}\\
\TextField[name=somefield, width=4em]{Any way to hide e.g. this text?}
\end{Form}
\end{document}ode here
答え1
JavaScriptはない必須。
追加のコントロールボタンはコマンドで挿入できます\mediabutton
。media9
マニュアルたとえば。
ビデオを十分に正確にシークできない場合は、より多くのキー フレームを使用してビデオを再エンコードする必要がある場合があります。
たとえば、ffmpeg
オプション-g ...
と-r ...
(フレーム レート) が同じ値を持つ場合、1 秒ごとにキー フレームが生成されます。
ffmpeg -i video-in.mp4 -c:v libx264 -profile:v high -pix_fmt yuv420p -g 30 -r 30 video-out.mp4
アップデート: Overleafの例example-movie.mp4
パッケージから埋め込まれたビデオファイル付きmwe
上記のコマンドラインを使用して、1 秒ごとにキーフレームで再エンコードされます。
ストリーミングビデオの例:
\documentclass{article}
\usepackage{media9}
\parindent=0pt
\begin{document}
\includemedia[
label=videoexample,
width=16em,height=9em,
activate=pageopen,
passcontext,
transparent,
flashvars={source=https://ia800501.us.archive.org/10/items/BigBuckBunny_310/big_buck_bunny_640_512kb.mp4}
]{}{VPlayer.swf}
\mediabutton[
mediacommand=videoexample:play[(25)],
mediacommand=videoexample:pause
]{\fbox{25~s}}
\mediabutton[
mediacommand=videoexample:play[(50)],
mediacommand=videoexample:pause
]{\fbox{50~s}}
\mediabutton[
mediacommand=videoexample:play[(150)],
mediacommand=videoexample:pause
]{\fbox{150~s}}
\end{document}