Java - reproducir video

 
Vista:

reproducir video

Publicado por marco (4 intervenciones) el 16/12/2005 20:48:52
hola :

lo que pasa es que estoy tratando de probar una aplicacions dse mondelo, del manejo de video:
que se encuentra en la direccion:http://weblogs.javahispano.org/page/mondelo?entry=me_cuesta_coger_el_ritmo)
ya instale el JMF de la manera mas usual dse instalar un programa tal vez aya algo especial que tenga que hacer al instalarlo ;lo estoy probando en net bean 4.1 y no hay errores en la compilacion a la hora de seleccionar un archivo(.mpg o wmv) no los reprodsuce y se obtiene la siguiente:

*UNABLE_CREATE_PLAYER*javax.media.NoPlayerException: Cannot find a Player for :file://E:\archivos_marco\laura pausini- the extra mile.WMV
*UNABLE_CREATE_PLAYER*javax.media.NoPlayerException: Cannot find a Player for :file://E:\archivos_marco\laura

el codigo es el siguiente:

import javax.swing.*;
import javax.swing.event.*;
import javax.media.*;
import javax.media.bean.playerbean.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;

public class reproductorVideo extends JFrame implements ActionListener,ControllerListener {

MediaPlayer mp1 = null;
String archivo = null; //nombre del archivo a reproducir

JButton botonReproducir = null;
JButton botonSeleccionar = null;
JLabel seleccion = null;
JPanel panelVisor = null;
JPanel panelBotones = null;
JPanel panelEtiqueta = null;

public static void main(String[] args) throws Exception{
reproductorVideo rep = new reproductorVideo();
rep.marco();
}

public synchronized void controllerUpdate(ControllerEvent event) {
if (event instanceof RealizeCompleteEvent) {
// de esta manera nos aseguramos que el panel se actualice cuando comienza la reproduccion

panelVisor.revalidate();

}
}

public void marco() throws Exception{
botonReproducir = new JButton();
botonReproducir.setText("reproducir");
botonReproducir.setSize(100,40);
botonReproducir.addActionListener(this);
botonSeleccionar = new JButton();
botonSeleccionar.setText("seleccionar fichero");
botonSeleccionar.setSize(100,40);
botonSeleccionar.addActionListener(this);
seleccion = new JLabel();
seleccion.setText("Fichero seleccionado: "+archivo);

panelBotones = new JPanel();
panelBotones.add(botonReproducir,BorderLayout.EAST);
panelBotones.add(botonSeleccionar,BorderLayout.WEST);

panelEtiqueta = new JPanel();
panelEtiqueta.add(seleccion,BorderLayout.NORTH);

//creamos el reproductor
mp1 = new javax.media.bean.playerbean.MediaPlayer();
mp1.addControllerListener(this);

panelVisor = new JPanel();
panelVisor.add(mp1,BorderLayout.NORTH);

this.getContentPane().add(panelVisor,BorderLayout.NORTH);
this.getContentPane().add(panelEtiqueta,BorderLayout.CENTER);
this.getContentPane().add(panelBotones,BorderLayout.SOUTH);

this.setSize(600,500);
this.setVisible(true);
panelVisor.revalidate();
this.getContentPane().validate();
}

public void actionPerformed(ActionEvent e) {
String ac = e.getActionCommand();
if (ac.equals("reproducir")){
if (archivo != null){
// le decimos que archivo tiene que reproducir
mp1.setMediaLocation(archivo);
mp1.start();
}
else{
seleccion.setText("Debe seleccionar un fichero para poder reproducirlo");
panelEtiqueta.revalidate();
}
}//revalidate
if (ac.equals("seleccionar fichero")){
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
int result = chooser.showOpenDialog(null);
Integer i = new Integer(chooser.APPROVE_OPTION);
if (i != null) {
archivo = "file://"+chooser.getSelectedFile().getAbsolutePath();
seleccion.setText("Fichero seleccionado: "+archivo);
panelEtiqueta.revalidate();
}

}
}

}

que tengo que hacer para mejorar el error(gracias a cualquier ayuda)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder