hy, I have this javascript code
if (localStorage['JWPlayerPosition'] == '' || localStorage['JWPlayerPosition'] == 'undefined') {
console.log("No cookie for position found");
var currentPosition = 0;
} else {
if (localStorage['JWPlayerPosition'] == "null") {
localStorage['JWPlayerPosition'] = 0;
} else {
var currentPosition = localStorage['JWPlayerPosition'];
}
console.log("Position cookie found: "+localStorage['JWPlayerPosition']);
}
jwplayer("player").setup({
file: 'tears.mp4',
});
jwplayer().once('play',function(){
console.log('Checking position cookie!');
console.log(Math.abs(jwplayer().getDuration() - currentPosition));
if (currentPosition > 0 && Math.abs(jwplayer().getDuration() - currentPosition) > 5) {
jwplayer().seek(currentPosition);
}
});
window.onunload = function() {
localStorage['JWPlayerPosition'] = jwplayer().getPosition();
}
This code resume the video from the last time, this code save the data into localhost, I do like to know if there are any way to save it on a text file inside the server, if yes can you please help me ?
↧