Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 70
Registered: ‎09-05-2012
My Device: Z10 Red, PlayBook, DevAlpha C
My Carrier: Play

Mediacontroller - need help

Hi,

I  try to build a native extension for WebWorks app (BB10) to retrieve some metadata from audio files, unfortunately I don't know C++.

Following code:

string Metamuz::getMetamuz() {
	bps_initialize();
	mediacontroller_request_events(0);
	bps_event_t *event;
	mediacontroller_play_pause();
	return "PlayPause";
}

 give me possibility to Play and Pause media player. This is not necessary because HTML5 have built-in appropriate feature.

 

I need to retrieve metadata_album, metadata_artist and metadata_album_artwork. It seems to be easy but when I tried to write:

string Metamuz::getMetamuz() {
	bps_initialize();
	mediacontroller_request_events(0);
	bps_event_t *event;
	mediacontroller_event_get_metadata_album_artwork(event);
	return event;
}

 compiler return error message:


could not convert 'event' from 'bps_event_t*' to 'std::string {aka std::basic_string<char, std::char_traits<char>, std::allocator<char> >}'

I don't know what to do.

May be someone can help me ?

Thank you in advance

Highlighted
BlackBerry Development Advisor
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: Mediacontroller - need help

[ Edited ]

mediacontroller_play_pause() sends a command to the Media Controller BPS services to toggle between Play and Pause.

 

mediacontroller_event_get_metadata_album_artwork() is a different kind of function.  Once you receive a bps_event_t you determine what kind of event it is by looking at its domain and code.  If it is an event with the Media Controller domain and the Metadata code, then you can use mediacontroller_event_get_metadata_album_artwork() to extract the path to the album artwork.

 

The thing is, I don't know how to integrate a BPS event loop into a native extension for WebWorks so that you receive bps_event_t events.

 

More information on how to use BPS is at:

 

http://developer.blackberry.com/native/beta/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_re...

 

It seems the WebWorks API for playing media is at

 

https://developer.blackberry.com/html5/apis/blackberry.audio.player.html

 

but it doesn't seem to have support for album artwork.