Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

LECTEUR VIDEO UTILISANT L'API JMF


Information sur la source

Catégorie :Api Classé sous : video, lecteur, api, jmf, player Niveau : Débutant Date de création : 13/07/2004 Vu / téléchargé: 23 390 / 4 739

Note :
7,33 / 10 - par 3 personnes
7,33 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (39)
Ajouter un commentaire et/ou une note

Description

Cliquez pour voir la capture en taille normale
J'ai utilise un code que j'ai trouve sur ce site et je l'ai modifie. J'ai rajoute plusieurs boutons et un slider...et c'est la mon probleme, je n'arrive pas a faire avancer le slider en meme temps que la video..... si qq'1 pouvait voir ca ce serait vraiment sympa...
                   ^_^
 

Conclusion

il y a des lignes de codes qui ne servent peut etre pas...
 

Fichier Zip

Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !
  •   Video Player
    •   videoPlayer
      •   icons
      •   video
      • MediaPlayer$1.classTélécharger ce fichier [Réservé aux membres club]836 octets
      • MediaPlayer$2.classTélécharger ce fichier [Réservé aux membres club]1 951 octets
      • MediaPlayer$3.classTélécharger ce fichier [Réservé aux membres club]1 401 octets
      • MediaPlayer$4.classTélécharger ce fichier [Réservé aux membres club]972 octets
      • MediaPlayer$5.classTélécharger ce fichier [Réservé aux membres club]1 175 octets
      • MediaPlayer$6.classTélécharger ce fichier [Réservé aux membres club]1 001 octets
      • MediaPlayer.classTélécharger ce fichier [Réservé aux membres club]7 101 octets
      • video_Player.javaTélécharger ce fichier [Réservé aux membres club]Voir ce fichier12 836 octets
    • .classpathTélécharger ce fichier [Réservé aux membres club]226 octets
    • .projectTélécharger ce fichier [Réservé aux membres club]388 octets

Télécharger le zip

Commentaires et avis

signaler à un administrateur
Commentaire de thierrytitix le 14/07/2004 16:15:43

ok désolé je voulais tester ce truc j avais jamais essayé . Voici une solution faite un peu à la va vite mais j espere que ca conviendra.
package videoPlayer;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
class MediaPlayer extends JFrame implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = true;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
    private JButton about = null;
    private CLSr csr = null;
    private Time duration = null;

    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        setTitle("Video Player"); // Sets the title for this frame to the specified string.
        getContentPane().setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */
        addWindowListener( new WindowAdapter() /* Adds the specified window listener to receive window events from this window */
         {    
         public void windowClosing( WindowEvent we ) /* Invoked when a window is in the process of being closed. The close operation can be overridden at
                 this point.*/
                 {
                 JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
                 /* Brings up a dialog that displays a message using a default icon determined by the messageType
                    parameter. */
                 System.exit(0); // Terminates the currently running Java Virtual Machine.
                 }
         }
        );
        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
}
private void validateSlider()
{
Time tm = duration;
  System.out.println("toto"+tm.getSeconds());
  slider.setMaximum(1160);
  slider.setMinimum(0);
//   creates a slider with the specified orientation and the specified minimum, maximum, and initial values
  
}

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("videoPlayer/icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("videoPlayer/icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("videoPlayer/icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("videoPlayer/icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("videoPlayer/icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //the buttons are add to the menu bar
         menu_bar.add(open);
         menu_bar.add(play);
         menu_bar.add(pause);
         menu_bar.add(stop);
         menu_bar.add(about);
System.out.println("validate");
Time tm = player.getDuration();
System.out.println(tm.getSeconds());
slider = new JSlider(JSlider.HORIZONTAL,0,(int)(tm.getSeconds()),0);
csr = new CLSr();
slider.addChangeListener(csr);

slider.setMajorTickSpacing(10); //This method sets the major tick spacing
slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
slider.setPaintLabels(false); //Determines whether labels are painted on the slider
slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
menu_bar.add(slider); //Appends the slider to the end of the menu bar

//to set the menu bar
setJMenuBar(menu_bar);

           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
slider.removeChangeListener(csr);
                         //modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == JFileChooser.APPROVE_OPTION)
                            {
                             file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
    player.start();
validateSlider();
slider.addChangeListener(csr);
                         }
                        }

                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
                             //player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                           Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
                           if (t > 0.0)
                           {
                             player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");        
                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                getContentPane().add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
videoPanel.add( vis, BorderLayout.CENTER);
                videoPanel.setVisible(true);
                this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    


    

    /************
     *   Main   *
     ************/
    public static void main( String[] args )
    {    // needs the address of a movie: *.avi,*.mpg...
     new MediaPlayer("videoPlayer/video/open.avi" ).setVisible( true );
    }
public class CLSr implements javax.swing.event.ChangeListener
{
public CLSr()
{
}
public void stateChanged(ChangeEvent e)
{
System.out.println("state");
float tm = slider.getValue();
System.out.println("value="+tm);
player.setMediaTime(new Time(tm));
}
}   }

signaler à un administrateur
Commentaire de Shamamatt le 14/07/2004 16:27:50

Merci de me proposer une solution...mais j'ai essaye et le slider n'avance pas...ca marche chez toi ? moi, il y a juste le nombre de traits qui varie celon la video ki est ouverte mais le slider reste a son point de depart qd la video se lance...j'ai pas le temps de me replonger la dedans pour l'instant...
encore merci...
a+

shamamatt

signaler à un administrateur
Commentaire de thierrytitix le 14/07/2004 17:02:40

oui ok c vrai la scroll n a pas l air de suivre mais neanmoins si tu la selectionne avec la souris ca va direct la ou tu veux dans le film.
Je regarde pour le scroll.

signaler à un administrateur
Commentaire de Shamamatt le 14/07/2004 18:07:21

ah oui j'avais pas vu ca...c bien !
c sympa de regarder pour le scroll... MERCI

signaler à un administrateur
Commentaire de thierrytitix le 14/07/2004 18:19:29

Bon ben voila je te livre le fichier corrigé avec un thread en plus pour bouger la barre ca a l air de marcher mais c de l approximatif , je debute en multithread.
C est aussi de l approximatif pour la barre de scroll qui ne devrait pas etre la representation exacte de la longueur du film mais plutot d'un multiple de cette longueur afin de faire un entier sinon la derniere seconde risque de ne pas etre représentée sur la barre enfin bon tu me diras c pas si grave.
Parfois il arrive des erreurs mais non bloquantes.

package videoPlayer;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
class MediaPlayer extends JFrame implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = true;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
    private JButton about = null;
    private CLSr csr = null;
    private Time duration = null;
private MoveTick mt = null;
    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        setTitle("Video Player"); // Sets the title for this frame to the specified string.
        getContentPane().setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */
        addWindowListener( new WindowAdapter() /* Adds the specified window listener to receive window events from this window */
         {    
         public void windowClosing( WindowEvent we ) /* Invoked when a window is in the process of being closed. The close operation can be overridden at
                 this point.*/
                 {
                 JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
                 /* Brings up a dialog that displays a message using a default icon determined by the messageType
                    parameter. */
                 System.exit(0); // Terminates the currently running Java Virtual Machine.
                 }
         }
        );
        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
}
private void validateSlider()
{
Time tm = duration;
System.out.println(duration);
  slider.setMaximum((int)duration.getSeconds());
  slider.setMinimum(0);
  
}

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("videoPlayer/icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("videoPlayer/icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("videoPlayer/icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("videoPlayer/icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("videoPlayer/icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //the buttons are add to the menu bar
         menu_bar.add(open);
         menu_bar.add(play);
         menu_bar.add(pause);
         menu_bar.add(stop);
         menu_bar.add(about);
System.out.println("validate");
Time tm = player.getDuration();
System.out.println(tm.getSeconds());
slider = new JSlider(JSlider.HORIZONTAL,0,(int)(tm.getSeconds()),0);
csr = new CLSr(slider,player);
slider.addChangeListener(csr);

slider.setMajorTickSpacing(10); //This method sets the major tick spacing
slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
slider.setPaintLabels(false); //Determines whether labels are painted on the slider
slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
menu_bar.add(slider); //Appends the slider to the end of the menu bar

//to set the menu bar
setJMenuBar(menu_bar);

           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
slider.removeChangeListener(csr);
csr=null;
mt=null;
//modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == JFileChooser.APPROVE_OPTION)
                            {
                             file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
    player.start();
csr = new CLSr(slider,player);
mt = new MoveTick(player,slider,csr);
mt.start();
slider.addChangeListener(csr);
}
                        }

                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
//player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                             Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
if (t > 0.0)
                           {
player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");


                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                getContentPane().add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
videoPanel.add( vis, BorderLayout.CENTER);
validateSlider();
       videoPanel.setVisible(true);
                this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    

/************
*   Main   *
************/
public static void main( String[] args )
{    // needs the address of a movie: *.avi,*.mpg...
new MediaPlayer("videoPlayer/video/open.avi" ).setVisible( true );
}

    
public class CLSr implements javax.swing.event.ChangeListener
{
JSlider slider = null;
Player player = null;
public CLSr(JSlider slider,Player player)
{
this.slider = slider;
this.player = player;
}
public void stateChanged(ChangeEvent e)
{
float tm = slider.getValue();
player.setMediaTime(new Time(tm));
}
}





    private class MoveTick extends Thread
    {
Player player=null;
JSlider slider = null;
CLSr csr = null;
public MoveTick(Player player,JSlider slider,CLSr csr)
{
this.player = player;
this.slider = slider;
this.csr = csr;
}

public void run() {
   while (true) {
   try {
slider.removeChangeListener(csr);
slider.setValue((int)(player.getMediaTime().getSeconds()));
slider.addChangeListener(csr);
   Thread.sleep(1000);
   } catch (InterruptedException e) {
   break;
   }
   }
   }
public void reset() {

   }
    }
    
}







signaler à un administrateur
Commentaire de Shamamatt le 14/07/2004 18:29:34

OK, ca marche qd meme tres bien ! merci beaucoup !

a+

shamamatt

signaler à un administrateur
Commentaire de intel4 le 19/07/2004 15:52:40

très bien mais est il possible de le faire communiquer avec du php?

signaler à un administrateur
Commentaire de intel4 le 19/07/2004 15:53:14

très bien mais est il possible de le faire communiquer avec du php?

signaler à un administrateur
Commentaire de Shamamatt le 19/07/2004 16:09:17

je sais pas... dsl

^_^

signaler à un administrateur
Commentaire de thierrytitix le 19/07/2004 19:30:13

oui c possible, il suffit de creer à partir de ce fichier un exe et de le lancer par l intermédiaire de php en demarrant un processus qui demarrera le fichier java(on peut meme le lancer en lancant "java nomdufichier" depuis php).
On peut envisager aussi l'autre sens et lancer un fichier en php depuis le java à condition de posseder un serveur php.
Il faudrait que tu detailles ce que tu voudrais faire exactement à partir de ce fichier java.

signaler à un administrateur
Commentaire de intel4 le 21/07/2004 14:44:24

Comment ( "java nomdufichier")? comme appelle d'un module externe? 'avec (exec (java nomdufichier))? mais pour ça, il faudra que la commande java soit reconnu.

en fait moi je suis sous linux et je travail avec  le serveur apache. Mon souci est de permettre à partir d'un clik sur un nom de video(sous forme de lien) le document video joue dans le player.

Avez vous une solution pour ça?

signaler à un administrateur
Commentaire de thierrytitix le 21/07/2004 23:08:57

Oui j ai une solution relativement facile et élégante:enfin je pense ...
tu fais un fichier jar avec le java mais tu transforme le java de maniere a ce que ce soit une applet qui prend comme parametre le nom du fichier et voila le tour est joué je le ferais ptet si j ai le temps et que tu sais pas comment faire sinon bon courage.
Le click permet de recharger la page avec la video insérée sous forme d 'applet paramétrée avec le nom sur lequel tu as cliqué.

signaler à un administrateur
Commentaire de Shamamatt le 22/07/2004 11:48:14

J'ai essaye de faire un .jar executable, j'ai reussi mais je suis oblige de mettre l'adresse complete des images et de la video...donc mon .jar executable ne fonctionne que sur mon ordi forcement...Si je laisse
("videoPlayer/video/open.avi" ).setVisible( true );
comme on le trouve dans le main, le fichier de la video n'est pas trouve... j'ai essaye de mettre ./ ou ../ devant "videoPlayer" mais ca marche pas plus... est ce que qq'1 a reussi a resoudre ce probleme ?
    

signaler à un administrateur
Commentaire de intel4 le 28/07/2004 18:33:02

ok, tout d'abord je vais essayer de transformer le fichier java en applet car c'est pas toujours evident et après je te dirai ou j'en suis. Merci

signaler à un administrateur
Commentaire de intel4 le 22/09/2004 16:50:50

Shamamatt, j'attends toujours
Ou en es tu avec la transformation en applet?

signaler à un administrateur
Commentaire de thierrytitix le 22/09/2004 19:26:42

Tout d'abord vu que la méthode main peut recevoir des éléments args, il semble possible lors du lancement du  jar exécutable de filer des paramètres. En le lançant avec un .bat ou un .sh par exemple.
Fais des sytem.out .println(args[n]) , tu verras les arguments passés en ligne de commande.

Ensuite pour le problème de transformer le code en applet je vais le faire ce week end.Si le code à évolué envoie le moi par mail comme çà tu auras la meilleure mise à jour possible.

signaler à un administrateur
Commentaire de intel4 le 24/09/2004 11:09:25

ok, je verai aussi cet week end ce que ça va donner avec le passage de paramètres.

Je t'envoie les modifications que j'ai essayé pour la transforamtion en applet. ça ne marche pas pour le moment.

signaler à un administrateur
Commentaire de intel4 le 24/09/2004 11:14:46

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
class MediaPlayer extends JPanel implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = false;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
     private JButton segment = null;
    private JButton about = null;
  
    

    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        setTitle("Video Player"); // Sets the title for this frame to the specified string.
        getContentPane().setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */
        addWindowListener( new WindowAdapter() /* Adds the specified window listener to receive window events from this window */
         {    
         public void windowClosing( WindowEvent we ) /* Invoked when a window is in the process of being closed. The close operation can be overridden at
                 this point.*/
                 {
                 JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
                 /* Brings up a dialog that displays a message using a default icon determined by the messageType
                    parameter. */
                 System.exit(0); // Terminates the currently running Java Virtual Machine.
                 }
         }
        );
        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
    }

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        setIconImage(new ImageIcon("icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     Time duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
segment = new JButton(new ImageIcon ("icons/segment.gif"));
         segment.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //creates a slider with the specified orientation and the specified minimum, maximum, and initial values
         slider = new JSlider(JSlider.HORIZONTAL,0,50,0);
        
         //the buttons are add to the menu bar
         menu_bar.add(open);
         menu_bar.add(play);
         menu_bar.add(pause);
         menu_bar.add(stop);
menu_bar.add(segment);
         menu_bar.add(about);
    
        
         slider.setMajorTickSpacing(10); //This method sets the major tick spacing
         slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
         slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
         slider.setPaintLabels(false); //Determines whether labels are painted on the slider
         slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
         menu_bar.add(slider); //Appends the slider to the end of the menu bar
          
         //to set the menu bar
           setJMenuBar(menu_bar);
               
           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
                         //modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == fc.APPROVE_OPTION)
                            {
                                file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
                                player.start();
                            }
                        }
                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
                             //player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                           Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
                           if (t > 0.0)
                           {
                             player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");        
                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                getContentPane().add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
                videoPanel.add( vis, BorderLayout.CENTER);
                videoPanel.setVisible(true);
                this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    void slider_stateChanged(ActionEvent e)
    {
      if (follows_slider)
      {
        float tm = slider.getValue() * step;
        player.setMediaTime(new Time(tm));
      }
    }


    private void validateSlider()
    {
      Time tm = player.getMediaTime();
      slider.setValue((int)(tm.getSeconds() / step));
    }
    
}    
  
//-------------------   Applet-------------------------

  import javax.swing.JApplet;

/*Class Main extends JFrame
     {
        public Main(String [] args)
{
         new MediaPlayer(this, args);
        }
     }*/
    
    public class MediaPlayerApplet extends JApplet
     {
      
     static MediaPlayerApplet applet;
    
      
      public void init()
      {

applet=this;
JFrame f = new JFrame();
String args="asimo.mov";
//Main a=new Main(args);
MediaPlayer m= new MediaPlayer(f,args);
applet.getContentPane().add(m);

    
      }
    }
    

signaler à un administrateur
Commentaire de intel4 le 24/09/2004 13:10:55

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
class MediaPlayer extends JPanel implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = false;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
     private JButton segment = null;
    private JButton about = null;
  
    

    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        setTitle("Video Player"); // Sets the title for this frame to the specified string.
        getContentPane().setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */
        addWindowListener( new WindowAdapter() /* Adds the specified window listener to receive window events from this window */
         {    
         public void windowClosing( WindowEvent we ) /* Invoked when a window is in the process of being closed. The close operation can be overridden at
                 this point.*/
                 {
                 JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
                 /* Brings up a dialog that displays a message using a default icon determined by the messageType
                    parameter. */
                 System.exit(0); // Terminates the currently running Java Virtual Machine.
                 }
         }
        );
        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
    }

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        setIconImage(new ImageIcon("icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     Time duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
segment = new JButton(new ImageIcon ("icons/segment.gif"));
         segment.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //creates a slider with the specified orientation and the specified minimum, maximum, and initial values
         slider = new JSlider(JSlider.HORIZONTAL,0,50,0);
        
         //the buttons are add to the menu bar
         menu_bar.add(open);
         menu_bar.add(play);
         menu_bar.add(pause);
         menu_bar.add(stop);
menu_bar.add(segment);
         menu_bar.add(about);
    
        
         slider.setMajorTickSpacing(10); //This method sets the major tick spacing
         slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
         slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
         slider.setPaintLabels(false); //Determines whether labels are painted on the slider
         slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
         menu_bar.add(slider); //Appends the slider to the end of the menu bar
          
         //to set the menu bar
           setJMenuBar(menu_bar);
               
           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
                         //modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == fc.APPROVE_OPTION)
                            {
                                file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
                                player.start();
                            }
                        }
                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
                             //player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                           Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
                           if (t > 0.0)
                           {
                             player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");        
                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                getContentPane().add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
                videoPanel.add( vis, BorderLayout.CENTER);
                videoPanel.setVisible(true);
                this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    void slider_stateChanged(ActionEvent e)
    {
      if (follows_slider)
      {
        float tm = slider.getValue() * step;
        player.setMediaTime(new Time(tm));
      }
    }


    private void validateSlider()
    {
      Time tm = player.getMediaTime();
      slider.setValue((int)(tm.getSeconds() / step));
    }
    
}    
  
//-------------------   Applet-------------------------

  import javax.swing.JApplet;

/*Class Main extends JFrame
     {
        public Main(String [] args)
{
         new MediaPlayer(this, args);
        }
     }*/
    
    public class MediaPlayerApplet extends JApplet
     {
      
     static MediaPlayerApplet applet;
    
      
      public void init()
      {

applet=this;
JFrame f = new JFrame();
String args="asimo.mov";
//Main a=new Main(args);
MediaPlayer m= new MediaPlayer(f,args);
applet.getContentPane().add(m);

    
      }
    }
    

signaler à un administrateur
Commentaire de intel4 le 28/09/2004 10:45:57

voilà je propose un autre code, pour la transformation en applet
d'abord je fais un panel, ce qui me permet de l'utiliser facilement avec les applets. Mais le problème que je rencontre c'est que le player ne s'affiche pas. pas d'erreurs de compilation, l'applet s'affiche mais pas avec le player. Si quelqu'un a une solution,  j'en serai vraiment ravi.

voici le code



import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
public class MediaPlayer extends JPanel implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = false;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
     private JButton segment = null;
    private JButton about = null;
  
    

    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        //setTitle("Video Player"); // Sets the title for this frame to the specified string.
        setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
    }

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        //setIconImage(new ImageIcon("icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     Time duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
segment = new JButton(new ImageIcon ("icons/segment.gif"));
         segment.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //creates a slider with the specified orientation and the specified minimum, maximum, and initial values
         slider = new JSlider(JSlider.HORIZONTAL,0,50,0);
        
         JPanel menu = new JPanel();
menu.add(open);
menu.add(play);
menu.add(pause);
menu.add(stop);
menu.add(segment);
menu.add(about);
add(menu, BorderLayout.NORTH);
        
         slider.setMajorTickSpacing(10); //This method sets the major tick spacing
         slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
         slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
         slider.setPaintLabels(false); //Determines whether labels are painted on the slider
         slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
         menu_bar.add(slider); //Appends the slider to the end of the menu bar
          
        
               
           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
                         //modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == fc.APPROVE_OPTION)
                            {
                                file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
                                player.start();
                            }
                        }
                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
                             //player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                           Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
                           if (t > 0.0)
                           {
                             player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");        
                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
                videoPanel.add( vis, BorderLayout.CENTER);
                videoPanel.setVisible(true);
                //this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    void slider_stateChanged(ActionEvent e)
    {
      if (follows_slider)
      {
        float tm = slider.getValue() * step;
        player.setMediaTime(new Time(tm));
      }
    }


    private void validateSlider()
    {
      Time tm = player.getMediaTime();
      slider.setValue((int)(tm.getSeconds() / step));
    }

      
}    
  
/*------------MediaPlayerApplet.java----------------------------

import javax.swing.*;
  import javax.swing.JApplet;


    public class MediaPlayerApplet extends JApplet
     {
        //MediaPlayerApplet applet;
      
      public void init()
      {


JFrame f = new JFrame();
String args=null;
MediaPlayer m= new MediaPlayer(args);
f.getContentPane().add(m);
//applet.pack();
        f.setVisible(true);
    
      }
    }
    

/*---------------------test de l'applet -----------------------------------


<html>

<head>
<title>Jouer un fichier video 2</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<APPLET CODE="MediaPlayerApplet.class" WIDTH=500 HEIGHT=300>
</APPLET>
</body>

</html>

signaler à un administrateur
Commentaire de asamba2005 le 22/02/2005 13:18:08

Salut Je viens faire mes débuts avec JMF et je teste actuellement votre programme sur Linux SUSE 9.1 et ça donne le Message d'erreur suivant
Unable to handle format: MP42, 320x233, FrameRate=12.0, Length=223680 0 extra bytes
Failed to realize: com.sun.media.PlaybackEngine@120d62b
Error: Unable to realize com.sun.media.PlaybackEngine@120d62b
Svp si vous avez une idée je vous serai reconnaissant et merci

signaler à un administrateur
Commentaire de thierrytitix le 23/02/2005 21:47:30

il te manque un codec ou ce code ne marche pas. Essaye avec une autre video compressée avec un autre codec.

signaler à un administrateur
Commentaire de aladin_1983 le 26/02/2005 20:42:44

bonjour,

j ai fais copiercoller de ton programme thierrytitix, et je veux savoir ce ke je dois faire pour l executer et ce ke je dois installer comme programme.

signaler à un administrateur
Commentaire de aladin_1983 le 26/02/2005 20:44:40

re

je travaille sur windows et j ai la version 1.4.1 de java

j ai oublie de le mentionner

merci d'avance

signaler à un administrateur
Commentaire de thierrytitix le 27/02/2005 19:09:15

Aladin:
Installer un JRE et un JMF voici la page pour le JMF:
http://java.sun.com/products/java-media/jmf/2.1.1/download.html

Asamba:
Pour le codec c etait ca?

signaler à un administrateur
Commentaire de aladin_1983 le 27/02/2005 22:13:56

merci ,

mais ou est ce ke je peux trouver un jre .

et aussi si vous avez un code source pour un lecteur Mpeg avec la possibilite de lire 4 films a la fois .

merci encore.

signaler à un administrateur
Commentaire de asamba2005 le 28/02/2005 10:16:47

Salut tt le monde
j ai essayé mé ca marche pa car la vidéo est lue avec Jmstudio mé avec ton programme c tjr le meme probleme  meme sous windows. est ce ke je doit telecharger autre chose
merci de m avoir repodu et désolé pr mon retard.
Merci infiniment

signaler à un administrateur
Commentaire de aladin_1983 le 28/02/2005 17:24:28

resalut ,

le package videoplayer . il me le faut pour compiler. si kelkun l as k il me l envoie ca serait super et merci.

signaler à un administrateur
Commentaire de aladin_1983 le 04/04/2005 13:00:32

salut , j ai pas recu de reponse .mais j y suis arriver a le compiler avec succes . mais le probleme c dans l execution .il me dit il faut le url de la video.

si kelkun peut me repondre ca serait gentil et merci.

signaler à un administrateur
Commentaire de khalid 2005 le 08/04/2005 12:58:28

salut,ton programme m'a aidé bcp,mais j'ai tjrs un probleme de l'execution,pouvez vous m'inmformer comment je pourrai faire,et aussi comment je peux lire 4films a la fois,merci d'avance

signaler à un administrateur
Commentaire de AbriBus le 12/04/2005 04:17:19

Salut...
Lol,, je croyais que c'était Relire deux fois s'il le fallait... les posts en double c'est pour au cas ou vous en perdriez un ? :D
Lire 4 vilms a la fois...? hmmmm... il me manque au moins deux yeux a moi pour ca lol...
;)
Bon courrage...
AbriBus

signaler à un administrateur
Commentaire de aladin_1983 le 26/04/2005 22:59:31

     Bonjour,

votre lecteur se compile avec succes mais lors de l 'execution avec la commande "java MediaPlayer" sur msdos il me donne l erreur suivante:

java.io.IOException:File not found
java.io.IOException:File not found
Error creating file

Si vous avez la solution n'hesiter pas a me la passer et merci d'avance.

signaler à un administrateur
Commentaire de cRaZy_mEhDi le 07/05/2005 02:33:44

HAHAHA, waaaa les polytechniciens rakom mhansriiiine, hahaha

signaler à un administrateur
Commentaire de sboukr le 10/05/2005 17:32:45

ajouter ces exception a votre player....si ta cette erreur
java.io.IOException: File Not Found
java.io.IOException: File Not Found
Error creating player
et bon courage
public void init()
    {
        MediaLocator medialocator = null;
        Object obj = null;
        if ((s = getParameter("FILE")) == null)
        System.out.println("S value is:NULL");
            Fatal("Invalid media file parameter");
        try
        {
            URL url = new URL(getDocumentBase(), s);
            System.out.println("URL Value is:" + url);
            s = url.toExternalForm();
        }
        catch(MalformedURLException malformedurlexception) { }
        try
        {
            if((medialocator = new MediaLocator("file:" + s)) == null)
                Fatal("Can't build URL for " + s);
                System.out.println("catch in malformed");
            try
            {
                player = Manager.createPlayer(medialocator);
                System.out.println("it is from create player");
            }
            catch(NoPlayerException noplayerexception)
            {
                System.out.println(noplayerexception);
                Fatal("Could not create player for " + medialocator);
            }
        }
        catch(MalformedURLException malformedurlexception1)
        {
            Fatal("Invalid media file URL!");
        }
        catch(IOException ioexception)
        {
            Fatal("IO exception creating player for " + medialocator);
        }
    }

    public void start()
    {
        if(player != null)
            player.start();
            System.out.println("This from start");
    }

    public void stop()
    {

        if(player != null)
        {
System.out.println("This from stop");
            player.stop();
            player.deallocate();
        }
    }

    public void destroy()
    {
        player.close();
        System.out.println("This from Destory");
    }

    void Fatal(String s)
    {
        System.err.println("FATAL ERROR: " + s);
        throw new Error(s);
    }

    Player player;
}

signaler à un administrateur
Commentaire de aladin_1983 le 11/05/2005 02:43:16

bonjour

bon mon probleme c ke le programme ca se compile avec succes avec la commande: javac video_Player.java

mais est ce ke tu peux  donner la ligne de commande pour l execution .

et merci.

signaler à un administrateur
Commentaire de decarvk le 07/06/2007 22:40:54

bonjour j'ai un problem aidez moi svp

message d'erreur(de la console java)
ava.lang.NoClassDefFoundError: MediaPlayer (wrong name: videoPlayer/MediaPlayer)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

signaler à un administrateur
Commentaire de jalelouss le 10/10/2007 02:30:52

Bonsoir, j'ai le code :
package videoPlayer;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.media.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;

/*****************************
*   MediaPlayer Class       *
*****************************/
class MediaPlayer extends JFrame implements  ControllerListener
{
    private Player player = null;
    private JPanel videoPanel = null;
    private JSlider slider = null;
    private volatile Thread slider_updater = null;
    private volatile boolean follows_slider = false;
    private JToggleButton start_stop = new JToggleButton();
    float step = 1.0f / 10;
    
    
    private JMenuBar menu_bar = null; // menu bar used for the different Buttons
    private JFrame frame = null;     // frame used to open a file
    private JFileChooser fc = null; // used for the dialog window to open a file
    private File file;

    /* Various Buttons */
    private JButton open = null;
    private JButton play = null;
    private JButton pause = null;
    private JButton stop = null;
    private JButton about = null;
    

    /***********************************************
     * MediaPlayer Builder      *
     * needs the address of a movie as an argument *
     ***********************************************/
    public MediaPlayer( String nomFilm )
    {
        super(); /* Constructs a new frame that is initially invisible.
                    This constructor sets the component's locale property to the value returned by JComponent.*/
        setLocation( 400, 200 ); /* Moves this component to a new location. The top-left corner of the new location is specified by the
                                    x and y parameters in the coordinate space of this component's parent. */
        setTitle("Video Player"); // Sets the title for this frame to the specified string.
        getContentPane().setLayout( new BorderLayout() ); /* Sets the layout manager for this container.
                                                             Constructs a new border layout with no gaps between components. */
        addWindowListener( new WindowAdapter() /* Adds the specified window listener to receive window events from this window */
         {    
         public void windowClosing( WindowEvent we ) /* Invoked when a window is in the process of being closed. The close operation can be overridden at
                 this point.*/
                 {
                 JOptionPane.showMessageDialog(null, "Thank you to have used Video Player", "Quit",JOptionPane.INFORMATION_MESSAGE);
                 /* Brings up a dialog that displays a message using a default icon determined by the messageType
                    parameter. */
                 System.exit(0); // Terminates the currently running Java Virtual Machine.
                 }
         }
        );
        
        if ( nomFilm != null)
            loadMovie( nomFilm ); // load the movie
    }

    /******************************************
     * method of loading of film from its URL *
     ******************************************/
    private void loadMovie( String movieURL )
    {
        if ( movieURL.indexOf( ":" ) < 3 ) movieURL = "file:" + movieURL;
        try
        {    // creation of the  player

            player = Manager.createPlayer( new MediaLocator( movieURL ) );
            player.addControllerListener( this ) ;
            player.realize();
        }
        catch (Exception e)
        {
            System.out.println("Error creating player");
            return;
        }
    }

    /********************************************************
     * intercept all the events in provenence of the player *
     ********************************************************/
    public void controllerUpdate( ControllerEvent ce )
    {
     // to change the icon of tje player
        Toolkit tk = Toolkit.getDefaultToolkit();
        setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
              
        // to give the duration of the movie
       if  (ce instanceof DurationUpdateEvent)
     {
     Time duration= ((DurationUpdateEvent) ce).getDuration();
            System.out.println( "duration: " + (int)duration.getSeconds()+" seconds");
        }

       // to start the video and create all the buttons etc...
        if ( ce instanceof RealizeCompleteEvent )
        {                    
         if (menu_bar == null)
         {                 
         //creation of the menu bar
           menu_bar = new JMenuBar();
                     
           //creation of the different buttons with the icons
           open = new JButton(new ImageIcon ("videoPlayer/icons/open.gif"));
         open.setMargin(new Insets( 0, 0, 0, 0));
           play = new JButton(new ImageIcon ("videoPlayer/icons/play.gif"));
           play.setMargin(new Insets( 0, 0, 0, 0));
           pause = new JButton(new ImageIcon ("videoPlayer/icons/pause.gif"));
           pause.setMargin(new Insets( 0, 0, 0, 0));
         stop = new JButton(new ImageIcon ("videoPlayer/icons/stop.gif"));
         stop.setMargin(new Insets( 0, 0, 0, 0));
         about = new JButton(new ImageIcon ("videoPlayer/icons/about.gif"));
         about.setMargin(new Insets( 0, 0, 0, 0));
        
         //creation of the frame used to open a file
         frame = new JFrame();
         fc = new JFileChooser();
        
         //creates a slider with the specified orientation and the specified minimum, maximum, and initial values
         slider = new JSlider(JSlider.HORIZONTAL,0,50,0);
        
         //the buttons are add to the menu bar
         menu_bar.add(open);
         menu_bar.add(play);
         menu_bar.add(pause);
         menu_bar.add(stop);
         menu_bar.add(about);
    
        
         slider.setMajorTickSpacing(10); //This method sets the major tick spacing
         slider.setMinorTickSpacing(2); //This method sets the minor tick spacing
         slider.setPaintTicks(true); //Determines whether tick marks are painted on the slider
         slider.setPaintLabels(false); //Determines whether labels are painted on the slider
         slider.setBorder(BorderFactory.createEmptyBorder(0,0,10,0)); //Sets the border of this component           
         menu_bar.add(slider); //Appends the slider to the end of the menu bar
          
         //to set the menu bar
           setJMenuBar(menu_bar);
               
           //actions which are made while pressing the open button
           open.addActionListener(new ActionListener()
                    {
                        public void actionPerformed(ActionEvent e)
                        {
                         //modification of the icon
                         Toolkit tk = Toolkit.getDefaultToolkit();
                            frame.setIconImage(new ImageIcon("videoPlayer/icons/icon.gif").getImage());
                        
                            System.out.println("Open a file");
                            
                            //posting of a window "of opening"
                         int choix = fc.showOpenDialog(frame);
                        
                         if(choix == fc.APPROVE_OPTION)
                            {
                                file = fc.getSelectedFile(); //recover the selected file
                                String address =  file.getPath();//recover the address of the file
                                loadMovie( address );
                                player.start();
                            }
                        }
                    });

           //actions which are made while pressing the play button
                play.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.start();
                             //player.setMediaTime(new Time(0.0));
                             while(play.isSelected())
                             {
                           Time tm = player.getMediaTime();
                           double t = tm.getSeconds();
                           if (t > 0.0)
                           {
                             player.setMediaTime(new Time(t - step));
                           }
                             }
                             System.out.println("Playing movie");        
                            }
                        });
                
                //actions which are made while pressing the pause button
                pause.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Pause");
                            }
                        });
                
                //actions which are made while pressing the stop button
                stop.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {
                             player.stop();
                             player.deallocate();
                             System.out.println("Stop");
                             player.setMediaTime(new Time(0)); //puts the video at the beginning
                                if (player.getTargetState() < Player.Started)
                                    player.prefetch();
                            }
                        });
                
                //actions which are made while pressing the about button
                about.addActionListener(new ActionListener()
                        {
                            public void actionPerformed(ActionEvent e)
                            {  
                             System.out.println("About");
                             //Brings up a dialog that displays a message using a default icon determined by the messageType parameter
                             JOptionPane.showMessageDialog(null," Video Player 1.1\n Video Player Java using JMF\n\n version 1.1", "About Video Player",JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
         }
        
        
         if ( videoPanel == null)
            { //creation of the panel of sight
         videoPanel = new JPanel();
                videoPanel.setLayout( new BorderLayout() );
                getContentPane().add( videoPanel, BorderLayout.CENTER);
            }
            else
                videoPanel.removeAll();
        
         //obtaining the component restoring the image in provenence of the player.
            Component vis = player.getVisualComponent();
            if ( vis != null )
            {   // if it is valid then we put it in our sight
                videoPanel.add( vis, BorderLayout.CENTER);
                videoPanel.setVisible(true);
                this.pack(); // resize the size according to the size of film
            }
        }
              
        else if ( ce instanceof EndOfMediaEvent )
        {
            if (player != null)
            {    //stop the movie
                 player.stop();
                 player.deallocate(); /* Deallocating the Player releases any resources that would prevent another
                                         Player from being started. For example, if the Player uses a hardware device
                                         to present its media, deallocate frees that device so that other Players
                                         can use it. */
            }
        }
    }

  
    void slider_stateChanged(ActionEvent e)
    {
      if (follows_slider)
      {
        float tm = slider.getValue() * step;
        player.setMediaTime(new Time(tm));
      }
    }


    private void validateSlider()
    {
      Time tm = player.getMediaTime();
      slider.setValue((int)(tm.getSeconds() / step));
    }

    /************
     *   Main   *
     ************/
    public static void main( String[] args )
    {    // needs the address of a movie: *.avi,*.mpg...
     new MediaPlayer("videoPlayer/video/open.avi" ).setVisible( true );
    }

}




et j'ai trouvé des erreurs apres l'exécution de ce player :
  Unable to handle format: MP42, 320x233, FrameRate=12.0, Length=223680 0 extra bytes
Failed to realize: com.sun.media.PlaybackEngine@194ca6c
Error: Unable to realize com.sun.media.PlaybackEngine@194ca6c

SVP ,aidez moi a corriger cette erreur sachant que j'ai changé la video de test mais pariel y a des erreurs genre IOException

signaler à un administrateur
Commentaire de jalelouss le 08/11/2007 00:49:18

Salut tout le monde , j'ai une question concernant ce code , par exemple je veux lire la video concerné a un instant t je m'expliques :
par exemple la video debute a t0=0:0:0 et elle se termine a tf=X:Y:Z
par exemple je veux qu'elle se lit a l'instant t1 compris entre t0 et tf
Merci (c urgent aidez moi svp tres vite )

signaler à un administrateur
Commentaire de hakimus le 10/09/2008 13:50:22 7/10

Bonjour,

je viens de réaliser un player semblable à celui-là, qui fonctionne très bien, mais il me reste un petit problème :
Quand la vidéo tourne, les déplacements du slider son pris en compte. Mais quand elle est en pause, l'affichage ne s'actualise plus! Il faut obligatoirement refaire play pour que la vidéo saute d'un coup, c'est moche.

Comment faire pour que l'affichage de la vidéo se mette à jour même quand elle est en pause??
J'ai déjà essayé repaint() et validate(), tous les deux sans succès...

Merci à tous.

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

JMF et flux video [ par vivi_2701 ] Bonjour,J'ai recuperer le flux video de ma webcam grace a l'API JMF, en utilsant un MediaLocator et un Player qui me donne un Component. Ca marche tre échantillonner une video avec JMF [ par sourire_de_deesse ] bonjour! jai une qst au connaisseur de jmf,comment echantilloner une video??c'est a dire comment recuperer une image a partir d'une video avec JMF sv API JMF [ par zaka2005 ] salut a tous. en fait,je veux capture a partir d'une webcam ,mais sans passer par le CaptureDialog pour regler les proprietes de l'audio et video, jmf [ par nazim_tafat ] je cherche a faire toutes les fonctions de type magnetoscope (avance rapide ,avance d'une image dans la video&nbsp;,reucle&nbsp; d'une image dans la v Est ce que je peux utiliser JMF comme serveur du video streaming? [ par sosobico ] Bonjour,Je veux impl&#233;menter et tester&nbsp;des&nbsp;techniques (programmes) de contr&#244;le de la QoS du video streaming&nbsp; sur un serveur&nb JMF - capture video [ par nomad56 ] salut, je commence &#224; voir ce qu'est JMF et j'aimerai savoir un truc: ok, j'ai lu quelquepart qu'on pouvait capturer de la video avec camera/webca Probleme de lecture fichier video [ par MohamedTaha ] Salut tout le monde, j'ai un pbm en lisant un fichier video avec java avec le JMF library,il m'affiche ce message :Unable to handle format: RLE8, 321x realisation d'un player video streaming avec rtp [ par hamzagasmi ] Bonjour je voulais realiser un player video streaming avec rtp sur le mobile .si vous avez la solution n'hesitez pas de m'aider. Creer un lecteur video dans une IHM sur NetBeans [ par fonkyom ] Bonjour,Cette année on ma donné un projet qui a pour but de préparer à la réalisation d'un feu d'artifice.J'ai été chargé de créer une IHM en java per Probleme echainement videos [ par fonkyom ] Bonjour, j'ai un ptit soucis j'ai en projet de créer une IHM videos, qui permet de lire plusieurs videos differentes à la suite mais lorsque je lance


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :

Comparez les prix Nouvelle version


HTC Magic

Entre 429€ et 429€


Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 1,310 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.