【发布时间】:2022-01-07 07:58:16
【问题描述】:
如标题所述,我在 Android 11 上使用 Titanium.Media.AudioPlayer 停止音频播放时遇到问题。我使用的是 Titanium SDK 10.1.0.GA。
它在 Android 版本 8 和 10(迄今为止我测试过的仅有的另外两个版本)上运行良好。
如果有帮助,这就是我初始化音频播放器(在 Alloy.Globals 中定义)的方式:
Alloy.Globals.player = Ti.Media.createAudioPlayer({
url: audioPath,
allowBackground: true,
audioFocus: true,
audioType: Ti.Media.Sound.AUDIO_TYPE_MEDIA
});
致电Alloy.Globals.player.stop(); 绝对没有任何作用。音频继续播放。
我应该怎么做才能让它在 Android 11 上运行?
编辑:这是我的播放器的输出,似乎甚至没有播放,这很奇怪:
[DEBUG] PLAYER: :{
[DEBUG] "volume": 1,
[DEBUG] "url": "file:///android_asset/Resources/audio/4.mp3",
[DEBUG] "muted": false,
[DEBUG] "time": 0,
[DEBUG] "audioSessionId": 0,
[DEBUG] "playing": false,
[DEBUG] "audioType": 0,
[DEBUG] "paused": false,
[DEBUG] "duration": 0,
[DEBUG] "apiName": "Ti.Media.AudioPlayer",
[DEBUG] "bubbleParent": true,
[DEBUG] "allowBackground": true,
[DEBUG] "audioFocus": true,
[DEBUG] "_events": {
[DEBUG] "complete": {}
[DEBUG] }
【问题讨论】: