Skip to main content

Playing a sequence of video files

1 reply [Last post]
Joined: 2006-02-17

Dear all,

I'm trying to use JMF to play a sequence of video files, i.e. one after the other.

The program I have written creates multiple players, one for each video file. It then realizes and prefetches them all. Then the program starts the first player and on an EndOfMedia event, plays the next and so on.

The problem that I have is that on my Swing gui, it shows the first video but none of the rest, although you can hear the audio! Below is the code that is called on an EndOfMedia event to start the next player.

<br />
    private void nextInSequence() throws EndOfSequenceException {</p>
<p>        // Close Previous Players<br />
        if (current > 0)<br />
<p>        // No more clips in sequence<br />
        if (current >= clipPlayers.length)<br />
            throw new EndOfSequenceException();</p>
<p>        myVisual = clipPlayers[current].getVisualComponent();</p>
<p>           if (myVisual != null) {<br />
              visualPanel = new Panel();<br />
               visualPanel.setLayout(new FlowLayout());<br />
               visualPanel.add(myVisual);<br />
               add("Center",visualPanel);<br />
            }<br />
        else {<br />
            remove(status);<br />
               add("Center",status);<br />
               status.setText("No VisualComponent available.");<br />
<p>        validate();<br />
<p>        // start current player<br />
        clipPlayers[current].start();<br />
        current++;<br />
    }<br />

I have set the LIGHTWEIGHT_RENDERER hint for the manager. The nextInSequence() method shown above is in a class extending JPanel.

Anybody any ideas?

Many thanks,

Oli Gosling

Reply viewing options

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

Did you Try repaint();??
maybe the first player is ontop of the next??
need to somehow make sure that is not the case.

Try making very large Panel, add the players to the corners of the windows.

Are you useing a LayoutManager??