04-29-2011 05:39 PM
Playbook apps:
LPlayer
04-29-2011 05:40 PM
+1 - I would also love to know if I can hook these into my media app...
04-29-2011 06:26 PM - edited 04-29-2011 06:27 PM
I haven't tested this on a real device, but I'm pretty sure that what you want is MediaServiceConnection. Anytime you're playing media you should be using it, it has events for media controls which I believe will include both the top buttons and from the system tray icon. It also gives you the ability to report metadata so that the system tray media player control pop-up can display currently playing info.
04-29-2011 06:35 PM
Playbook apps:
LPlayer
04-30-2011 06:14 AM
Doesn't it just generate a keyboard event with keycode Keyboard.PLAY / Keyboard.PAUSE?
04-30-2011 06:10 PM - edited 04-30-2011 06:31 PM
OK It would appear that none of these are correct. I finally had a chance to get some debugging done on the device tonight and when instantiating the MediaServiceConnection and connecting the events aren't fired and none of the keyboard events seem to work on those buttons, anyone else have any ideas?
Playbook apps:
LPlayer
04-30-2011 08:58 PM
05-01-2011 02:11 AM - edited 05-01-2011 02:13 AM
OK I am doing this:
private function initMSC():void
{
var mc:MediaServiceConnection = new MediaServiceConnection();
mc.addEventListener(MediaServiceRequestEvent.TRACK _PAUSE, pauseClicked);
mc.addEventListener(MediaServiceRequestEvent.TRACK _PLAY, playClicked);
mc.connect();
}
private function pauseClicked(e:MediaServiceRequestEvent):void
{
//pause music
}
private function playClicked(e:MediaServiceRequestEvent):void
{
//play music
}
Playbook apps:
LPlayer
05-01-2011 02:34 AM
05-01-2011 08:50 AM
@shawnblais, or even a documented permission. (Well, not documented exactly when they're required, but there is that list... play_audio maybe?)
As for the MediaServiceConnection, I'm guessing more is needed to set things up. Wouldn't you expect to send some info with sendMetadata() first? Maybe add a check for hasAudioService() and/or canSendData()? Possibly also requestAudioService()?
I could picture the sequence being add listeners, connect(), get CONNECT event, requestAudioService(), get ACCESS_CHANGE event, do something with the send data stuff, and so on.
To troubleshoot such things, I always suggest adding listeners for all the events listed, with at least trace() calls. Then start experimenting and gradually add other stuff.