aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackedTimeline.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-07-28 14:10:32 -0400
committerbobzel <zzzman@gmail.com>2022-07-28 14:10:32 -0400
commitb830a5dc8df82886a9304ebe02fe93cdf1c0b521 (patch)
tree2a5810f03390e89d494860fbb3841c53a9da96fa /src/client/views/collections/CollectionStackedTimeline.tsx
parent8597999f53a7599d9bdeeb70150baec95b2f6dd0 (diff)
fixed video thumbnail generation to have a lock that prevents multiple attempts to create the thumbnails at the same time. fixed ImageUpload to catch resize errors and not crash the server.
Diffstat (limited to 'src/client/views/collections/CollectionStackedTimeline.tsx')
-rw-r--r--src/client/views/collections/CollectionStackedTimeline.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 714d8421a..52126884a 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -2,7 +2,7 @@ import React = require('react');
import { action, computed, IReactionDisposer, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
import { computedFn } from 'mobx-utils';
-import { Doc, DocListCast } from '../../../fields/Doc';
+import { Doc, DocListCast, StrListCast } from '../../../fields/Doc';
import { Id } from '../../../fields/FieldSymbols';
import { List } from '../../../fields/List';
import { listSpec } from '../../../fields/Schema';
@@ -289,10 +289,9 @@ export class CollectionStackedTimeline extends CollectionSubView<CollectionStack
this._hoverTime = this.toTimeline(clientX - rect.x, rect.width);
if (this.dataDoc.thumbnails) {
const nearest = Math.floor((this._hoverTime / this.props.rawDuration) * VideoBox.numThumbnails);
- const thumbnails = Cast(this.dataDoc.thumbnails, listSpec('string'), []);
- const imgField = thumbnails && thumbnails.length > 0 ? new ImageField(thumbnails[nearest]) : new ImageField('');
- const src = imgField && imgField.url.href ? imgField.url.href.replace('.png', '_s.png') : '';
- this._thumbnail = src ? src : undefined;
+ const thumbnails = StrListCast(this.dataDoc.thumbnails);
+ const imgField = thumbnails?.length > 0 ? new ImageField(thumbnails[nearest]) : undefined;
+ this._thumbnail = imgField?.url?.href ? imgField.url.href.replace('.png', '_s.png') : undefined;
}
}
};