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",
"version": "0.0.68",
"version": "0.0.69",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.0.68",
"version": "0.0.69",
"description": "React library to display typebots on your website",
"main": "dist/index.js",
"types": "dist/index.d.ts",