当前位置: 首页>>代码示例>>Java>>正文


Java Player.start方法代码示例

本文整理汇总了Java中javax.media.Player.start方法的典型用法代码示例。如果您正苦于以下问题:Java Player.start方法的具体用法?Java Player.start怎么用?Java Player.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.Player的用法示例。


在下文中一共展示了Player.start方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.media.Player; //导入方法依赖的package包/类
public static void main(String args[]) {
Player	player;
// This is little trick simply to keep
// the application running indefinitely.
JFrame f = new JFrame();

       if( args.length != 1 ) {
           System.err.println("Usage:");
           System.err.println("java ejmf.examples.basics.JMFAudioOnly <Media>");
           return;
       }

       String media = args[0];
try {
    URL url = new URL("file:///" +  new File(media).getCanonicalPath());
    player = Manager.createPlayer(url);

           player.start();
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:24,代码来源:JMFAudioOnly.java

示例2: main

import javax.media.Player; //导入方法依赖的package包/类
public static void main(String args[]) {
   	Player player;

// This is little trick simply to keep
// the application running indefinitely.
JFrame f = new JFrame();

       if( args.length != 1 ) {
           System.err.println("Usage:");
           System.err.println("java ejmf.examples.basics.JMFAudioLoop <Media>");
           return;
       }

       String media = args[0];

try {
    URL url = new URL("file:///" +  new File(media).getCanonicalPath());
    player = Manager.createPlayer(url);
    player.addControllerListener(new LoopListener());
           player.start();
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:JMFAudioLoop.java

示例3: main

import javax.media.Player; //导入方法依赖的package包/类
public static void main(String args[]) {
   	JPanel	playerPanel;
       Player 	player;


       if( args.length != 1 ) {
           System.err.println("Usage:");
           System.err.println("java ejmf.examples.basics.JMFVideoToo <Media>");
           return;
       }

       String media = args[0];

JFrame f = new JFrame(media);

f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent event) {
 	System.exit(0);
    }
});

playerPanel = new JPanel();
playerPanel.setLayout(new BorderLayout());
f.getContentPane().add(playerPanel);
f.pack();
f.setVisible(true);

try {
    URL url = new URL("file:///" +  new File(media).getCanonicalPath());
    player = Manager.createPlayer(url);
    player.addControllerListener(new VideoTooListener(playerPanel));
    player.start();
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:38,代码来源:JMFVideoToo.java

示例4: controllerUpdate

import javax.media.Player; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:22,代码来源:AudioReceiver.java

示例5: MediaPlayer

import javax.media.Player; //导入方法依赖的package包/类
public MediaPlayer(URL mediauUrl) {

        //initComponents();
        setLayout(new BorderLayout());

        try {
            Player mediaPlayer = Manager.createRealizedPlayer(new MediaLocator(mediauUrl));

            //setBackground(Color.BLACK);
            //setLayout(null);
            Component video = mediaPlayer.getVisualComponent();

            //video.setBounds((this.getWidth() /2)+(860/3), (this.getHeight() /2), 720, 480);
            if (video != null) {
                add(video, BorderLayout.CENTER);
            }

            mediaPlayer.start();

        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

    }
 
开发者ID:gabrielbiga,项目名称:Hook-FreshMeat,代码行数:25,代码来源:MediaPlayer.java

示例6: controllerUpdate

import javax.media.Player; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:22,代码来源:AudioReceiver.java

示例7: main

import javax.media.Player; //导入方法依赖的package包/类
public static void main(String args[]) {
   	JPanel	playerPanel;
   	Player 	player;

       if( args.length != 1 ) {
           System.err.println("Usage:");
           System.err.println("java ejmf.examples.basics.JMFManualControl <Media>");
           return;
       }

       String media = args[0];

JFrame f = new JFrame(media);

f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent event) {
 	System.exit(0);
    }
});

playerPanel = new JPanel();
playerPanel.setLayout(new BorderLayout());
f.getContentPane().add(playerPanel);
f.pack();
f.setVisible(true);

try {
    URL url = new URL("file:///" +  new File(media).getCanonicalPath());
    player = Manager.createPlayer(url);
    player.addControllerListener(new AudioControlListener(playerPanel));
    player.start();
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:37,代码来源:JMFManualControl.java

示例8: controllerUpdate

import javax.media.Player; //导入方法依赖的package包/类
public void controllerUpdate(ControllerEvent event) {
    Player p = (Player)event.getSourceController();
    if (event instanceof EndOfMediaEvent) {
    	p.setMediaTime(new Time(0));
    	p.start();
           }
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:8,代码来源:JMFAudioLoop.java

示例9: init

import javax.media.Player; //导入方法依赖的package包/类
/**
    * This method is run when PlayerDriver is an applet.
    */
   public void init() {
Player 	player;
       String 	media;
JPanel	playerPanel;

playerPanel = new JPanel();
playerPanel.setLayout(new BorderLayout());
add(playerPanel);

       // Get the media filename
       if((media = getParameter("MEDIA")) == null) {
           System.err.println("Invalid MEDIA file parameter");
           return;
       }
try {
    String name = new File(media).getCanonicalPath();
    URL url = new URL("file:///" + name);
    player = Manager.createPlayer(url);
           player.addControllerListener(new VideoTooListener(playerPanel));
           player.start();
       }
catch (Exception e) {
    e.printStackTrace();
}

   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:30,代码来源:JMFVideoToo.java

示例10: init

import javax.media.Player; //导入方法依赖的package包/类
/**
    * This method is run when PlayerDriver is an applet.
    */
   public void init() {
       String 	media;
Player	player;

       // Get the media filename
       if((media = getParameter("MEDIA")) == null) {
           System.err.println("Invalid MEDIA file parameter");
           return;
       }

       JFrame f = new JFrame(media);
       JPanel playerpanel = new JPanel();

try {
    URL url = new URL("file:///" + new File(media).getCanonicalPath());
    player = Manager.createRealizedPlayer(url);
           add(playerpanel);
           player.start();
       }
catch (MalformedURLException mfe) {
    System.out.println("Bad URL");
}
catch (IOException ioe) {
    System.out.println("IO Error");
}
catch (NoPlayerException npe) {
    System.out.println("No player");
} catch (CannotRealizeException e)
{
	e.printStackTrace();
} 
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:36,代码来源:HelloWorld.java

示例11: MediaPanel

import javax.media.Player; //导入方法依赖的package包/类
public MediaPanel( URL mediaURL )
{
   setLayout( new BorderLayout() ); // use a BorderLayout
   
   // Use lightweight components for Swing compatibility
   Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
   
   try
   {
      // create a player to play the media specified in the URL
      Player mediaPlayer = Manager.createRealizedPlayer( mediaURL );
      
      // get the components for the video and the playback controls
      Component video = mediaPlayer.getVisualComponent();
      Component controls = mediaPlayer.getControlPanelComponent();
      
      if ( video != null ) 
         add( video, BorderLayout.CENTER ); // add video component

      if ( controls != null ) 
         add( controls, BorderLayout.SOUTH ); // add controls
      
      mediaPlayer.start(); // start playing the media clip
   } // end try
   catch ( NoPlayerException noPlayerException )
   {
      System.err.println( "No media player found" );
   } // end catch
   catch ( CannotRealizeException cannotRealizeException )
   {
      System.err.println( "Could not realize media player" );
   } // end catch
   catch ( IOException iOException )
   {
      System.err.println( "Error reading from the source" );
   } // end catch
}
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:38,代码来源:MediaPanel.java

示例12: controllerUpdate

import javax.media.Player; //导入方法依赖的package包/类
/**
 * 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();
        
        Component vc = p.getVisualComponent();
        System.out.println("Start1.1" + vc);
        if ( null != vc )
        {
            System.out.println("### visual component is " + vc);

            JFrame aFrame = new JFrame("Video Frame");
            JPanel aPanel = new JPanel();
            aPanel.setBounds(0, 0, 176, 144);
            aPanel.add(vc);
            aFrame.add(aPanel);

            aPanel.setBackground(Color.gray);

            vc.setVisible(true);
            aPanel.setVisible(true);
            aFrame.setVisible(true);
            aFrame.pack();
        }
    }

    if (ce instanceof ControllerErrorEvent) {
        p.removeControllerListener(this);
        System.err.println("Receiver internal error: " + ce);
    }

}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:42,代码来源:VideoReceiver.java

示例13: blockingStart

import javax.media.Player; //导入方法依赖的package包/类
/**
 * Casts the Controller to a Player, calls start(), and
 * blocks the current thread until the player is Started.
 *
 * @return     boolean indicating whether the transition was
 *             successful.
 *
 * @exception  ClassCastException
 *             If the Controller is not a Player
 */
public boolean blockingStart() {
    setState(Controller.Started);
    Player player = (Player)controller;
    player.start();
    return waitForState();
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:17,代码来源:StateWaiter.java


注:本文中的javax.media.Player.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。