mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Cesium imagery frames: a tile video whose seek timed out or failed is failed for the retry window like one that failed to load, so a url that always hangs is not waited on by every tile; expired failures are pruned and clear() forgets them
This commit is contained in:
1 parent
dbe026b109
commit
9549e561e5
2 files changed
+50
-9
No files matched your search
@@ -247,9 +247,9 @@ const endSeek = (video) => {
|
||||
video.dispatchEvent(new Event('seeked'));
|
||||
};
|
||||
|
||||
test('after a seek that timed out, the next frame loads a fresh video rather than drawing what shows', async () => {
|
||||
test('after a seek that timed out, the video is not loaded again for a while, then afresh rather than drawing what shows', async () => {
|
||||
const { made, restore } = fakeVideoPage();
|
||||
mock.timers.enable({ apis: ['setTimeout'] });
|
||||
mock.timers.enable({ apis: ['setTimeout', 'Date'] });
|
||||
try {
|
||||
const videos = createTileVideos(4);
|
||||
const first = videos.frame('a.webm', 0.5);
|
||||
@@ -260,6 +260,10 @@ test('after a seek that timed out, the next frame loads a fresh video rather tha
|
||||
mock.timers.tick(VIDEO_SEEK_TIMEOUT_MS);
|
||||
await assert.rejects(first, /did not seek/);
|
||||
assert.equal(made[0].src, '', 'the stuck video is let go');
|
||||
// Asked again soon: failed at once, never waited on for another timeout.
|
||||
await assert.rejects(videos.frame('a.webm', 0.5), /failed to load lately/);
|
||||
assert.equal(made.length, 1, 'not loaded again');
|
||||
mock.timers.tick(VIDEO_RETRY_MS);
|
||||
let drawn = false;
|
||||
const second = videos.frame('a.webm', 0.5).then(() => (drawn = true));
|
||||
assert.equal(made.length, 2, 'a fresh video');
|
||||
@@ -276,6 +280,29 @@ test('after a seek that timed out, the next frame loads a fresh video rather tha
|
||||
}
|
||||
});
|
||||
|
||||
test('clear forgets the videos that failed, so each is loaded again at once', async () => {
|
||||
const { made, restore } = fakeVideoPage();
|
||||
mock.timers.enable({ apis: ['setTimeout', 'Date'] });
|
||||
try {
|
||||
const videos = createTileVideos(4);
|
||||
const first = videos.frame('a.webm', 0.5);
|
||||
made[0].dispatchEvent(new Event('error'));
|
||||
await assert.rejects(first, /did not load/);
|
||||
await assert.rejects(videos.frame('a.webm', 0.5), /failed to load lately/);
|
||||
videos.clear();
|
||||
const again = videos.frame('a.webm', 0.5);
|
||||
assert.equal(made.length, 2, 'loaded again');
|
||||
made[1].duration = 10;
|
||||
made[1].dispatchEvent(new Event('loadeddata'));
|
||||
await flush();
|
||||
endSeek(made[1]);
|
||||
assert.ok(await again);
|
||||
} finally {
|
||||
mock.timers.reset();
|
||||
restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('a video’s length is learnt with a longer wait, and a failed one is not loaded again for a while', async () => {
|
||||
const { made, restore } = fakeVideoPage();
|
||||
mock.timers.enable({ apis: ['setTimeout', 'Date'] });
|
||||
|
||||
Reference in new issue
Block a user