Bonjour a tous, membres de forum developpez.net

MON PROBLEM :

J'ai essaie de se connecter a ma webcam integré a l'aide de API JMF mais une message d'erreur survient :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Unable to handle format: YUV Video Format: 
Size = java.awt.Dimension[width=640,height=480] MaxDataLength = 614400 DataType = class [B yuvType = 32 StrideY = 1280 StrideUV = 1280 OffsetY = 0 OffsetU = 1 OffsetV = 3
 
Failed to realize: com.sun.media.PlaybackEngine@f5da06
javax.media.NotRealizedError: Cannot get visual component on an unrealized player    .......
VOILA LE CODE :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class Webcam {
 
    Player player;
    DataSource ds;
    MediaLocator mediaLocator;
    private  YUVFormat format;
 
    public Webcam(){
        try {
            // récupération d'un périphérique à partir de son nom
            CaptureDeviceInfo captureDevice = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");
            // récupération du MediaLocator lié au périphérique de capture
            mediaLocator = new MediaLocator("vfw://0");
 
            // récupération d'une datasource à partir d'un MediaLocator
            ds = Manager.createDataSource(mediaLocator);
            // connexion sur la DataSource
            ds.connect();
 
            // connexion d'un player sur la datasource
            player = Manager.createPlayer(ds);
// ERROR Dans Le code WebCam
 
            format = new YUVFormat(new Dimension(640, 480), 614400,new BYTE_ARRAY("video/x-raw-yuv").getClass(), (float) 15.0,32, 1280, 1280, 0,1, 3);
            player.realize();
 
        } catch (Exception ex) {
            Logger.getLogger(Webcam.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
    public void start() {
        JFrame frame = new JFrame();
        // ajoute le composant visuel lié au player
        frame.getContentPane().add(player.getVisualComponent());
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.player.start();
    }
 
    public void stop() {
        this.player.stop();
    }
 
    public static void main(String arg[]){
    Webcam wc = new Webcam();
    wc.start();
    }
}
Merci d'avance