Collen L
Collen L

Reputation: 21

Codename One Background Music Playback

I have challenges of playing background music in my Codename One application. Can Someone who's familiar with this feature help me with a Java code example in Codename One?

Upvotes: 2

Views: 128

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

See the background music section in the developer guide:

Codename One supports playing music in the background (e.g. when the app is minimized) which is quite useful for developers building a music player style application.

This support isn’t totally portable since the Android and iOS approaches for background music playback differ a great deal. To get this to work on Android you need to use the API: MediaManager.createBackgroundMedia().

You should use that API when you want to create a media stream that will work even when your app is minimized.

For iOS you will need to use a special build hint: ios.background_modes=music.

Which should allow background playback of music on iOS and would work with the createBackgroundMedia() method.

Upvotes: 1

Related Questions