about summary refs log tree commit diff
path: root/src/view/com/composer/videos/VideoPreview.web.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-09-11 18:33:57 +0100
committerGitHub <noreply@github.com>2024-09-11 10:33:57 -0700
commit24b07c6cf495367acfcf6a3f44a841e8f355d08f (patch)
tree3ee4a3f1ccf7f17a1c9646cd7af8468c4b9ebad9 /src/view/com/composer/videos/VideoPreview.web.tsx
parenta19c91d90e349d5adcf720f30d40e04513c2f2df (diff)
downloadvoidsky-24b07c6cf495367acfcf6a3f44a841e8f355d08f.tar.zst
[Video] Cap duration (#5270)
Diffstat (limited to 'src/view/com/composer/videos/VideoPreview.web.tsx')
-rw-r--r--src/view/com/composer/videos/VideoPreview.web.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/view/com/composer/videos/VideoPreview.web.tsx b/src/view/com/composer/videos/VideoPreview.web.tsx
index 88537956e..f64de29e7 100644
--- a/src/view/com/composer/videos/VideoPreview.web.tsx
+++ b/src/view/com/composer/videos/VideoPreview.web.tsx
@@ -12,6 +12,8 @@ import {ExternalEmbedRemoveBtn} from 'view/com/composer/ExternalEmbedRemoveBtn'
 import {atoms as a} from '#/alf'
 import {PlayButtonIcon} from '#/components/video/PlayButtonIcon'
 
+const MAX_DURATION = 60
+
 export function VideoPreview({
   asset,
   video,
@@ -36,6 +38,15 @@ export function VideoPreview({
       'loadedmetadata',
       function () {
         setDimensions(this.videoWidth, this.videoHeight)
+        if (!isNaN(this.duration)) {
+          if (this.duration > MAX_DURATION) {
+            Toast.show(
+              _(msg`Videos must be less than 60 seconds long`),
+              'xmark',
+            )
+            clear()
+          }
+        }
       },
       {signal},
     )