DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

JMFPlayer.java

01.14.2010
| 2423 views |
  • submit to reddit
        Das ist einfach der JMF Player (in dem fall ein Processor) Hier ist die Grundlage meineS Problems :) Es will einfach nicht gleich arbeiten mit Main.fx - Main.java

import java.io.IOException;
import javax.media.*;
public class JMFPlayer {
public Processor player = null;
public MediaLocator ml;

public JMFPlayer() {
        init();
}
public void init() {

        try {
            //Pfadangabe Bitte zum testen aendern.
            ml = new MediaLocator("file:D://Videos//test_video.mpg");
            System.out.println("Initialisiere Processor");
            Manager.setHint(Manager.LIGHTWEIGHT_RENDERER,(true));
            player = Manager.createProcessor(ml);
            
            if(player.getState()!=player.Configured){
                System.out.println("Konfiguriere Processor");
                player.configure();
            }
            int i = 1;
            while(player.getState()==player.Configuring){
                //war nur um Fortschritt festzustellen.
                //System.out.println("Configuring "+i);
                //i++;
            }
            System.out.println("Processor Konfiguration abgeschlossen");
            player.setContentDescriptor(null);

            if(player.getState()!=player.Realized){
                System.out.println("Realisiere Processor");
                player.realize();
            }
            i = 1;
            while(player.getState()==player.Realizing){
                //war auch nur um FOrtschritt zu sehen...
                //System.out.println("Realizing "+i);
                //i++;
            }
            System.out.println("Processor Realisierung abgeschlossen");
            System.out.println("Gefundene Visuelle Componente "+player.getVisualComponent());
            System.out.println("Wenn null dann gabs nix.");
            player.start();


            //player.start();
        } catch (IOException ex) {
            System.out.println("IO Exception "+ex);
        } catch (NoProcessorException ex) {
           System.out.println("Kein Processor "+ex);
        }
}

}