2
0
Files
bot/packages/schemas/features/blocks/bubbles/video/constants.ts
Abhirup Basu c7263a17eb ️ Option to disable controls and autoplay on videos (#1631)
Extends the implementation of #1503 as per the suggestions provided in
the code review to resolve #1485



https://github.com/baptisteArno/typebot.io/assets/69730155/87481d64-57f5-4f7e-8a28-4a464f12cc31

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
2024-07-11 12:32:47 +02:00

59 lines
1.5 KiB
TypeScript

export enum VideoBubbleContentType {
URL = 'url',
YOUTUBE = 'youtube',
VIMEO = 'vimeo',
TIKTOK = 'tiktok',
GUMLET = 'gumlet',
}
export const embeddableVideoTypes = [
VideoBubbleContentType.YOUTUBE,
VideoBubbleContentType.VIMEO,
VideoBubbleContentType.TIKTOK,
VideoBubbleContentType.GUMLET,
] as const
export const defaultVideoBubbleContent = {
height: 400,
aspectRatio: '16/9',
maxWidth: '100%',
areControlsDisplayed: true,
isAutoplayEnabled: true,
} as const
export const horizontalVideoSuggestionSize = {
aspectRatio: '16/9',
maxWidth: '100%',
}
export const verticalVideoSuggestionSize = {
aspectRatio: '9/16',
maxWidth: '400px',
}
const youtubeBaseUrl = 'https://www.youtube.com/embed'
export const youtubeRegex =
/youtube\.com\/(watch\?v=|shorts\/)([\w-]+)|youtu\.be\/([\w-]+)(\?.+)*/
export const youtubeEmbedParamsMap = {
t: 'start',
}
const vimeoBaseUrl = 'https://player.vimeo.com/video'
export const vimeoRegex = /vimeo\.com\/(\d+)/
const tiktokBaseUrl = 'https://www.tiktok.com/embed/v2'
export const tiktokRegex = /tiktok\.com\/@[\w-]+\/video\/(\d+)/
const gumletBaseUrl = 'https://play.gumlet.io/embed'
export const gumletRegex = /gumlet\.com\/watch\/(\w+)/
export const oneDriveRegex = /https:\/\/onedrive.live.com\/embed\?[^"]+/
export const embedBaseUrls = {
[VideoBubbleContentType.VIMEO]: vimeoBaseUrl,
[VideoBubbleContentType.YOUTUBE]: youtubeBaseUrl,
[VideoBubbleContentType.TIKTOK]: tiktokBaseUrl,
[VideoBubbleContentType.GUMLET]: gumletBaseUrl,
} as const