var playback = (function() {
var soundElement;
var counter = 1;
+ var soundPathArray = ['/usr/share/feedback/sound/operation/operation.wav', '/usr/share/feedback/sound/operation/back.wav'];
+ var soundPathCount = 0;
function win(v) {
+ console.log('Success to get the notification sound: ' + v);
soundElement = new Audio(v);
soundElement.addEventListener('ended', function() {
if (--counter > 0) {
console.error('Failed to get the notification sound: ' + e);
}
+ function recursiveFailCallback(e) {
+ fail(e);
+ console.warn("Retry with another path");
+
+ if(soundPathCount >= soundPathArray.length){
+ console.error('Failed to get the notification sound: There is no available sound file path');
+ return;
+ }
+
+ tizen.filesystem.resolve(soundPathArray[soundPathCount++], function(file) {
+ win(file.toURI());
+ }, recursiveFailCallback, 'r');
+
+ }
+
if ('tv' === tizen.systeminfo.getCapability('http://tizen.org/feature/profile').toLowerCase()) {
- tizen.filesystem.resolve('/usr/share/feedback/sound/operation/operation.wav', function(file) {
+ tizen.filesystem.resolve(soundPathArray[soundPathCount++], function(file) {
win(file.toURI());
- }, fail, 'r');
+ }, recursiveFailCallback, 'r');
} else {
tizen.systemsetting.getProperty('NOTIFICATION_EMAIL', win, fail);
}