Play Tizen notification audio file

In the Tizen app, I want to play the audio file when the notification is published, and I wrote the code below.

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);
     }
}

The ab.mp3 file is located in the same folder with the js file. But he does not reproduce this sound. Can anyone help?

+4
source share
1 answer

If it is in the js folder, the path should be:

soundPath : "js/ab.mp3"

The reason that the default path is the "project root" folder, you need to add the name of the resource folder, as is done in index.html:

<script src="js/main.js"></script>
0
source

All Articles