\documentclass{book}
\begin{document}

This is my simulation

\ifdefined\HCode
\HCode{
     <video width='320' preload = 'none' poster='random_walk_3d.png' controls >
     <source src='random_walk_3d.webm' type='video/webm'/> 
     <source src='random_walk_3d.ogg' type='video/ogg'/> 
     <source src='random_walk_3d.mp4' type='video/mp4'/>  
    Your browser does not support the video tag.
</video>
}
\fi 


\end{document}