I am using the following JavaScript / html to play in a video in Chrome.
The console logs "Uncaught SyntaxError: Unexpected end of input".
I don't see what I'm doing wrong. What is my mistake here?
Thank you!
<html>
<head><meta name="viewport">
<style>
video
{
position: relative;
}
</style>
</head>
<body>
<video ontouchstart="playPause()" controls="controls" poster="" video width="100%" height="auto" autoplay id="vid">
<source id="somefileID" src="file:///d:/dev/videos/Das%20Krokodil-Lied.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
</video>
<script>
function playPause(e)
{
if (!document.getElementById("myVideo"))
{
alert("Element does not exist. Let's create it.");
}
var myVideo = document.getElementById("vid");
if (myVideo = null)
{
alert('video is null!');
}
else
{
if (myVideo.paused)
{
myVideo.play();
}
else
{
myVideo.pause();
}
}
</script>
</body>
</html>