Search code examples
botframeworksharepoint-online

How to enable speech function on Webchat channel in a modern SharePoint Online page?


I made a chatbot that has speech capabilities, I tested in the emulator and it works great. However, after deployment, I noticed that the webchat channel doesn't have it enabled. I have the webchat embedded in a modern SharePoint Online site and from what I've searched in the Internet, most answers talk about modifying the HTML and using JavaScript, which apparently is not easy to do in this modern framework that Microsoft has according to articles.

So in the end, how can I enable the speech feature in the webchat channel that is embedded inside a modern SharePoint site page?


Solution

  • I believe there are a couple things going on here. First, it is an issue with Cross Origin. I'll come back to that in a minute. Secondly, assuming you are using the Browser-provider speech service, that that means you are using Chrome (let me know if that is not the case). The microphone use in iframes was depricated for cross origin. You can change that by adding allow='microphone' attribute to your iframe tag. Please see more here.

    I was able to get it working in a simple iframe, outside SPO and using Cross-Origin Resource Sharing. The unfortunate part is that you won't be able to add CORS to your SharePoint Online site for the embed web part.

    You might look at using Bing or custom speech services. Otherwise, I think your options are limited to custom pages/parts/app/add-in for SharePoint (if even then).

    Edit: Looks like Bing Speech is being deprecated.