| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/course_demo/view/ |
Upload File : |
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'inc/headlinks.php'; ?>
</head>
<body class="bodyBg">
<section class="body">
<div class="titleWrap p-3 mb-1 boxshadow">
<p class="h1 mb-0">課程A-問題1</p>
</div>
<div class="wrap boxshadow">
<div class="paperWrap">
<div class="videoWrap">
<video width="100%" class="video" height="100%" playsinline style="pointer-events: none;"
poster="../assets/images/video_poster.jpg">
<source src="../assets/video/ques-01.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
Your browser does not support the video tag.
</video>
<div class="progress">
<span class="timeline"></span>
</div>
</div>
<div class="videoControl question">
<div>
<button class="videoBtn btn"><i class="fas fa-play-circle"></i> 播放</button>
<button class="replayBtn btn hide"><i class="fas fa-undo"></i> 重播</button>
</div>
<p class="small"><span class="text-danger">*</span>請先看完影片,再作答題目!</p>
</div>
<div class="questionContent">
<div class="questionWrap">
<p class="mb-4">下列那個不是正確使用梯具?</p>
<div class="form-check">
<input class="form-check-input" type="radio" name="question1" id="q1" value="1">
<label class="form-check-label" for="q1">
使用清潔梯具
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="question1" id="q2" value="2">
<label class="form-check-label" for="q2">
使用乾爽梯具
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="question1" id="q3" value="3">
<label class="form-check-label" for="q3">
未乾酒漆梯具
</label>
</div>
</div>
<div class="btnControl question">
<div class="text-danger"><span class="errMessage"></span></div>
<button class="btn btn-primary btn-lg submitBtn">
下一題</button>
</div>
</div>
</div>
</div>
</section>
</body>
<script>
var video = $(".video")[0]; // get the video element
var toggleBtn = $(".videoBtn"); // get the toggle button element
var isPlaying = false; // initialize the playing state to false
var timeline = $(".timeline");
$(function() {
$(video).on("timeupdate", function() {
var percentage = (video.currentTime / video.duration) * 100;
timeline.width(percentage + "%");
});
$(video).on('ended', function() {
isPlaying = false;
toggleBtn.html(`<i class="fas fa-play-circle"></i> 播放`);
console.log('The video has ended.');
$(".questionContent").fadeIn();
$(".replayBtn").removeClass("hide");
// Call a function or execute code here
});
});
$(video).on("timeupdate", function() {
var percentage = (video.currentTime / video.duration) * 100;
timeline.width(percentage + "%");
});
$(".submitBtn").click(function() {
var selectedValue = $('input[name=question1]:checked').val();
console.log(selectedValue);
if (selectedValue == undefined) {
$(".errMessage").show().text("**請作答題目");
} else if (selectedValue != 3) {
$(".errMessage").show().text("**答案錯誤! 請再次作答");
} else {
window.location.href = 'success.php';
}
});
toggleBtn.click(function() {
if (isPlaying) {
video.pause(); // pause the video
$(".playIcon").addClass("show");
toggleBtn.html(`<i class="fas fa-play-circle"></i> 播放`);
// update the button text
isPlaying = false; // set the playing state to false
} else {
video.play(); // play the video
toggleBtn.html(`<i class="fas fa-stop-circle"></i> 暫停`);
isPlaying = true; // set the playing state to true
}
});
$('.replayBtn').click(function() {
video.currentTime = 0;
video.play();
isPlaying = true;
toggleBtn.html(`<i class="fas fa-stop-circle"></i> 暫停`);
});
</script>
</html>