Ionic framework Ionic 4:bgImage未显示在StreamingAudioOptions上
我试图创建一个应用程序使用离子4,基本上只是流音频源从远程服务器。虽然我在StreamAudioOptions中使用了bgImage,但一切都正常,但我还是得到了一个黑屏。我的bg图像位于src/assets/bg.png中 我尝试了以下对图像的引用:Ionic framework Ionic 4:bgImage未显示在StreamingAudioOptions上,ionic-framework,ionic4,ionic-native,Ionic Framework,Ionic4,Ionic Native,我试图创建一个应用程序使用离子4,基本上只是流音频源从远程服务器。虽然我在StreamAudioOptions中使用了bgImage,但一切都正常,但我还是得到了一个黑屏。我的bg图像位于src/assets/bg.png中 我尝试了以下对图像的引用: /assets/bg.png assets/bg.png ./assets/bg.png ../../assets/bg.png 这是我的密码: import { StreamingMedia, StreamingAudioOptions }
/assets/bg.png
assets/bg.png
./assets/bg.png
../../assets/bg.png
这是我的密码:
import { StreamingMedia, StreamingAudioOptions } from '@ionic-native/streaming-media/ngx/';
playAudio() {
this.platform.ready().then(() => {
if (this.platform.is("cordova"))
{
let options : StreamingAudioOptions = {
bgImage: "/assets/bg.png",
bgColor: "#fff",
bgImageScale: "stretch",
successCallback: () =>
{
console.log("Successfully played audio");
},
errorCallback: (e) =>
{
console.log(e);
}
};
this.streaming.playAudio(this.mp3.url, options);
}
else
{
console.log("Must be on a mobile device to play!");
}
});
}
感谢您的帮助。谢谢 我把ref改成了“www/assets/bg.png”
import { StreamingMedia, StreamingAudioOptions } from '@ionic-native/streaming-media/ngx/';
playAudio() {
this.platform.ready().then(() => {
if (this.platform.is("cordova"))
{
let options : StreamingAudioOptions = {
bgImage: "www/assets/bg.png",
bgImageScale: "stretch",
successCallback: () =>
{
console.log("Successfully played audio");
},
errorCallback: (e) =>
{
console.log(e);
}
};
this.streaming.playAudio(this.mp3.url, options);
}
else
{
console.log("Must be on a mobile device to play!");
}
});
}