diff options
author | bobzel <zzzman@gmail.com> | 2022-07-28 14:22:58 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-07-28 14:22:58 -0400 |
commit | fe5b49705069eebccec22e6cad29b007a60e3bec (patch) | |
tree | e7fefab18b14d8733a6412f6f5c15507a1562ae5 /src | |
parent | b830a5dc8df82886a9304ebe02fe93cdf1c0b521 (diff) |
from last
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionStackedTimeline.tsx | 2 | ||||
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx index 52126884a..48e3abbc7 100644 --- a/src/client/views/collections/CollectionStackedTimeline.tsx +++ b/src/client/views/collections/CollectionStackedTimeline.tsx @@ -291,7 +291,7 @@ export class CollectionStackedTimeline extends CollectionSubView<CollectionStack const nearest = Math.floor((this._hoverTime / this.props.rawDuration) * VideoBox.numThumbnails); 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; + this._thumbnail = imgField?.url?.href ? imgField.url.href.replace('.png', '_m.png') : undefined; } } }; diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 4af4d2020..a3d501153 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -427,15 +427,12 @@ export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProp video.onseeked = () => { const canvas = document.createElement('canvas'); - canvas.height = video.videoHeight; - canvas.width = video.videoWidth; - const ctx = canvas.getContext('2d'); - ctx?.drawImage(video, 0, 0, canvas.width, canvas.height, 0, 0, 25, 25); - const imgUrl = canvas.toDataURL(); + canvas.height = 100; + canvas.width = 100; + canvas.getContext('2d')?.drawImage(video, 0, 0, video.videoWidth, video.videoHeight, 0, 0, 100, 100); const retitled = StrCast(this.rootDoc.title).replace(/[ -\.:]/g, ''); const encodedFilename = encodeURIComponent('thumbnail' + retitled + '_' + video.currentTime.toString().replace(/\./, '_')); - const filename = basename(encodedFilename); - thumbnailPromises?.push(VideoBox.convertDataUri(imgUrl, filename, true)); + thumbnailPromises?.push(VideoBox.convertDataUri(canvas.toDataURL(), basename(encodedFilename), true)); const newTime = video.currentTime + video.duration / (VideoBox.numThumbnails - 1); if (newTime < video.duration) { video.currentTime = newTime; |