|
|
|
|
@ -332,50 +332,54 @@ var regex = /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;
|
|
|
|
|
durationEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
|
|
}
|
|
|
|
|
function onTimeupdate() {
|
|
|
|
|
var videoDuration = Math.round(el.current.duration);
|
|
|
|
|
seekEl.current.setAttribute('max', videoDuration);
|
|
|
|
|
progressBarEl.current.setAttribute('max', videoDuration);
|
|
|
|
|
var time = formatTime(videoDuration);
|
|
|
|
|
durationEl.current.innerText = "".concat(time.hour > 0 ? time.hour + ':' : '').concat(time.minutes, ":").concat(time.seconds);
|
|
|
|
|
durationEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
|
|
updateProgress();
|
|
|
|
|
updateTimeElapsed();
|
|
|
|
|
var _watermarkRef$current = watermarkRef.current.getBoundingClientRect(),
|
|
|
|
|
width = _watermarkRef$current.width,
|
|
|
|
|
height = _watermarkRef$current.height,
|
|
|
|
|
x = _watermarkRef$current.x,
|
|
|
|
|
y = _watermarkRef$current.y;
|
|
|
|
|
if (x < 0 || y < 0 || !width) {
|
|
|
|
|
// el.current.src = '';
|
|
|
|
|
// el.current.pause();
|
|
|
|
|
// message.warning({
|
|
|
|
|
// content: '当前操作非法,已禁止观看视频',
|
|
|
|
|
// key: 'watermarkRef',
|
|
|
|
|
// });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!isSeeking) {
|
|
|
|
|
var newTime = el.current.currentTime;
|
|
|
|
|
var timeDiff = newTime - lastUpdatedTime;
|
|
|
|
|
//currenttime update before Seeking & Seeked fired
|
|
|
|
|
if (Math.abs(timeDiff) < 10) {
|
|
|
|
|
sumTimePlayed += Math.abs(timeDiff);
|
|
|
|
|
lastUpdatedTime = newTime;
|
|
|
|
|
if (!isLoging) {
|
|
|
|
|
if (sumTimePlayed - logCount * timeTick >= 0) {
|
|
|
|
|
logCount++;
|
|
|
|
|
pos.push(lastUpdatedTime);
|
|
|
|
|
if (toLog) {
|
|
|
|
|
log();
|
|
|
|
|
try {
|
|
|
|
|
var videoDuration = Math.round(el.current.duration);
|
|
|
|
|
seekEl.current.setAttribute('max', videoDuration);
|
|
|
|
|
progressBarEl.current.setAttribute('max', videoDuration);
|
|
|
|
|
var time = formatTime(videoDuration);
|
|
|
|
|
durationEl.current.innerText = "".concat(time.hour > 0 ? time.hour + ':' : '').concat(time.minutes, ":").concat(time.seconds);
|
|
|
|
|
durationEl.current.setAttribute('datetime', "".concat(time.hour > 0 ? ' ' + time.hour + ' ' : '').concat(time.minutes, "m ").concat(time.seconds, "s"));
|
|
|
|
|
updateProgress();
|
|
|
|
|
updateTimeElapsed();
|
|
|
|
|
var _watermarkRef$current = watermarkRef.current.getBoundingClientRect(),
|
|
|
|
|
width = _watermarkRef$current.width,
|
|
|
|
|
height = _watermarkRef$current.height,
|
|
|
|
|
x = _watermarkRef$current.x,
|
|
|
|
|
y = _watermarkRef$current.y;
|
|
|
|
|
if (x < 0 || y < 0 || !width) {
|
|
|
|
|
// el.current.src = '';
|
|
|
|
|
// el.current.pause();
|
|
|
|
|
// message.warning({
|
|
|
|
|
// content: '当前操作非法,已禁止观看视频',
|
|
|
|
|
// key: 'watermarkRef',
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
}
|
|
|
|
|
if (!isSeeking) {
|
|
|
|
|
var newTime = el.current.currentTime;
|
|
|
|
|
var timeDiff = newTime - lastUpdatedTime;
|
|
|
|
|
//currenttime update before Seeking & Seeked fired
|
|
|
|
|
if (Math.abs(timeDiff) < 10) {
|
|
|
|
|
sumTimePlayed += Math.abs(timeDiff);
|
|
|
|
|
lastUpdatedTime = newTime;
|
|
|
|
|
if (!isLoging) {
|
|
|
|
|
if (sumTimePlayed - logCount * timeTick >= 0) {
|
|
|
|
|
logCount++;
|
|
|
|
|
pos.push(lastUpdatedTime);
|
|
|
|
|
if (toLog) {
|
|
|
|
|
log();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
lastUpdatedTime = newTime;
|
|
|
|
|
if (toLog) {
|
|
|
|
|
log();
|
|
|
|
|
} else {
|
|
|
|
|
lastUpdatedTime = newTime;
|
|
|
|
|
if (toLog) {
|
|
|
|
|
log();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log("videoplaying:", error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function onSeeking() {
|