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


Java Player.addControllerListener方法代码示例

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


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

示例2: 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

示例3: installPlayer

import javax.media.Player; //导入方法依赖的package包/类
/** In response to TrackModelEvent, add a Player.
    *  initPlayer is called to bring Player to prefetched
    *  state. If a ViewingPanel exists, the Player screen
    *  is displayed. Newly added Player adopts TimeBase
    *  of current master Player.
    *
    *  @param tm TrackModel to which Player is being added.
    *  @param index which track is getting a new Player
    *  @see javax.media.TimeBase
    *  @see ejmf.toolkit.multiplayer.TrackModelAssignEvent 
    *  @see ejmf.toolkit.multiplayer.TrackModel
    *  @see ejmf.toolkit.gui.ViewingPanel
    *  @see ejmf.toolkit.gui.ViewScreen
    *   
    */
   private void installPlayer(TrackModel tm, int index)  {
Debug.printObject("enter installPlayer : " + index);
Track	track = tracks.getTrack(index);
Player 	player = track.getPlayer();

player.addControllerListener(this);
synchronized (this) {
    nActiveTracks++;
}
if (viewingPanel != null)
    viewingPanel.addScreen(track.getMediaLocator().toString(),
			player, 
			ViewingPanel.DISPLAY_BOTH);
Debug.printObject("exit installPlayer : " + index);
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:31,代码来源:MultiPlayer.java

示例4: createPlayer

import javax.media.Player; //导入方法依赖的package包/类
private static synchronized Player createPlayer(String mediaUri) {
    try {
        URL url = replaceJarUrlWithFileUrl(ResourceManager.getResource(mediaUri), mediaUri);

        MediaLocator locator = new MediaLocator(url);
        final Player mediaPlayer = Manager.createRealizedPlayer(locator);

        // add a listener to put us in an infinite loop
        mediaPlayer.addControllerListener(new ControllerListener() {
            public void controllerUpdate(ControllerEvent evt) {
                if(evt instanceof EndOfMediaEvent) {
                    mediaPlayer.setMediaTime(new Time(0));
                    mediaPlayer.start();
                }
            }
        });
        return mediaPlayer;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:humphrej,项目名称:flexdock,代码行数:23,代码来源:MediaPanel.java

示例5: 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

示例6: 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

示例7: AbstractControls

import javax.media.Player; //导入方法依赖的package包/类
protected AbstractControls(Player player) {

	if (player.getState() < Controller.Realized)
	    throw new NotRealizedError("Player must be realized");

	this.player = player;
        makeControls();
        setControlsPlayer(player);
	player.addControllerListener(this);
    }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:11,代码来源:AbstractControls.java

示例8: StateHelper

import javax.media.Player; //导入方法依赖的package包/类
public StateHelper(Player p) {
player = p;
p.addControllerListener(this);
  }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:5,代码来源:StateHelper.java


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