問題描述
從 WebAPI 在瀏覽器中播放 WAV 文件 (Play WAV file in Browser from WebAPI)
我有一個挑戰。我需要向用戶提供音頻以在網絡瀏覽器中收聽。
所以,我試圖開始解決方案。將音頻文件 (WAV) 提供給 html 音頻標籤播放的最佳方式是什麼?
問題是,當我將其作為 url 發送時,我認為客戶端應該首先需要下載所有內容,然後開始播放。我在想一些在下載數據時會運行的東西,比如流。
你有從哪裡開始的想法嗎?
我在想 Google Drive 附近的東西:
https://docs.google.com/uc ?export=download&id={GUIDFromFileFromGoogleDrive}<
參考解法
方法 1:
The thing is that when i send it as an url, i believe that the client should need first download all the content, and then start to play.
No, this is incorrect.
I was thinking something which will run while the data are downloaded, something like a stream.
That's how it works.
<audio src="https://example.com/your‑stream.wav" controls />