Skip to main content

Xlet restart

5 replies [Last post]
Joined: 2010-05-11

Hi guys,

I have 2 movies, one is for background loop(let's call it "loop") and the other is for the actual show.(let's call it "movie")

and there is a menu on top of the "loop".

and when a viewer activates "play movie" menu item, then the "loop" stops and the "movie" starts.

what I want to do here is to go back to the loop+menu(which basically is a TopMenu) when the movie hits the end.

for now, nothing happens when the movie is over.

I think EndOfMediaEvent must have something to do with this.

but can't figure out how I can make it happen.

any idea? anyone?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-06-02

As per my understand you have problem in getting EndOfMediaEvent event,

As i found some of the player will not give EndOfMediaEvent event properly so its better to hard code total media time and do polling for end of media time.

Message was edited by: venkatnani08

Joined: 2010-05-11

Thank you venkatnani,

but I have no problem with getting EndOfMediaEvent event.

maybe I wasn't specific enough.

the problem I have is I don't know how to bring the TopMenu back on EndOfMediaEvent event.

for example, I have a Xlet class that has a HScene object and HTextButton objects

and I have a VideoPlayer class that handles video playbacks.

in the Xlet class, an object of VideoPlayer is created and added to HScene object.

I could make the loop by starting the player again on EndOfMediaEvent event.

player.addControllerListener(new ControllerListener() {
public void controllerUpdate(ControllerEvent e) {
if (e instanceof EndOfMediaEvent) {

so, I thought the same logic can be applied to bringing back the topmenu.

but so far, not very successful.

hope I can see a source code of a near-commercial level project so that I can learn from it.

anyway thanks again venkatnani.

Joined: 2004-02-13

Hi ftorres,

To start the top menu title, do a title select on the right bd:// locator. I think it's bd://0 or bd://ffff; maybe the latter? I always get confused by this and have to look it up, because of the whole title_id vs. title_number off-by-one thing, and because I'm never sure which is top menu and which is first play.

Joined: 2010-05-11

Thank you bill,

I think the title number for first play is "-1" and top menu is "0"

however, selecting the top menu title and starting a new player with the selected title thing didn't work.

here's the code

private class MenuHandler implements ControllerListener {
public void controllerUpdate(ControllerEvent event) {
if (event instanceof EndOfMediaEvent) {
player = null;
BDLocator bdLocator = new BDLocator("bd://0");
MediaLocator mediaLocator = new MediaLocator(bdLocator);
player = Manager.createPlayer(mediaLocator);
} catch (NoPlayerException e)
} catch (IOException e)
} catch (InvalidLocatorException e)

with the above code, I get the following message


as a result of


but nothing happens on the video pane

and I read from a japanese bd-j developers' website( that setting a title number has no effect while setting a playlist number works.

I should dig into it more and hopefully get back to this thread to update the result.

Thank you for the advice,


Message was edited by: ftorres10

Joined: 2004-02-13

Hi Sean,

I don't think you can change the title using MediaLocator and JMF's createPlayer(). Rather, you have to use Java TV's ServiceContext and service selection. In BD-J, there's an org.blu-ray subclass of ServiceContext called TitleContext; you might as well use that one, since the title select method has an extra flag that's needed for VFS updates.

In the cookbook repository, you can find examples of TitleContext in a few places, for example, ./xlets/hdcookbook_discimage/bookmenu/src/com/hdcookbook/bookmenu/menu/ has:

ServiceContextFactory scf = ServiceContextFactory.getInstance();
titleContext = (TitleContext)scf.getServiceContext(xletContext);
titleContext.start(title, false);

Good hunting!