私はそれを数日間動作させようとしました、それを行う方法を再調査して何度もそれを変更しましたが、それはうまくいきません。私は愚かまたは盲目のどちらかです。簡単なビデオプレーヤーをコーディングしたい...初心者にとっては簡単だと思ったT_T
これはhtmlファイルです:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<script language="JavaScript" src="player.js"></script>
</head>
<body onkeydown="GetKey()" onload="VideoList()">
<div style="text-align:center">
<img src="images/Magipoka.jpg" onclick="window.location='Magipoka.html'">
<img src="images/puni.jpg" onclick="window.location='puni.html'">
<br>
<video id="currentVideo" autoplay="true" preload="auto" onended="Playnext()"
onclick="goFullscreen('currentVideo'); return false" ;="">
<source src="Magipoka.mp4" type="video/mp4">
<source src="Magipoka.ogv" type="video/ogv">
Your browser does not support HTML5 video.
</video>
</div>
<div style="text-align:center">
<button onclick="LoopToggle()">Loop</button>
<button onclick="LoopToggleOff()">LoopOff</button>
<button onclick="playPause()">Play/Pause</button>
</div>
<script language="JavaScript" src="Body_Scripts.js"></script>
</body>
</html>
body jsファイル:
var Video=document.getElementById("currentVideo");
var VideoCount = 0;
var source = new Array();
function VideoList(){
source[0].src = "Magipoka.ogv";
source[1].src = "puni.ogv";
}
function playPause()
{
if (Video.paused)
Video.play();
else
Video.pause();
}
function LoopToggle(){
if (Video.ended)
Video.play();
if(Video.loop="false")
video.loop=true;
else
video.loop=null;
}
function Repeat(){
if(Video.ended)
Video.paused();
Video.play();
}
function Playnext(){
Video.src = source[VideoCount];
//alert(VideoCount);
VideoCount++;
alert(source[1]);
}
ヘッダーjsファイル:
function goFullscreen(id) {
// Get the element that we want to take into fullscreen mode
var element = document.getElementById(id);
// These function will not exist in the browsers that don't support fullscreen mode yet,
// so we'll have to check to see if they're available before calling them.
if (element.mozRequestFullScreen) {
// This is how to go into fullscren mode in Firefox
// Note the "moz" prefix, which is short for Mozilla.
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
// This is how to go into fullscreen mode in Chrome and Safari
// Both of those browsers are based on the Webkit project, hence the same prefix.
element.webkitRequestFullScreen();
}
// Hooray, now we're in fullscreen mode!
}
//-----------------
function GetKey(e) { var code; if (!e) var e = window.event; if (e.keyCode)
code = e.keyCode; else if (e.which) code = e.which; var character =
String.fromCharCode(code); setTimeout('ShowTree('+code+');',100);
}
function ShowTree(character, a){
if (character == 49){
window.location='puni.html' }
if (character == 50){
window.location='magiPoka.html' }
}