- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have spent the last 7 hours trying to figure this one and nothing seems to work.
I'm trying to get some audio bg music playing and nothing works. I have used wav, ogg and mp3. I have also used the cordova media plugin, the intelxdk audio and Player plugins and nothing works. The only think that seems to work in html5 audio tags but I don't want that because it continues to play when the app is minimized.
Can someone please please post the simplest way to get music play when the app loads.
This is the last thing that I tried. music is in the same folder as index.html, using cli 5.1.1
function onAppReady() {
if( navigator.splashscreen && navigator.splashscreen.hide ) {
navigator.splashscreen.hide() ;
var media = new Media("music.ogg");
media.play();
}
}
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I might add that I compiled the sample audio player and it works but I cant make heads or tail of the code, I wish that they would make the code simple and easy to understand. My JS skills are very basic and when I see all kinds of crazy coding my brain just turns off. So if you are gonna post some help can you please make is simple and strait forward? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using the "hello-cordova" sample to see how to use the media plugin to play audio. It has many comments and is structured to make the code easier to understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah I tried that to no avail. i just don't understand it. My JS is VERY basic. Can anyone please tell me why that code I have there in my first post isn't working? Isn't that the basic requirements to get music playing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably because the media function cannot find the file. Please see the sample I provided, it handles this. How you locate the file is a function of the platform, thus the reason it's more complex in the example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page