离子2本机音频在Android上没有声音
我在爱奥尼亚创建了一个简单的应用程序,它使用本机音频播放单个MP3文件。守则:离子2本机音频在Android上没有声音,android,audio,ionic2,Android,Audio,Ionic2,我在爱奥尼亚创建了一个简单的应用程序,它使用本机音频播放单个MP3文件。守则: export class MyApp{ constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private nativeAudio:NativeAudio) { platform.ready().then(() => { // Okay, so the platform is
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);
}
)
});
}
}
我使用Android 6.0在我的Sony Xperia设备上运行这个
ionic cordova run android --device
警报消息将首先显示“ok”,它将等待,然后显示消息“done”。但是没有声音。MP3文件工作正常。可能是什么问题?可能是命令中未包含cordova API 而是键入此命令
ionic cordova run android --emulator
或
可能您的命令中不包含cordova API 而是键入此命令
ionic cordova run android --emulator
或