Jump to content

Poweramp API Lib and Sample Applications (updated for v3)


Recommended Posts

The code is available here: https://github.com/maxmpz/powerampapi

Poweramp API Sample App is update to all recent PowerampAPI changes, they are pretty minor, except Album Art:

- album art now is not sent as bitmap within Intent
- original album art (embed - from track file itself, or cached downloaded album art) is provided via specific Poweramp Content provider

This allows hi-res images in apps utilizing PowerampAPI, but may require additional image processing (e.g. scaling / subsampling / etc. )

Link to post
Share on other sites
  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

poweramp_api_lib

This is not a sample, but it's actually the Poweramp API definitions (com.maxmpz.audioplayer.player.PowerampiAPI class), Poweramp content data source definitions (com.maxmpz.audioplayer.data package) and few helper classes. This is android library project, meaning it's included into other samples as a library (ensure it's added as library in Project settings => Android => libraries list).

Link to post
Share on other sites

poweramp_api_example

This is sample application utilizing Poweramp API, it consists of 4 activities:

MainActivity - provides basic, but pretty complete UI for Poweramp player functionality:

- current track info

- current track album art

- <<<, <<, >, >>, >>> buttons, with long press doing the same actions as in Poweramp (for <<, >, >>)

- shuffle/repeat buttons

- seekable song progress bar

- few buttons which calls various Poweramp actions, like opens Poweramp activities

- buttons to open other example activities

- simple testing buttons for Poweramp AA Widget functionality

[attachment=1]api_example.png[/attachment]

EqActivity - provides almost full control over Poweramp equalizer - 10 bands, 2 tone bands, preamp, presets (directly pulled from Poweramp database).

[attachment=0]api_example_eq.png[/attachment]

FoldersActivity - shows simple ListView of Poweramp folders. Provides example of how Poweramp folders database can be accessed.

FilesActivity - shows simple ListView of Poweramp files. Provides example of how Poweramp folders database can be accessed.

This project basically demonstrates that's ultimately possible to build complete custom Poweramp UI, but of course, you can utilize just few features from the complete set.

Link to post
Share on other sites

poweramp_api_lyrics_proto

This is prototype application utilizing Poweramp AA (Album Art) widget functionality. AA Widget is basically sort of app widget in Poweramp Album art area in main player screen. It's possible to display almost everything the app widget developer wants, and get user interaction events back in the app.

Poweramp manages multiple AA widgets internally and shows appropriate UI for them - Close button (which remembers it's state), and selectable icons to switch between AA widgets.

Example use of AA widgets are providing song lyrics, song extended information (e.g. pulled from internet), artist/album info, etc.

[attachment=0]api_example_lyr.png[/attachment]

Link to post
Share on other sites

Congrats, Very nice!

I've been expecting this for a while, now I can share my current tracks with my friends over Twitter or Facebook with Seesmic. Last night I used the Poweramp API in a simple app to expose the current track info for a simple sharing Intent.

Link to post
Share on other sites

Как добавить API в Eclupse? Что-то не получается. (Надеюсь то что я написал на русском не станет проблемой, ибо для русскоговорящих всего один маленький раздел)

Link to post
Share on other sites
  • 2 weeks later...
  • 3 weeks later...

I have been using this method (/system/usr/keylayouts/curcial-oj.kl):

key 272   MEDIA_PLAY_PAUSE WAKE_DROPPED

to play/pause Poweramp by trackpad on Froyo (desire) while screen was locked.

I just updated ROM to Gingerbread and the command above doesn't work with Poweramp anymore. Is there another "MEDIA_PLAY_PAUSE" for PA?

Link to post
Share on other sites

I have an app that works with many apps that all rely on the Android MediaStore. I see Poweramp supports that in addition to a more flexible storage model, but I want to start with the MediaStore support.

I had database IDs for songs, artists, albums and playlists as longs.

How do I prompt Poweramp to play a song (say) from the external SD card with a given database ID?

I tried this, and get nothing to happen and Poweramp does not indicate anything in the logfile:

protected void _playSong(Song song) {

Uri uri = Uri.withAppendedPath(

song.isInternal() ? MediaStore.Audio.Media.INTERNAL_CONTENT_URI : MediaStore.Audio.Media.EXTERNAL_CONTENT_URI ,

"" + song.mDatabaseId

);

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND)

.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)

.setData(uri)

);

}

Link to post
Share on other sites

I had added the library project as

Project properties->Build Path->Project

and was able to compile my code and run it (though it was not working fully). I went back and read your instructions that

This is android library project, meaning it's included into other samples as a library (ensure it's added as library in Project settings => Android => libraries list).

But this path of options does not appear to exist, or some detail is missing

Can you please write out exactly where these options live in Eclipse?

tone

Link to post
Share on other sites

localh0st

PowerAMP still processes headset MEDIA_* events as usual. Make sure no other apps intercepting/cancelling these messages before PowerAMP.

1.

 Please check comments in PowerAMPiAPI.java for OPEN_TO_PLAY command (around line 94).

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND).putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.OPEN_TO_PLAY)
.setData(Uri.parse("content://com.maxmpz.audioplayer/ALL/" + id)));

The code above will force PowerAMP to play file from All Files list, by song id. You can also force to play it from other lists.

Note that PowerAMP can play only from "external" storage.

ALL/ARTIST/ALBUM/ARTIST_ALBUM/GENRE_ALBUM categories are library categories - media store ids are expected.

FOLDER is special category - own ids namespace is used.

2. This setting looks this way (right click on project => Properties).

Of course you should have the poweramp_api_lib project first imported into Eclipse workspace.

Thanks!

Link to post
Share on other sites
localh0st

Poweramp still processes headset MEDIA_* events as usual. Make sure no other apps intercepting/cancelling these messages before Poweramp.

Thank you for your reply.

The stock music player (Sense UI) had respond first for the trackpad action.

I had only to enable in PA Settings > Headset Options > Respond to Headset Buttons to make it working again on GB ROM.

Link to post
Share on other sites
  • 2 weeks later...

Hey thanks for the API.

I am having a problem with the seek option -- instead of going to the selected spot in the song, the song starts over.

This also happens when using the API test file you provided.

Can you please let me know what I'm doing wrong?

Link to post
Share on other sites

Thanks for the report - I need to update the test app.

PowerAMP now uses milliseconds everywhere, previously API accepted seconds for seeking, so please multiply your seek values by 1000.

Link to post
Share on other sites
  • 5 months later...

Уважаемый администратор, в МакОс все аттачи и картинки представлены просто в виде текстовых тегов - проверял в Сафари и Хроме. Как еще можно закачать СДК?

Link to post
Share on other sites
  • 2 weeks later...

Уважаемый администратор, в МакОс все аттачи и картинки представлены просто в виде текстовых тегов - проверял в Сафари и Хроме. Как еще можно закачать СДК?

Видимо, после смены форума ссылки не починили. Вот сдк.

Ищется обновление под вторую версию плеера, т.к текущий работает не совсем корректно.

Link to post
Share on other sites

Hi,

I just noted that from version 2.0, the OPEN_TO_PLAY API command doesn't works any more (it is like the intent-filter has been changed in Poweramp 2.0, as the intent isn't resolved by PackageManager.resolveService(...) ).

There are some changes needed to use the OPEN_TO_PLAY API command in Poweramp 2.0?

I ask this because my app is used by users to select a song, an artist, an album or a playlist to play, and than it launch Poweramp with what the user selected, and this upgrade simply broke my app integration.

Thank,

Luca.

PS: Sorry for my bad english.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...