我有一个抽认卡应用程序,其中会根据相应的单词播放音频文件。该应用程序可在iOS模拟器中顺利运行,但是当我在第14个文件的android设备中启动该应用程序时,音频文件停止初始化并且未创建声音。当我返回以前创建的声音时,会播放该声音。应用中使用的音频文件有限制吗?我的音频文件介于3-5kb之间,我一共喜欢200个。我将所有音频文件保留在声音文件夹中。提前谢谢
const TNSPlayer = require("nativescript-audio-player").TNSPlayer;
function Word(word, image,audio){
this.word=word;
this.image=image;
this.audio=audio;
}
var words=[
new Word("aaaa","res://aaaa","~/sounds/aaaa.mp3"),
new Word("bbbb","res://bbbb","~/sounds/bbbb.mp3"),
……………………………………………………
……………………………………………………
.
.
.
]
function change_Next(args){
var page=args.object;
var current_word=new observable.fromObject({
word:words[index].word,
image:words[index].image,
});
page.page.bindingContext=current_word;
playSound();
}
function change_Prev(args){
var page=args.object;
var current_word=new observable.fromObject({
word:words[index].word,
image:words[index].image,
});
page.page.bindingContext=current_word;
playSound();
}
function playSound(){
const player = new TNSPlayer();
player
.playFromFile({
audioFile: words[index].audio,
loop: false
})
.then(() => {
player.play();
});
}
function onTap_Audio(args){
playSound();
}
exports.onTap_Audio=onTap_Audio;