Software Archive
Read-only legacy content
17061 Обсуждение

How to Play Media mp3 Offline Intel XDK?

Adam_Suchi_Hafizulla
Начинающий
730Просмотр.

Hi everyone. I want to ask how to play media *.mp3 offline in Intel XDK?

My code:

var src = "sounds/music.mp3";
var my_media = new Media(src,
               // success callback
               function () {
                   alert("playAudio():Audio Success");
               },
               // error callback
               function (err) {
                  alert("playAudio():Audio Error: " + err.code);
               });

my_media.play({playAudioWhenScreenIsLocked : true });

And i already put the mp3 file to www path.

path.png

And when i run project, i got error number "1". But when i change source file to streaming radio, its working, but for the offline music its not working. Im using Media plugins version 2.4.0 and Cordova CLI version 5.4.1.

Thank for your help. :)

 

0 баллов
1 Решение
PaulF_IntelCorp
Сотрудник
730Просмотр.

Check the "hello cordova" sample app to see how it plays back a local media file. Locating the media file will vary depending on the platform. And don't use alerts to debug your apps, they tend to interfere with your program logic, use console.log messages, instead, they are much less intrusive on the runtime thread of execution.

Просмотреть решение в исходном сообщении

2 Ответы
PaulF_IntelCorp
Сотрудник
731Просмотр.

Check the "hello cordova" sample app to see how it plays back a local media file. Locating the media file will vary depending on the platform. And don't use alerts to debug your apps, they tend to interfere with your program logic, use console.log messages, instead, they are much less intrusive on the runtime thread of execution.

Adam_Suchi_Hafizulla
Начинающий
730Просмотр.

Paul F. (Intel) wrote:

Check the "hello cordova" sample app to see how it plays back a local media file. Locating the media file will vary depending on the platform. And don't use alerts to debug your apps, they tend to interfere with your program logic, use console.log messages, instead, they are much less intrusive on the runtime thread of execution.

 

Thank you Paul :)

Ответить