Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/web-app-preview/src/components/Sources/MediaVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
preload="preload"
:autoplay="isAutoPlayEnabled"
>
<source :src="file.url" :type="file.mimeType" />
<source :src="file.url" :type="sourceType" />
</video>
</template>
<script setup lang="ts">
import { onBeforeUnmount, onMounted, useTemplateRef } from 'vue'
import { computed, onBeforeUnmount, onMounted, useTemplateRef } from 'vue'
import { CachedFile } from '../../helpers/types'

const { file, isAutoPlayEnabled = true } = defineProps<{
Expand All @@ -25,6 +25,16 @@ const resizeVideoDimensions = () => {
video.value.style.maxWidth = `${stageMedia.offsetWidth - 10}px`
}

const sourceType = computed(() => {
if (file.mimeType === 'video/quicktime') {
// QuickTime MOV files often use codecs compatible with MP4 containers,
// but browsers do not natively recognize the 'video/quicktime' MIME type for playback.
// Using 'video/mp4' as the MIME type improves compatibility with modern browsers.
return 'video/mp4'
}
return file.mimeType
})

onMounted(() => {
resizeVideoDimensions()
window.addEventListener('resize', resizeVideoDimensions)
Expand Down
1 change: 1 addition & 0 deletions packages/web-app-preview/src/mimeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export const mimeTypes = [
'image/webp',
'image/x-ms-bmp',
'video/mp4',
'video/quicktime',
'video/webm'
]