Issue 12771: Fix interrupted video playback

This commit is contained in:
Michael 2025-02-09 20:20:36 +00:00
parent 5e00120465
commit 3c3c69dfd8
11 changed files with 201 additions and 213 deletions

View file

@ -501,12 +501,14 @@ function NavUpdate() {
// start live update
['network', 'profile', 'channel', 'community', 'notes', 'display', 'contact'].forEach(function (src) {
if ($('#live-' + src).length) {
if ($('#live-' + src).length && (force_update || (updateContent && ['network', 'channel', 'community'].includes(src)))) {
liveUpdate(src);
}
});
if (!$('#live-network').length) {
if ($('#live-network').length) {
networkUpdate();
} else {
var update_url = 'ping_network?ping=1';
$.get(update_url, function(net) {
updateCounter('net', net);
@ -522,7 +524,7 @@ function NavUpdate() {
}
});
}
timer = setTimeout(NavUpdate, updateInterval);
timer = setTimeout(NavUpdate, 30000);
}
function updateConvItems(data) {
@ -568,38 +570,14 @@ function updateConvItems(data) {
}
}
function liveUpdate(src) {
if ((src == null) || stopped || !profile_uid) {
$('.like-rotator').hide(); return;
}
if (($('.comment-edit-text-full').length) || in_progress) {
if (livetime) {
clearTimeout(livetime);
}
livetime = setTimeout(function() {liveUpdate(src)}, 5000);
return;
}
if (livetime != null) {
livetime = null;
}
prev = 'live-' + src;
in_progress = true;
function getUpdateUrl(src)
{
let force = force_update || $(document).scrollTop() === 0;
var orgHeight = $("section").height();
var udargs = ((netargs.length) ? '/' + netargs : '');
var update_url = src + udargs + '&p=' + profile_uid + '&force=' + (force ? 1 : 0) + '&item=' + update_item;
if (force_update) {
force_update = false;
}
if (getUrlParameter('page')) {
update_url += '&page=' + getUrlParameter('page');
}
@ -629,8 +607,36 @@ function liveUpdate(src) {
if (match.length > 0) {
update_url += '&first_uriid=' + match[0].innerHTML;
}
return update_url;
}
$.get('update_' + update_url, function(data) {
function liveUpdate(src) {
if ((src == null) || stopped || !profile_uid) {
$('.like-rotator').hide(); return;
}
if (($('.comment-edit-text-full').length) || in_progress) {
if (livetime) {
clearTimeout(livetime);
}
livetime = setTimeout(function() {liveUpdate(src)}, 5000);
return;
}
if (livetime != null) {
livetime = null;
}
prev = 'live-' + src;
in_progress = true;
var orgHeight = $("section").height();
if (force_update) {
force_update = false;
}
$.get('update_' + getUpdateUrl(src), function(data) {
in_progress = false;
update_item = 0;
@ -647,12 +653,12 @@ function liveUpdate(src) {
$(window).scrollTop($(window).scrollTop() + $("section").height() - orgHeight);
});
});
}
if (src == 'network') {
$.get('ping_' + update_url, function(net) {
updateCounter('net', net);
});
}
function networkUpdate() {
$.get('ping_' + getUpdateUrl('network'), function(net) {
updateCounter('net', net);
});
}
function updateCounter(type, counter) {