JMF Player DRIVING ME CRAZY!



I'm programming a WinAmp-like app but have become totally stuck. Any advice
would be greatly appreciated.

Basically I need a class to manage the playlist. It should iterate over the
playlist and for each track create a Player, wait for an EndOfMediaEvent,
create a Player for the next track and so on. Not too difficult I thought!

But I can't get the player to deallocate/close when the EndOfMediaEvent
event is thrown, so after 2 or 3 tracks I get 'out of memory!'. If I use
some sort of 'blockUntilClose()' method it waits indefinately and is never
notified by the ControllerListener's 'instanceof EndOfMediaEvent' (because
the listener has been added to the player I guess)

I've found loads of examples of code where the ControllerListener's
'instanceof EndOfMediaEvent' sets the media time to 0 and starts it again,
but how can I deallocate and move onto the next track? The player closes
fine when an external event (like clicking the stop button) asks it to. So I
guess I need a similar external event to be triggered by EndOfMediaEvent,
but how?

I guess the answer is very simple, and expect derisive replies. But for the
sake of my sanity could you please point me in the right direction?


.


Quantcast