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)
Changes
@@@ -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('/');}@@@ -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');}
@@ -3349,6 +3349,7 @@ async function openStream(streamId) {
@@ -3349,6 +3349,7 @@ async function openStream(streamId) {
loadStreamGoals(streamId);
loadStreamGoals(streamId);
startUptime(s.started_at);
startUptime(s.started_at);
} catch (e) {
} 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');
toast('Stream not found', 'error');
navigate('/');
navigate('/');
}
}
@@ -553,6 +553,8 @@ async function loadVodPlayer(vodId, seekTo) {
@@ -553,6 +553,8 @@ async function loadVodPlayer(vodId, seekTo) {
Promise.allSettled(blocks).then(() => _mediaReady('page-vod-player'));
Promise.allSettled(blocks).then(() => _mediaReady('page-vod-player'));
} catch (e) {
} catch (e) {
_mediaReady('page-vod-player');
_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);
console.error('Failed to load VOD player', e);
toast('Failed to load video: ' + (e.message || 'not found'), 'error');
toast('Failed to load video: ' + (e.message || 'not found'), 'error');
navigate('/vods');
navigate('/vods');
@@ -1242,6 +1244,7 @@ async function loadClipPlayer(clipId) {
@@ -1242,6 +1244,7 @@ async function loadClipPlayer(clipId) {
Promise.allSettled(blocks).then(() => _mediaReady('page-clip-player'));
Promise.allSettled(blocks).then(() => _mediaReady('page-clip-player'));
} catch (e) {
} catch (e) {
_mediaReady('page-clip-player');
_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');
toast('Clip not found', 'error');
navigate('/clips');
navigate('/clips');
}
}