• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Manager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

import javax.media.Manager; //导入依赖的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: init

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

       // Get the media filename
       if((media = getParameter("MEDIA")) == null) {
           System.err.println("Invalid MEDIA file parameter");
           return;
       }
try {
    URL url = new URL(getCodeBase(), media);
    player = Manager.createPlayer(url);
       } catch (NoPlayerException e) {
    System.out.println("Could not create player");
} catch (MalformedURLException mfe) {
    System.out.println("Bad URL");
} catch (IOException ioe) {
    System.out.println("IO error creating player");
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:22,代码来源:JMFAudioOnly.java


示例3: init

import javax.media.Manager; //导入依赖的package包/类
/**
    * This method is run when PlayerDriver is an applet.
    */
   public void init() {
playerPanel = new JPanel();
playerPanel.setLayout(new BorderLayout());
getContentPane().add(playerPanel);

       // Get the media filename
       if((media = getParameter("MEDIA")) == null) {
           System.err.println("Invalid MEDIA file parameter");
           return;
       }
try {
    URL url = new URL(getCodeBase(), media);
    player = Manager.createPlayer(url);
           player.addControllerListener(new AudioControlListener(playerPanel));
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:23,代码来源:JMFManualControl.java


示例4: main

import javax.media.Manager; //导入依赖的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


示例5: init

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

       // Get the media filename
       if((media = getParameter("MEDIA")) == null) {
           System.err.println("Invalid MEDIA file parameter");
           return;
       }
try {
    URL url = new URL(getCodeBase(), media);
    player = Manager.createPlayer(url);
           player.addControllerListener(new LoopListener());
       }
catch (Exception e) {
    e.printStackTrace();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:20,代码来源:JMFAudioLoop.java


示例6: main

import javax.media.Manager; //导入依赖的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


示例7: main

import javax.media.Manager; //导入依赖的package包/类
public static void main(String args[]) {
       if( args.length == 0 ) {
           System.out.println("Specify at least one media URL/file");
 	    return;
       }
      
       Vector v = new Vector();

       //  Create a Vector of Players
       for(int i = 0; i < args.length; i++) {
           try {
               Player p = Manager.createPlayer(
                   Utility.appArgToMediaLocator(args[i]) );
               new StateWaiter(p).blockingRealize();
               v.addElement(p);
           } catch(Exception e) {
               System.out.println( "Could not create Player for " + args[i]);
	e.printStackTrace();
           }
       }

       //  Choose a Master
       players = new Player[ v.size() ];
       v.copyInto(players);
new XSync(players);
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:27,代码来源:XSync.java


示例8: MultiPlayer

import javax.media.Manager; //导入依赖的package包/类
/** 
    * Create a MultiPlayer from an array of media file names.
* @param mediaFiles An array of media file names		
* @param mpc A MultiPlayerControl strategy. 
    */

   public MultiPlayer(String[] mediaFiles, MultiPlayerControl mpc) {
tracks = new TrackList(mediaFiles.length);
for (int i = 0; i < mediaFiles.length; i++) {
    try {
        String path = new File(mediaFiles[i]).getCanonicalPath();
        MediaLocator ml = Utility.appArgToMediaLocator(path);
        Player player = Manager.createPlayer(ml);
        tracks.addElement(new Track(i, ml, player));
    } catch (Exception e) {
	System.err.println(
	    "Unable to create Player from " + mediaFiles[i]);
	continue;
	    }
}
nActiveTracks = addAsListener(tracks);
setControlStrategy(mpc);
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:24,代码来源:MultiPlayer.java


示例9: PlayerPanel

import javax.media.Manager; //导入依赖的package包/类
/**
 * Constructs a PlayerPanel for the given MediaLocator.
 *
 * @exception  IOException
 *             If an I/O error occurs while accessing the
 *             media.
 *
 * @exception  NoPlayerException
 *             If a Player cannot be created from the given
 *             MediaLocator.
 */
public PlayerPanel(MediaLocator locator)
    throws IOException, NoPlayerException
{
    player = Manager.createPlayer(locator);

    mediaPanel = new JPanel();
    mediaPanel.setLayout( new BorderLayout() );
    mediaPanel.setBorder(mediaBorder);
    setBorder( BorderConstants.emptyBorder );

    loadingLabel =
        new JLabel(LOADLABEL);

    loadingLabel.setFont(
        new Font("Dialog", Font.BOLD, 12) );

    add(loadingLabel);
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:30,代码来源:PlayerPanel.java


示例10: createAndDisplayPlayers

import javax.media.Manager; //导入依赖的package包/类
private void createAndDisplayPlayers(MediaLocator[] mls) 
		throws NoPlayerException, IOException {
StateWaiter	waiter;

setLayout(createLayout(mls.length));

players = new Player[mls.length];
for (int i = 0; i < mls.length; i++) {
    players[i] = Manager.createPlayer(mls[i]);
    waiter = new StateWaiter(players[i]);
    waiter.blockingRealize();

    displayPlayer(players[i], mls[i]);

    waiter.blockingPrefetch();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:18,代码来源:NPlayerPanel.java


示例11: createDataSink

import javax.media.Manager; //导入依赖的package包/类
/**
    * Create the DataSink.
    */
   DataSink createDataSink(Processor p, MediaLocator outML) {

DataSource ds;

if ((ds = p.getDataOutput()) == null) {
    System.err.println("Something is really wrong: the processor does not have an output DataSource");
    return null;
}

DataSink dsink;

try {
    System.err.println("- create DataSink for: " + outML);
    dsink = Manager.createDataSink(ds, outML);
    dsink.open();
} catch (Exception e) {
    System.err.println("Cannot create the DataSink: " + e);
    return null;
}

return dsink;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:JpegImagesToMovie.java


示例12: createTransmitter

import javax.media.Manager; //导入依赖的package包/类
private String createTransmitter() {
// Create a media locator for the RTP data sink.
// For example:
//    rtp://129.130.131.132:42050/video
String rtpURL = "rtp://" + ipAddress + ":" + port + "/video";
MediaLocator outputLocator = new MediaLocator(rtpURL);

// Create a data sink, open it and start transmission. It will wait
// for the processor to start sending data. So we need to start the
// output data source of the processor. We also need to start the
// processor itself, which is done after this method returns.
try {
    rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
    rtptransmitter.open();
    rtptransmitter.start();
    dataOutput.start();
} catch (MediaException me) {
    return "Couldn't create RTP data sink";
} catch (IOException ioe) {
    return "Couldn't create RTP data sink";
}

return null;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:25,代码来源:VideoTransmit.java


示例13: MediaPlayer

import javax.media.Manager; //导入依赖的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


示例14: createPlayer

import javax.media.Manager; //导入依赖的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


示例15: setMediaLocator

import javax.media.Manager; //导入依赖的package包/类
private void setMediaLocator(MediaLocator medialocator)
    throws
    NoDataSourceException,
    NoPlayerException,
    IOException
{
    this.medialocator = medialocator;
    protocol = medialocator.getProtocol();
    setDataSource( Manager.createDataSource(medialocator) );
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:11,代码来源:MediaInfo.java


示例16: setDataSource

import javax.media.Manager; //导入依赖的package包/类
private void setDataSource(DataSource datasource)
    throws
    NoPlayerException,
    IOException
{
    this.datasource = datasource;
    contentType = datasource.getContentType();
    setPlayer(Manager.createPlayer(datasource));
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:10,代码来源:MediaInfo.java


示例17: main

import javax.media.Manager; //导入依赖的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


示例18: init

import javax.media.Manager; //导入依赖的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


示例19: init

import javax.media.Manager; //导入依赖的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


示例20: createTrack

import javax.media.Manager; //导入依赖的package包/类
/**	
* Create and return a Track from input values.
* @param i The index of Track
* @param ml The MediaLocator for locating Player
* @param startTime start time offset in milliseconds
* @param playingTime playing time in milliseconds
* @exception IOException thrown if DataSource can not
* be connected to.
* @exception NoPlayerException thrown if no handler exists
* for Player
*/
   public static Track createTrack(int i, 
		MediaLocator ml, 
		double startTime, 
		double playingTime) 
	throws IOException, NoPlayerException {

       Player p = Manager.createPlayer(ml);
       Track track = new Track(i);
       track.setPlayer(p);
       track.setMediaLocator(ml);
       track.setStartTime(startTime);
       track.setPlayingTime(playingTime);
return track;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:Track.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Constraint类代码示例发布时间:2022-05-21
下一篇:
Java MaxIterationsExceededException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap