简体   繁体   English

如何使用蓝牙设备播放 web 音频

[英]How play web audio with bluetooth devices

I programmmed a website which uses text to speech engine to generate audio files.我编写了一个使用文本到语音引擎生成音频文件的网站。

Then these mp3 files are started using Web Audio API.然后使用 Web Audio API 启动这些 mp3 文件。

Everything works fine when hearing aufio from speakers on a computer or on a smart phone.从计算机或智能手机上的扬声器中听到 aufio 时,一切正常。

However, as soon as I connect my bluetooth helmet to the smart phone, the audio is not played.但是,一旦我将蓝牙头盔连接到智能手机,就不会播放音频。

Is it a famous issue that Web Audio API doesn't work with bluetooth devices, or does the issue come from my code? Web Audio API 不适用于蓝牙设备是一个著名的问题,还是这个问题来自我的代码?

Do I need to change the context's destination?我需要更改上下文的目的地吗? How can I set it to buetooth?如何将其设置为蓝牙? (ex: https://www.html5rocks.com/en/tutorials/webaudio/intro/ ) (例如: https://www.html5rocks.com/en/tutorials/webaudio/intro/

source.connect(context.destination); // connect the source to the context's destination (the speakers)

This question has already been posted on stackoverflow, but I can't find an answer.这个问题已经发布在stackoverflow上,但我找不到答案。

Please help me.请帮我。

Hi use the web bluetooth library for more reference read this here您好使用 web 蓝牙库以获得更多参考,请在此处阅读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM