如何用firefox操作系统在后台播放音频?

Cho*_*oiZ 7 audio permissions lockscreen html5-audio firefox-os

在我的清单文件中,我添加了权限中的音频通道内容:

"permissions": {
    "audio-channel-content":{"description":"Use the audio channel for the music player"}
}
Run Code Online (Sandbox Code Playgroud)

在我的index.html中,我有一个音频标签,如:

<audio mozaudiochannel="content" preload="none" src="http://my-stream-url"></audio>
Run Code Online (Sandbox Code Playgroud)

我可以在2mn期间播放我的音频流:

  • 手机解锁时的第一个.
  • 1mn后,我的手机会自动锁定屏幕并继续播放一分钟.

在锁定后,是否可以播放超过1mn的音频流?

提前致谢.

Ara*_*ras 0

您拥有的代码和权限块是正确的,我可以确认它在 Firefox OS 1.1 中工作。您还可以在 Javascript 中完成整个操作:

audio = new Audio();
audio.preload = 'none';
audio.mozAudioChannelType = 'content';
Run Code Online (Sandbox Code Playgroud)