🚸 (video) Improve video autoplay behavior
Autoplay video only when displayed entirely and fix weird Safari autoplay issues when scrolling
This commit is contained in:
@ -1509,7 +1509,6 @@
|
|||||||
"buttons": { "color": "#010000", "backgroundColor": "#FFEF02" },
|
"buttons": { "color": "#010000", "backgroundColor": "#FFEF02" },
|
||||||
"roundness": "medium",
|
"roundness": "medium",
|
||||||
"hostAvatar": {
|
"hostAvatar": {
|
||||||
"url": "http://localhost:9000/typebot/public/typebots/cli8tguel00011anqcst3166d/hostAvatar?v=1685368734687",
|
|
||||||
"isEnabled": true
|
"isEnabled": true
|
||||||
},
|
},
|
||||||
"hostBubbles": { "color": "#ffffff", "backgroundColor": "#1B1A1A" },
|
"hostBubbles": { "color": "#ffffff", "backgroundColor": "#1B1A1A" },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.0.66",
|
"version": "0.0.67",
|
||||||
"description": "Javascript library to display typebots on your website",
|
"description": "Javascript library to display typebots on your website",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -17,6 +17,14 @@ export const VideoBubble = (props: Props) => {
|
|||||||
const [isTyping, setIsTyping] = createSignal(true)
|
const [isTyping, setIsTyping] = createSignal(true)
|
||||||
|
|
||||||
const onTypingEnd = () => {
|
const onTypingEnd = () => {
|
||||||
|
const videoElement = ref?.querySelector('video')
|
||||||
|
if (videoElement) {
|
||||||
|
try {
|
||||||
|
videoElement.play()
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Could not autoplay the video:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!isTyping()) return
|
if (!isTyping()) return
|
||||||
setIsTyping(false)
|
setIsTyping(false)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -74,9 +82,7 @@ const VideoContent = (props: VideoContentProps) => {
|
|||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
height: props.isTyping ? '32px' : 'auto',
|
height: props.isTyping ? '32px' : 'auto',
|
||||||
'max-height': window.navigator.vendor.match(/apple/i) ? '40vh' : '',
|
|
||||||
}}
|
}}
|
||||||
autoplay
|
|
||||||
>
|
>
|
||||||
<source src={props.content.url} type="video/mp4" />
|
<source src={props.content.url} type="video/mp4" />
|
||||||
Sorry, your browser doesn't support embedded videos.
|
Sorry, your browser doesn't support embedded videos.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.0.66",
|
"version": "0.0.67",
|
||||||
"description": "React library to display typebots on your website",
|
"description": "React library to display typebots on your website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -63,6 +63,9 @@ export const defaultTheme: Theme = {
|
|||||||
color: '#303235',
|
color: '#303235',
|
||||||
placeholderColor: '#9095A0',
|
placeholderColor: '#9095A0',
|
||||||
},
|
},
|
||||||
|
hostAvatar: {
|
||||||
|
isEnabled: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
general: {
|
general: {
|
||||||
font: 'Open Sans',
|
font: 'Open Sans',
|
||||||
|
Reference in New Issue
Block a user