Skip to main content

Change playlist

9 replies [Last post]
em_pleh
Offline
Joined: 2008-12-12

i have the fallowing code to start playing a playlist but how can i change the playlist while its playing?

BDLocator bdLocator = new BDLocator("bd://PLAYLIST:0000"+playlist+".MARK:"+markID);
MediaLocator mediaLocator = new MediaLocator(bdLocator);

player = Manager.createPlayer(mediaLocator);
player.prefetch();
player.start();

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joe Rice

Haven't looked all the way through, but it looks like you're short one
digit in the playlist value. E.g. use 00000 instead of 0000.

Also, the rate setting shouldn't be necessary, but the start should be
uncommented. setRate won't have an effect on a stopped player.

Joe

On Apr 16, 2009, at 7:20 PM, bd-j-dev@mobileandembedded.org wrote:

> Still no luck, that did not help i still get a black screen
>
> playListChangeControl =
> (PlayListChangeControl
> )player.getControl(PlayListChangeControl.class.getName());
> if (playListChangeControl != null)
> {
> player.setRate(0);
> player.stop();
> BDLocator bdLocator = new BDLocator("bd://PLAYLIST:
> 0000"+playlist+".MARK:"+markID);
> playListChangeControl.selectPlayList(bdLocator);
> player.setRate(1);
> //player.start();
> }
> [Message sent by forum member 'em_pleh' (em_pleh)]
>
> http://forums.java.net/jive/thread.jspa?messageID=342513
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
> For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net

em_pleh
Offline
Joined: 2008-12-12

playlist is a variable that completes the playlist id. I have seem to hit a wall there is no way to change the playlist without a black screen if someone finds a way let me know.

Joe Rice

The background plane is always shown when the JMF player is stopped.

You can look at combining your video into a single PlayList (skips
within PlayLists happen without showing the background plane) or you
can also put an image or color into the background plane to be seen
instead of black.

Cheers,
Joe

On Apr 20, 2009, at 10:48 AM, bd-j-dev@mobileandembedded.org wrote:

> playlist is a variable that completes the playlist id. I have seem
> to hit a wall there is no way to change the playlist without a black
> screen if someone finds a way let me know.
> [Message sent by forum member 'em_pleh' (em_pleh)]
>
> http://forums.java.net/jive/thread.jspa?messageID=342895
>

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net

mico88
Offline
Joined: 2008-01-24

Hi,

you should use jmf playListChangeControl ...

PlayListChangeControl playListChangeControl;
...
playListChangeControl.selectPlayList(bdLocator);
player.start();

I think, the player has to be in stop state first...
And all player state changes are asynchronous, so you should wait for stop state.
player.start() will automatically do prefetch as well if needed, so I believe only start() is enough (prefetch and start doesn't make sense for me due to asynchronous behavior...).
Please anybody correct me if it is not exact explanation...

hope this help

~mirek

szmarine
Offline
Joined: 2008-06-13

Calling start() is enough in that case. But I'm not sure all player state transition are async. For example, stop(), which is inherited from javax.media.Clock, may need to be sync.

em_pleh
Offline
Joined: 2008-12-12

If I do a stop then they will see a black screen. is there any way to avoid this?

szmarine
Offline
Joined: 2008-06-13

Try setRate(0), this should function like a pause. And setRate(1) to resume.

em_pleh
Offline
Joined: 2008-12-12

Still no luck, that did not help i still get a black screen. If you do not do player.stop you will get a exception.

playListChangeControl = (PlayListChangeControl)player.getControl(PlayListChangeControl.class.getName());
if (playListChangeControl != null)
{
player.setRate(0);
player.stop();
BDLocator bdLocator = new BDLocator("bd://PLAYLIST:0000"+playlist+".MARK:"+markID);
playListChangeControl.selectPlayList(bdLocator);
player.setRate(1);
//player.start();
}

szmarine
Offline
Joined: 2008-06-13

Oops! Sorry that I thought they were in different cases. Player must be in Stoped stated before calling selectPlayList(), or you got exceptions :(