Note that there are some explanatory texts on larger screens.

plurals
  1. PONoPlayerException runtime error with jmf app
    primarykey
    data
    text
    <p>hello im trying to create a simple video player with jmf. i think my code its ok but when i execute it i get a NoPlayerException. Here is the code of the player:</p> <pre><code>package reproductor; import java.awt.BorderLayout; import java.awt.Component; import java.io.IOException; import java.net.URL; import javax.media.CannotRealizeException; import javax.media.Manager; import javax.media.NoPlayerException; import javax.media.Player; import javax.swing.JPanel; /** * * @author pollyox16 */ public class repropanel extends JPanel{ public repropanel(URL url){ setLayout(new BorderLayout()); Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true); try{ createRealizedPlayer(). Component video= reproductor.getVisualComponent(); Component controles=reproductor.getControlPanelComponent(); if(video!=null){ add(video,BorderLayout.CENTER); } if (controles!=null){add(controles,BorderLayout.SOUTH);} reproductor.start();//con esto arrancamos el reproductor. } //end try catch(NoPlayerException e3){ System.out.println("player not created"); } catch (CannotRealizeException e){ System.out.println("player not realized"); } catch (IOException e2){ System.out.println("io exception catch"); } } } </code></pre> <p>here is the code of the main application it only creates a JFileChooser and add the url to the player: here is the code of the main application:</p> <pre><code>package reproductor; import java.net.URL; import javax.swing.JFileChooser; import javax.swing.JFrame; /** * * @author pollyox16 */ public class Reproductor{ public static void main(String[] args) { JFileChooser selectarchivo= new JFileChooser(); int resultado= selectarchivo.showOpenDialog(null); if(resultado== JFileChooser.APPROVE_OPTION){ URL miurl=null; try{ miurl=selectarchivo.getSelectedFile().toURI().toURL(); }//FINAL TRY catch(Exception e){ System.out.println("error en el main"); } if(miurl!=null){ JFrame ventana= new JFrame("pollyox16"); ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ventana.setSize(300,300); repropanel mireproductor= new repropanel(miurl); ventana.add(mireproductor); ventana.setVisible(true); } } } } </code></pre> <p>EDIT: here is the exception stacktrace:</p> <pre><code>javax.media.NoPlayerException: Cannot find a Player for :file:/C:/Users/Public/Videos/Sample%20Videos/Wildlife.wmv at javax.media.Manager.createPlayerForContent(Manager.java:1412) at javax.media.Manager.createPlayer(Manager.java:417) at javax.media.Manager.createPlayer(Manager.java:332) at javax.media.Manager.createRealizedPlayer(Manager.java:527) at reproductor.repropanel.&lt;init&gt;(repropanel.java:34) at reproductor.Reproductor.main(Reproductor.java:52) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload