0

временно отключаю возможность авто-сохранения времени просмотра

This commit is contained in:
2017-12-12 13:01:26 +03:00
parent 8bf1a383ac
commit bff5b710b1

View File

@@ -5,6 +5,7 @@ const PlayerCore = function(playerObj, titleObj, videoData) {
const _this = this;
/* временно отключаю возможность авто-сохранения времени просмотра
// сохранение времени просмотра
playerObj.bind('play', function() {
_this.timeLast = $.now();
@@ -15,7 +16,7 @@ const PlayerCore = function(playerObj, titleObj, videoData) {
let sec = Math.floor((timeCurrent - _this.timeLast)/1000);
if (sec >= 5) {
let playerCurrentTime = playerObj[0].currentTime;
if (Math.floor(playerCurrentTime) <= 10)
if (Math.floor(playerCurrentTime) <= 10)
return;
let save_data = { 'time': playerCurrentTime };
Cookies.set(_this.path, save_data, { 'expires': 30 });
@@ -26,7 +27,7 @@ const PlayerCore = function(playerObj, titleObj, videoData) {
}); //TODO убрать на продакшене
}
});
*/
this.getType = function() {
return videoData.type;
};
@@ -130,6 +131,7 @@ function msToTime(ms) {
};
}
/*
function loadPlayerCookieData(playerCore) {
let data = Cookies.getJSON(playerCore.path);
@@ -172,12 +174,13 @@ function loadPlayerCookieData(playerCore) {
$('#modal').modal('show');
}
}
*/
function initPlayer(video_data) {
const playerCore = new PlayerCore($('#player'), $('#title'), video_data);
// загрузка ранее сохранённых данных
loadPlayerCookieData(playerCore);
//loadPlayerCookieData(playerCore);
if (playerCore.getType() == 'one_film') {
playerCore.setTitle();