var progressAux = 0;
var currenTimeAux = 0;
var onProgress = scope.$on('progress', function (event, data) {
scope.playerCtrl.play = true;
var currentTime = data.currentClip.currentTime;
var duration = data.currentClip.duration;
var currenTimeInt = Math.floor(currentTime);
scope.playerCtrl.setDurationVideo(currentTime, 'progress');
$rootScope.$broadcast('progress-player-modal', {
time: Math.floor(duration - currentTime),
});
var progress = Math.floor((currentTime / duration) * 100);
// var buffer = Math.floor((that.currentClip.buffer / that.currentClip.duration) * 1280);
// esto se debe mover elemento
var fromVideo = getOriginVideo();
if (fromVideo === 'MainVideo' || fromVideo === 'home') {
if (currenTimeInt !== currenTimeAux) {
currenTimeAux = currenTimeInt;
if (
currenTimeInt === 60 ||
currenTimeInt === 60 * 3 ||
currenTimeInt === 60 * 5 ||
currenTimeInt === 60 * 10 ||
currenTimeInt === 60 * 30 ||
currenTimeInt === 60 * 60 ||
currenTimeInt === 60 * 120
) {
var dataEvent = dataEventPlay('-' + (currenTimeInt / 60).toString() + 'min');
dataEvent.data['Progress'] = (currenTimeInt / 60).toString();
metrics.sendData(dataEvent.eventName, dataEvent.data);
}
}
} else {
if (progress !== progressAux) {
if (progress === 25 || progress === 50 || progress === 75 || progress === 95) {
var percent = progress.toString();
if (progress === 95) {
percent = '100';
}
var dataEvent = dataEventPlay('-' + percent + '%');
dataEvent.data['Progress'] = (currenTimeInt).toString();
metrics.sendData(dataEvent.eventName, dataEvent.data);
}
}
}
if (progress !== progressAux) {
progressAux = progress;
var el = $('#bar-progress-2-js');
var bolita = $('#bolita-js');
var newStyleBar = {
transform: 'translateX(' + -1 * (100 - progress) + '%' + ')',
'-webkit-transform': 'translateX(' + -1 * (100 - progress) + '%' + ')',
};
var newStyleBolita = {
transform: 'translateX(' + progress * 9.5 + 'px' + ')',
'-webkit-transform': 'translateX(' + progress * 9.5 + 'px' + ')',
};
if (el.length) {
el.css(newStyleBar);
bolita.css(newStyleBolita);
}
}
});
Created
November 11, 2020 03:27
-
-
Save renearias/54eadabacad5cd9f16f86ed65d30c540 to your computer and use it in GitHub Desktop.
Progress Algoritmo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment