-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo.php
More file actions
80 lines (73 loc) · 1.89 KB
/
video.php
File metadata and controls
80 lines (73 loc) · 1.89 KB
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
<html>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'></script>
<?php
ob_start();
include_once("functions/loadCurrentVideo.php");
ob_end_clean();
?>
<script type='text/javascript'>
var fighterIntervalId = null;
function playCurrentVideo() {
//Stop refreshing the fighter info
clearInterval(fighterIntervalId);
fighterIntervalId = null;
$.ajax({
type: 'GET',
url: 'functions/loadCurrentVideo.php',
success: loadNextVideo,
error: drawError
});
return false;
};
function videoEnded() {
//Stop refreshing the fighter info
clearInterval(fighterIntervalId);
fighterIntervalId = null;
$.ajax({
type: 'GET',
url: 'functions/loadNextVideo.php',
success: loadNextVideo,
error: drawError
});
return false;
};
// handles drawing an error message
function drawError() {
alert('Bummer: there was an error!');
}
// handles the response, adds the html
function loadNextVideo(responseText) {
var vid = document.getElementById("myVideo");
vid.src = "videos/" + responseText;
vid.play();
$.ajax({
type: 'GET',
url: 'functions/updateCurrentVideoStartTime.php',
success: startFighterInterval,
error: drawError
});
return false;
}
function startFighterInterval() {
//If video_type_id == 1 (betting) then update the odds every 10 seconds
if(<?php echo $current_video_type_id; ?> == 1) {
fighterIntervalId = setInterval(function(){
//Update the odds
$.ajax({
type: 'GET',
url: 'functions/updateOdds.php',
error: drawError
});
}, 10000);
}
}
</script>
<video id="myVideo" height="80%" onended="videoEnded()" style="margin:0 auto; width:100%;" controls>
<source src="videos/s1.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</br></br>
<div align="center">
<button onclick="playCurrentVideo()">Play "current" video</button>
</div>
</html>