1
ネイティブオーディオを使用して単一のMP3ファイルを再生する簡単なアプリをIonicで作成しました。コード:Ionic 2ネイティブオーディオAndroidで音が聞こえない
export class MyApp{
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private nativeAudio:NativeAudio) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.nativeAudio.preloadComplex('24', 'assets/klamydihahaha.mp3',1,1,0.1).then(
(data)=>{
alert(data);
this.nativeAudio.play('24',()=>{alert("done")});
},(error)=>{
alert(error);
}
)
});
}
}
私は警告メッセージが最初に「OK」が表示されます、それが待機すると、メッセージ「完了
ionic cordova run android --device
を使ってAndroidの6.0と私のソニーのXperiaデバイス上でこれを実行します"が表示されます。しかし、音はありません。 MP3ファイルは正常に動作します。何が問題なの?