-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdatePlayTime.js
More file actions
36 lines (35 loc) · 881 Bytes
/
updatePlayTime.js
File metadata and controls
36 lines (35 loc) · 881 Bytes
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
$(document).ready(function(){
$("#FeatureVideo").bind('timeupdate', function() {
var state = "";
if ($("#FeatureVideo").prop("ended"))
{
state = "ended";
}
else if ($("#FeatureVideo").prop("paused"))
{
state = "paused";
}
else
{
state = "playing";
}
$.ajax({
type: "POST",
url: "updatePlayTime.php",
data: { "MediaID" : MediaID, "CurrentTime" : $("#FeatureVideo").prop("currentTime"), "State" : state },
// callback handler that will be called on success
success: function(response, textStatus, jqXHR){
// log a message to the console
console.log("Time updated");
},
// callback handler that will be called on error
error: function(jqXHR, textStatus, errorThrown){
// log the error to the console
console.log(
"The following error occured: "+
textStatus, errorThrown
);
}
});
});
});