Sound don't play on chatbot web application in ios browser.
I have a question
Sound is not playing in chat bot web application in iOS , chrome and Safari browser.
We are not using any browser specific code. We have added below listener and using audio.play() for sound notification.
useEffect(() => {
// audio.addEventListener('ended', () => audio.pause())
document.body.addEventListener("mousedown",documentMouseDownHandler)
document.body.addEventListener("keydown",documentMouseDownHandler)
document.body.addEventListener("touchstart",documentMouseDownHandler)
return () => {
// audio.removeEventListener('ended', () => audio.pause())
document.body.removeEventListener("mousedown",documentMouseDownHandler)
document.body.removeEventListener("keydown",documentMouseDownHandler)
document.body.removeEventListener("touchstart",documentMouseDownHandler)
};
}, []);
Also in Mac Safari browser , we had the same issue with sound and we have enabled Auto play and it worked. According to the below reference , in iOS it is blocking the Auto play feature from version 11.0 Allowing Autoplay in Safari - Apple Community
Sound is working perfectly in Chrome browser for Android , Windows and Mac except iOS. Is it because of any security features which is blocking the audio ? Can you please help me to figure out the reason for this behavior?
@Aiswarya1794,
To clarify, are you saying you are trying to implement the above code on a page that is also hosting Web Chat but that the above code is separate from the Web Chat code? In other words, in a separate element/component from Web Chat located elsewhere on the page.
Or is it implemented within the Web Chat code as an action? For example, a hero card is displayed in Web Chat, click the 'Play' button on a hero card, and expect audio to play.
Hi Steven,
Thanks for the reply.
We have implemented within web chat code. Audio needs to be played every time when a message is received or when a card is displayed or when we click on the card.
Sound is played in Android, Windows and Mac but it's not working in any of the browser in iPhone.
Regards, Aiswarya R
From: Steven Kanberg @.> Sent: Wednesday, September 21, 2022 2:32 AM To: microsoft/BotFramework-WebChat @.> Cc: Aiswarya1794 @.>; Mention @.> Subject: Re: [microsoft/BotFramework-WebChat] Sound don't play on chatbot web application in ios browser. (Issue #4419)
@Aiswarya1794https://github.com/Aiswarya1794,
To clarify, are you saying you are trying to implement the above code on a page that is also hosting Web Chat but that the above code is separate from the Web Chat code? In other words, in a separate element/component from Web Chat located elsewhere on the page.
Or is it implemented within the Web Chat code as an action? For example, a hero card is displayed in Web Chat, click the 'Play' button on a hero card, and expect audio to play.
— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/BotFramework-WebChat/issues/4419#issuecomment-1252908628, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2ERBVKMAWXHFUB3WNIOUDTV7IQ75ANCNFSM6AAAAAAQQW4J2Q. You are receiving this because you were mentioned.Message ID: @.***>
@Aiswarya1794 - Thank you for your patience. Unfortunately, this issue is more of a "how to" than a bonified issue with Web Chat, itself (please see the below message). For this reason I will be closing it. However, if you submit this issue as a question on Stack Overflow with the 'botframework' and 'web-chat' tags, I'll see it and can attempt to help you there (in addition to the larger community).
The Microsoft Bot Framework team prefers that how to questions be submitted on Stack Overflow. The official Bot Framework-WebChat Github repo is the preferred platform for information on submitting bug fixes and feature requests.
@stevkan , I have already created a issue in stack overflow. Below is the link,
https://stackoverflow.com/q/73468486/19719983