🐛 (bot) Fix audio and video autoplay error catching
This commit is contained in:
@ -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",
|
||||||
|
@ -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)
|
||||||
|
@ -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(() => {
|
||||||
|
@ -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",
|
||||||
|
Reference in New Issue
Block a user