I need to play a movie in another page (page2.html) by clicking on a button in page1.html.
On a main page I have multiple buttons which runs movies on separate pages. I need to connect those buttons with the appropriate movie ID.
Could you give me some advice on how to do that?
JS
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused) {
myVideo.play();
} else {
myVideo.pause();
}
}
page1.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Eagle+Lake" rel="stylesheet">
<link rel="Stylesheet" type="text/css" href="view.css" />
<script type="text/javascript" scr="video_play.js"></script>
</head>
<body>
<center>
<button onclick="playPause()">Play/Pause</button>
</center>
</body>
</html>
page2.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Eagle+Lake" rel="stylesheet">
<link rel="Stylesheet" type="text/css" href="view.css" />
<script type="text/javascript" scr="video_play.js"></script>
</head>
<body>
<div style="text-align:center">
<br><br>
<video id="video1" width="420">
<source src="/Applications/XAMPP/xamppfiles/htdocs/filmy/xxx.mp4" type="video/mp4">
</video>
</div>
</body>
</html>
CSS
body {
font-family: 'Eagle Lake', cursive;
}
input {
width: 40px;
text-align: center;
}
video {
position: fixed; right: 0; bottom: 0;
min-width: 100%; min-height: 100%;
width: auto; height: auto; z-index: -100;
background-size: cover;
}