在Tizen应用程序中,我希望在发布通知时播放音频文件,并且我已在下面编写代码。
function postNotification()
{
try {
var iconPath=tizen.application.getCurrentApplication().appInfo.iconPath;
var myappInfo = tizen.application.getAppInfo();
var myAudio = document.getElementById('myAudio');
var notificationDict = {
content : "Alarm Playing",
iconPath : iconPath,
soundPath : "ab.mp3",
vibration : true,
thumbnails : "icon.png",
ledColor : "#FFFF00",
ledOnPeriod: 10000,
ledOffPeriod : 5000 ,
appId : myappInfo.id };
var myNotification = new tizen.StatusNotification("SIMPLE", "Simple notification", notificationDict);
tizen.notification.post(myNotification);
} catch (err) {
alert(err.name + ": " + err.message);
}
}
文件ab.mp3与js文件位于同一文件夹中。但它没有播放那种音频。有人可以帮忙吗?
答案 0 :(得分:0)
如果它在js文件夹中,则路径应为:
Array ( [build] => Array ( [0] => Array ( [foo] => Array ( [1] => DONE ) ) ) )
因为默认路径是"项目根目录"文件夹,您必须添加资源的文件夹名称,如我们在index.html中所做的那样:
soundPath : "js/ab.mp3"