UniApp createInnerAudioContext 踩坑記錄


uniapp api 文檔中 可使用 uni.createInnerAudioContext()  進行音頻播放

為便於測試,截取了一段網上音頻:https://www.widex.com.cn//-/media/components/domain/hearingtest/audio/cn/speechinnoise/stereo/4.mp3

使用 :

let music = uni.createInnerAudioContext(); //創建播放器對象
music.src= 'https://www.widex.com.cn//-/media/components/domain/hearingtest/audio/cn/speechinnoise/stereo/4.mp3'; //選擇播放的音頻
music.play(); //執行播放

  

播放成功。

但是在自有服務 上添加的音頻文件 地址:https://xxxxxx/xxx/voice/mp3/1609320354177.mp3

使用如上代碼,無法播放音頻文件。

偶然使用 釘釘打開該地址時,提示 SSL Error (Invalid CERT Authority)。變更文件 Https -> Http 后,可正常播放。

自有服務的域名 是從 TrustAsia 申請的證書。

而上面成功的 Https 音頻網站證書為 GeoTrust 證書。

問題原因可能為 證書問題,暫替換 https 為 http 解決當前問題。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM