Spaces:
Running
Running
File size: 2,647 Bytes
5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 13afb0d 5d4dad4 85fd0e1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>動画プレイヤー</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
background-color: #f0f0f0;
font-family: sans-serif;
padding: 20px;
}
video {
max-width: 100%;
height: auto;
margin-bottom: 10px;
}
.controls {
display: flex;
flex-direction: column;
gap: 15px;
width: 100%;
max-width: 500px;
}
.control-group {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
input[type="range"] {
flex: 1;
}
input[type="number"] {
width: 60px;
}
</style>
</head>
<body>
<h1>動画プレイヤー</h1>
<video id="videoPlayer" src="v.mp4" controls></video>
<div class="controls">
<div class="control-group">
<label for="speedRange">再生速度:</label>
<input type="range" id="speedRange" min="0.000001" max="5" step="0.000001" value="1">
<input type="number" id="speedInput" min="0.000001" step="0.0000001" value="1">
</div>
<div class="control-group">
<label for="loopCheckbox">ループ再生:</label>
<input type="checkbox" id="loopCheckbox" checked>
</div>
<button onclick="goFullscreen()">全画面</button>
</div>
<script>
const video = document.getElementById('videoPlayer');
const speedRange = document.getElementById('speedRange');
const speedInput = document.getElementById('speedInput');
const loopCheckbox = document.getElementById('loopCheckbox');
// 初期値設定
video.playbackRate = parseFloat(speedRange.value);
video.loop = loopCheckbox.checked;
// スライダーと数値入力の連携
speedRange.addEventListener('input', () => {
speedInput.value = speedRange.value;
video.playbackRate = parseFloat(speedRange.value);
});
speedInput.addEventListener('input', () => {
let value = parseFloat(speedInput.value);
speedInput.value = value;
speedRange.value = value;
video.playbackRate = value;
});
// ループ切り替え
loopCheckbox.addEventListener('change', () => {
video.loop = loopCheckbox.checked;
});
// 全画面表示
function goFullscreen() {
if (video.requestFullscreen) {
video.requestFullscreen();
} else if (video.webkitRequestFullscreen) {
video.webkitRequestFullscreen();
} else if (video.msRequestFullscreen) {
video.msRequestFullscreen();
}
}
</script>
</body>
</html>
|