所以我使用css和javascript为视频创建了可点击的热点,这样当用户点击该框时会出现一个弹出窗口并且视频暂停。
但是我想知道我是否可以计算这些元素,以便它们出现在视频中的某些点上。
我在想我需要在规定的时间触发可点击区域的显示,但我不确定如何解决这个问题。
我已经包含了我使用过的代码。
希望这是有道理的。
var video1;
$(document).ready(function(){
video1 = $ ('#video1');
$('.box1').on('click', function(){
playPauseVideo(('.persona1PopUp'));
});
$('.box2').on('click', function(){
});
});
function playPauseVideo(popUp){
if (video1[0].paused){
video[0].play();
} else {
video1[0].pause();
$.featherlight($(popUp));
}
}
body{
background-color:#1e1e1e;
}
h1, h2, h3, h4, h5, h6{
margin: 0;
font-weight: bold;
}
p{
margin: 0;
}
video{
width: 100%;
height: auto;
}
img{
float: left;
margin-right: 25px;
}
.container{
margin-top: 20px;
}
.descArea{
background-color: #fff;
box-shadow: 0 0 3px #c8c8c8;
padding: 15px;
box-sizing: border-box;
}
.videoArea{
position: relative;
}
.box1{
position: absolute;
background-color: rgba(40, 169, 220, 0.3);
width: 200px;
height: 200px;
top: 50px;
left: 630px;
cursor: pointer;
}
.box2{
position: absolute;
background-color: rgba(207, 50, 53, 0.3);
width: 200px;
height: 200px;
top: 70px;
left: 150px;
cursor: pointer;
}
.lightbox{
display: none;
}
.longBtns{
display: block;
}
<!DOCTYPE html>
<html>
<head>
<title>Interactive Video</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jQuery -->
<script src="js/jquery-1.12.3.min.js"></script>
<!-- Skeleton CSS & Featherlight -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/featherlight.css">
<script src="js/featherlight.js"></script>
<!-- Interaction CSS -->
<link rel="stylesheet" href="css/interaction.css">
<!-- Interaction js -->
<script src="js/interaction.js"></script>
<!-- GreenSock -->
<script src="js/TweenMax.min.js"></script>
</head>
<body>
<div class="container">
<div class="row videoArea">
<div class="box1"></div>
<div class="box2"></div>
<video id="video1" controls autoplay>
<source src="../Interactive/media/Short Story Animation.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<div class="row descArea">
<h5>Video Title</h5>
<p>This is the description</p>
<div class="current">0:00</div>
<div class="duration">0:00</div>
</div>
</div> <!-- End of Container -->
<div class="lightbox persona1PopUp">
<img src="images/Justin.jpg">
<h5>Justins Hanks</h5>
<p>Role: Development Manager</p>
<p>Bio: Justin has been a manager for 4 years. sakjdhsakjdh askjdh ksajhd aksjh askjdhksajd askjhd askjhdkjsah </p>
<p>Previous Experiences</p>
<ul>
<li>Experience 1: 2002-2004</li>
<li>Experience 2: 2005-2009</li>
<li>Experience 3: 2010-2016</li>
</ul>
</div>
</body>
</html>
答案 0 :(得分:0)
您可以使用if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$jsonData = file_get_contents('php://input');
$data = json_decode($jsonData, true);
$event_title = $data['params']['event_title'];
$event_desc = $data['params']['event_desc'];
// Singleton Database Library - custom code for entering into database
$result = $db->insert('events', $event_title, $event_desc);
}
或HTMLMediaElement.addTextTrack()
元素以及一个或多个有效<track>
文件在特定时间播放视频播放的字幕;见Alternative for checking browser idle,How to add subtitles from a external source in HTML5?。