public PlayerStarter(Player player) { setDaemon(true); player.addControllerListener(this); player.start(); }
/** * ControllerListener for the Players. */ @Override public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); LOGGER.severe("Receiver internal error: " + ce); } } }
/** Construct the player object and the GUI. */ public JMFPlayer(JFrame pf, String media) { parentFrame = pf; mediaName = media; // cp = getContentPane(); cp = this; cp.setLayout(new BorderLayout()); try { theURL = new URL(getClass().getResource("."), mediaName); thePlayer = Manager.createPlayer(theURL); thePlayer.addControllerListener(this); } catch (MalformedURLException e) { System.err.println("JMF URL creation error: " + e); } catch (Exception e) { System.err.println("JMF Player creation error: " + e); return; } System.out.println("theURL = " + theURL); // Start the player: this will notify our ControllerListener. thePlayer.start(); // start playing }
/** * ControllerListener for the Players. */ public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); LOGGER.severe("Receiver internal error: " + ce); } } }
/** * ControllerListener for the Players. */ public synchronized void controllerUpdate(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; // Get this when the internal players are realized. if (ce instanceof RealizeCompleteEvent) { p.start(); } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); LOGGER.error("Receiver internal error: " + ce); } } }
player.start();
player.start();
player.start();
player.start(); else