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


Java NoPlayerException类代码示例

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


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

示例1: init

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

示例2: PlayerPanel

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

示例3: createAndDisplayPlayers

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

示例4: setURL

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

示例5: setMediaLocator

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

示例6: setDataSource

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

示例7: init

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

示例8: createTrack

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

示例9: assignTrack

import javax.media.NoPlayerException; //导入依赖的package包/类
/** 
* Assign a new Track. Suppress update notification of obj.
   	*
* @param fileName media file name from which Player will be built.
* @param stTime	Offset at which media begins to play.
* @param plTime Length of time media is played.
* @exception IOException thrown if DataSource can not
* be connected to.
* @exception NoPlayerException thrown if no handler exists
* for Player
* @exception IllegalArgumentException thrown if file name argument
* can not be converted to media locator.
*/
   public void 
assignTrack(String fileName, double stTime, double plTime)
		throws IllegalArgumentException,
			IOException,
			NoPlayerException
   {
int index = getAvailableTrack();

MediaLocator ml = Utility.appArgToMediaLocator(fileName);
if (ml == null) {
    throw new IllegalArgumentException("Bad media file name");
}
// Increment up front so that if listeners act in response
// to event generated below, they will get correct number
// of tracks.
synchronized (this) {
    availableCount--;
}

Player player = Manager.createPlayer(ml);
setMediaLocator(index, ml);
setPlayer(index, player);
setStartTime(index, stTime);
setPlayingTime(index, plTime);
fireTrackModelUpdate(new TrackModelAssignEvent(this, index));
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:40,代码来源:TrackModel.java

示例10: NPlayerPanel

import javax.media.NoPlayerException; //导入依赖的package包/类
/**
    * Create an NPlayerPanel from a MixFileData object
    * For each element a Player is created and
    * its visual component displayed.
    * 
    * @param mixList a MixFileData object
* @exception NoPlayerException if Player can not be constructed.
* @exception IOException if DataSource can not be connected to.
    * @see ejmf.toolkit.util.MixTrackData
    * @see ejmf.toolkit.util.MixFileData
    */
   public NPlayerPanel(MixFileData mixList) 
	throws NoPlayerException, IOException {

int n = mixList.getNumberOfTracks();
MediaLocator[] mls = new MediaLocator[n];
for (int i = 0; i < n; i++) {
    MixTrackData d = mixList.getMixTrackData(i);
    mls[i] = Utility.appArgToMediaLocator(d.mediaFileName);
}
createAndDisplayPlayers(mls);
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:23,代码来源:NPlayerPanel.java

示例11: getAudioPlayer

import javax.media.NoPlayerException; //导入依赖的package包/类
public static AudioPlayer getAudioPlayer(File media) {
    AudioPlayer player = null;
    try {
        player = new AudioPlayer(media);
    } catch (IOException | NoPlayerException | CannotRealizeException e) {
        getLogger(AudioPlayer.class.getName()).log(Level.WARNING, "fail to create an AudioPlayer due to {0}", e.getClass().getSimpleName());
    }
    return player;
}
 
开发者ID:toyboxman,项目名称:yummy-xml-UI,代码行数:10,代码来源:AudioPlayer.java

示例12: MediaPanel

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

示例13: load

import javax.media.NoPlayerException; //导入依赖的package包/类
public void load(URL contents) throws IOException, SecurityException {
    dispose();
    try {
        player = Manager.createPlayer(contents);
    } catch (NoPlayerException e) {
        IOException ioe = new IOException();
        ioe.initCause(e);
        throw ioe;
    }
}
 
开发者ID:ShiftMediaProject,项目名称:libbluray,代码行数:11,代码来源:HSound.java

示例14: AudioPlayer

import javax.media.NoPlayerException; //导入依赖的package包/类
private AudioPlayer(File f) throws MalformedURLException, IOException, NoPlayerException, CannotRealizeException {
    audioPlayer = Manager.createRealizedPlayer(f.toURI().toURL());
}
 
开发者ID:toyboxman,项目名称:yummy-xml-UI,代码行数:4,代码来源:AudioPlayer.java

示例15: TestAudioUtil

import javax.media.NoPlayerException; //导入依赖的package包/类
public TestAudioUtil(File f) throws MalformedURLException, IOException, NoPlayerException, CannotRealizeException {
    audioPlayer = Manager.createRealizedPlayer(f.toURI().toURL());
}
 
开发者ID:toyboxman,项目名称:yummy-xml-UI,代码行数:4,代码来源:TestAudioUtil.java


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