Home Updating JamendoFM for Android
Post
Cancel

Updating JamendoFM for Android

I just got new phone Samsung Galaxy S4 and I noticed that the JamendoFM can not play music on it. I’m sure that it worked with some older Android phones, but it turns out that it doesn’t work with the new ones.
The problem is somehow related to the radiocontrols. Settings the audiosource, and programatically pressing play doesn’t seem to work with Android anynmore so I changed that stuff into Audio object, which seem to be working pretty well with new Androids.
Here’s my changes with the audio:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
   /*the old code that doesn't work*/
   /*
    var audio = $("#radiocontrols");
    $("#radiosource").attr("src", sourceUrl);
    audio[0].pause();
    audio[0].load();
    audio[0].play();*/
    //lets do it with Audio object
    try {
    g_myaudio = new Audio(sourceUrl);
    g_myaudio.id = 'playerMyAdio';
    g_myaudio.play();
   } catch (e) {
    alert('no audio support!');
  }

I also added the permissions for the lockscreen so the music will continue to play even when the lockscreen is on. The lockscreen permissions can be added though config.xml (phonegap) like this:

1
2
3
   <gap:config-file platform="android" parent="/manifest">
      <uses-permission android:name="android.permission.WAKE_LOCK" />
   </gap:config-file>
This post is licensed under CC BY 4.0 by the author.

Samsung SmartTV and 802.11n

JamendoFM is now featured at Firefox Marketplace

Comments powered by Disqus.