openvibers/openvibe.live Commits

VODs, clips and old stream links that are gone say so at their address (they flashed a toast and dropped the visitor on a list while the server said 404) (#193)

OP OpenVibers committed 27 days ago · 22a7c49402 · 2 files, +4 −0

Changes

ddiff --git a/public/js/app-channel.js b/public/js/app-channel.js
iindex 2183a0d3..8802a254 100644
---- a/public/js/app-channel.js
++++ b/public/js/app-channel.js
@@@ -3349,6 +3349,7 @@ async function openStream(streamId) {
loadStreamGoals(streamId);
startUptime(s.started_at);
} catch (e) {
++ if (e && e.status === 404) return showNotFound({ title: 'This stream is not here', message: 'It ended long ago or the link is mistyped. Live channels are at /@name.' });
toast('Stream not found', 'error');
navigate('/');
}
ddiff --git a/public/js/app-media.js b/public/js/app-media.js
iindex aba78340..9c8fad07 100644
---- a/public/js/app-media.js
++++ b/public/js/app-media.js
@@@ -553,6 +553,8 @@ async function loadVodPlayer(vodId, seekTo) {
Promise.allSettled(blocks).then(() => _mediaReady('page-vod-player'));
} catch (e) {
_mediaReady('page-vod-player');
++ // Gone or private (the server answered this address 404 too): say so here, not a toast and the VOD list.
++ if (e && e.status === 404) return showNotFound({ title: 'This video is not here', message: 'It was deleted, made private, or the link is mistyped.' });
console.error('Failed to load VOD player', e);
toast('Failed to load video: ' + (e.message || 'not found'), 'error');
navigate('/vods');
@@@ -1242,6 +1244,7 @@ async function loadClipPlayer(clipId) {
Promise.allSettled(blocks).then(() => _mediaReady('page-clip-player'));
} catch (e) {
_mediaReady('page-clip-player');
++ if (e && e.status === 404) return showNotFound({ title: 'This clip is not here', message: 'It was deleted, made private, or the link is mistyped.' });
toast('Clip not found', 'error');
navigate('/clips');
}