2
0

🐛 (bot) Fix audio and video autoplay error catching

This commit is contained in:
Baptiste Arnaud
2023-07-11 07:31:48 +02:00
parent 70dd413295
commit 5587bfb0e9
4 changed files with 10 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/js", "name": "@typebot.io/js",
"version": "0.0.68", "version": "0.0.69",
"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",

View File

@ -21,13 +21,10 @@ export const AudioBubble = (props: Props) => {
setIsTyping(false) setIsTyping(false)
setTimeout(() => { setTimeout(() => {
const audioElement = ref?.querySelector('audio') const audioElement = ref?.querySelector('audio')
if (audioElement) { if (audioElement)
try { audioElement
audioElement.play() .play()
} catch (e) { .catch((e) => console.warn('Could not autoplay the audio:', e))
console.warn('Could not autoplay the audio:', e)
}
}
props.onTransitionEnd(ref?.offsetTop) props.onTransitionEnd(ref?.offsetTop)
}, showAnimationDuration) }, showAnimationDuration)
}, typingDuration) }, typingDuration)

View File

@ -18,13 +18,10 @@ export const VideoBubble = (props: Props) => {
const onTypingEnd = () => { const onTypingEnd = () => {
const videoElement = ref?.querySelector('video') const videoElement = ref?.querySelector('video')
if (videoElement) { if (videoElement)
try { videoElement
videoElement.play() .play()
} catch (e) { .catch((e) => console.warn('Could not autoplay the video:', e))
console.warn('Could not autoplay the video:', e)
}
}
if (!isTyping()) return if (!isTyping()) return
setIsTyping(false) setIsTyping(false)
setTimeout(() => { setTimeout(() => {

View File

@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/react", "name": "@typebot.io/react",
"version": "0.0.68", "version": "0.0.69",
"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",