Disable video preload in inbox left panel (#4902)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-03-08 11:24:59 +04:00 committed by GitHub
parent ba393d9e51
commit 0483e2ac0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 16 additions and 5 deletions

View File

@ -37,6 +37,7 @@
export let withShowMore: boolean = true
export let attachmentImageSize: 'x-large' | undefined = undefined
export let showLinksPreview = true
export let videoPreload = true
export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined
@ -68,6 +69,7 @@
withShowMore,
attachmentImageSize,
showLinksPreview,
videoPreload,
onClick,
onReply
}}

View File

@ -24,6 +24,7 @@
export let value: Doc & { attachments?: number }
export let attachments: Attachment[] | undefined = undefined
export let imageSize: AttachmentImageSize = 'auto'
export let videoPreload = true
const query = createQuery()
const savedAttachmentsQuery = createQuery()
@ -59,4 +60,4 @@
})
</script>
<AttachmentList attachments={resAttachments} {savedAttachmentsIds} {imageSize} />
<AttachmentList attachments={resAttachments} {savedAttachmentsIds} {imageSize} {videoPreload} />

View File

@ -23,6 +23,7 @@
export let attachments: Attachment[] = []
export let savedAttachmentsIds: Ref<Attachment>[] = []
export let imageSize: AttachmentImageSize | undefined = undefined
export let videoPreload = true
</script>
{#if attachments.length}
@ -32,6 +33,7 @@
value={attachment}
isSaved={savedAttachmentsIds?.includes(attachment._id) ?? false}
{imageSize}
{videoPreload}
/>
{/each}
</Scroller>

View File

@ -33,6 +33,7 @@
export let listProvider: ListSelectionProvider | undefined = undefined
export let imageSize: AttachmentImageSize = 'auto'
export let removable: boolean = false
export let videoPreload = true
const dispatch = createEventDispatcher()
@ -69,7 +70,7 @@
</div>
{:else if type === 'video'}
<div class="content buttonContainer flex-center">
<AttachmentVideoPreview {value} />
<AttachmentVideoPreview {value} preload={videoPreload} />
<div class="actions conner">
<AttachmentActions attachment={value} {isSaved} {removable} />
</div>

View File

@ -19,6 +19,7 @@
import AttachmentPresenter from './AttachmentPresenter.svelte'
export let value: Attachment
export let preload = true
const maxSizeRem = 20
const baseSizeRem = 12
@ -55,7 +56,7 @@
}
</script>
<video controls width={dimensions.width} height={dimensions.height}>
<video controls width={dimensions.width} height={dimensions.height} preload={preload ? 'auto' : 'none'}>
<source src={getFileUrl(value.file, 'full', value.name)} />
<track kind="captions" label={value.name} />
<div class="container">

View File

@ -48,6 +48,7 @@
export let withShowMore: boolean = true
export let attachmentImageSize: AttachmentImageSize = 'auto'
export let showLinksPreview = true
export let videoPreload = true
export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined
@ -193,7 +194,7 @@
<ShowMore>
<div class="clear-mins">
<MessageViewer message={value.message} />
<AttachmentDocList {value} {attachments} imageSize={attachmentImageSize} />
<AttachmentDocList {value} {attachments} imageSize={attachmentImageSize} {videoPreload} />
{#each links as link}
<LinkPresenter {link} />
{/each}
@ -202,7 +203,7 @@
{:else}
<div class="clear-mins">
<MessageViewer message={value.message} />
<AttachmentDocList {value} {attachments} imageSize={attachmentImageSize} />
<AttachmentDocList {value} {attachments} imageSize={attachmentImageSize} {videoPreload} />
{#each links as link}
<LinkPresenter {link} />
{/each}

View File

@ -40,6 +40,7 @@
export let withShowMore: boolean = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let attachmentImageSize: AttachmentImageSize = 'x-large'
export let videoPreload = true
export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined
@ -76,6 +77,7 @@
{hoverStyles}
{withShowMore}
{attachmentImageSize}
{videoPreload}
showLinksPreview={false}
{onClick}
{onReply}

View File

@ -141,6 +141,7 @@
{actions}
hoverable={false}
{withFlatActions}
videoPreload={false}
onReply={() => {
handleReply(displayMessage)
}}