Skip to main content

Audio and Subtitle Changes

1 reply [Last post]
bddeveloper
Offline
Joined: 2008-01-14

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
markkurvers
Offline
Joined: 2008-07-04

You can be notified of key presses by implementing the UserEventListener interface and creating a new UserEventRepository to which you add the keys that you want to receive events of. Then after registering your class and UserEventRepository in the EventManager, you should receive key events.

I think the following piece of code might be usefull:

public class MyXlet implements Xlet, UserEventListener
{

public void registerToKeyEvents()
{
UserEventRepository uer = new UserEventRepository("KeyListener");
uer.addAllArrowKeys();
uer.addAllNumericKeys();
uer.addKey(HRcEvent.VK_STOP);
// Add any other keys you want to listen to here, such as HRcEvent.VK_SUBTITLE

EventManager.getInstance().addUserEventListener(this, uer);
}

public void unregisterFromKeyEvents()
{
// Call this fro destroyXlet orso..
EventManager.getInstance().removeUserEventListener(this);
}

// To implement UserEventListener
public void userEventReceived(UserEvent ue)
{
if (ue.getType() == HRcEvent.KEY_PRESSED)
{
// Function that's gonna handle key presses
handleKeyPress(ue.getCode());
}
}

}

This should work for the subtitle button (not tested myself), but I haven't found any virtual key for the audio button (so not sure if your BD-J Xlet can be notified of an audio button keypress.

Message was edited by: markkurvers