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


Java MediaLocator类代码示例

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


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

示例1: deassignTrack

import javax.media.MediaLocator; //导入依赖的package包/类
/**
* Deassign Track at index in the TrackModel.
* @param index Index of Track to be deassigned.
*/
   public void deassignTrack(int index) {
Debug.printObject("enter deassignTrack : " + index);
// Decrement now so that if listeners act in response
// to event generated below, they will get correct number
// of tracks.
synchronized (this) {
    availableCount++;	
}
Track track = getTrack(index);
track.close();
setMediaLocator(index, new MediaLocator("unassigned"));
setPlayingTime(index, 0);
setStartTime(index, 0);
fireTrackModelUpdate(new TrackModelDeassignEvent(this, index));
Debug.printObject("exit deassignTrack : " + index);
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:21,代码来源:TrackModel.java

示例2: MultiPlayer

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

示例3: parseMixFileData

import javax.media.MediaLocator; //导入依赖的package包/类
/**
* Create a TrackList from a MixFileData object.
* @param mfd An ejmf.toolkit.util.MixFileData reference
* @return a TrackLlist
*/
   public static TrackList parseMixFileData(MixFileData mfd) {
int n = mfd.getNumberOfTracks();
       TrackList trackList = new TrackList(n);
for (int i = 0; i < n; i++) {
    MixTrackData mtd = mfd.getMixTrackData(i);
           try {
	Track track = Track.createTrack(i, 
			new MediaLocator(mtd.mediaFileName), 
			mtd.startTime,
			mtd.playingTime);
               trackList.addTrack(track);
           } catch (Exception e) {
	e.printStackTrace();
               System.err.println(
	    "Can't create Player for " + mtd.mediaFileName);
               continue;
           }
   	}
       trackList.trimToSize();
       return trackList;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:27,代码来源:TrackList.java

示例4: PlayerPanel

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

示例5: createAndDisplayPlayers

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

示例6: createDataSink

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

示例7: createMediaLocator

import javax.media.MediaLocator; //导入依赖的package包/类
/**
    * Create a media locator from the given string.
    */
   static MediaLocator createMediaLocator(String url) {

MediaLocator ml;

if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
    return ml;

if (url.startsWith(File.separator)) {
    if ((ml = new MediaLocator("file:" + url)) != null)
	return ml;
} else {
    String file = "file:" + System.getProperty("user.dir") + File.separator + url;
    if ((ml = new MediaLocator(file)) != null)
	return ml;
}

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

示例8: createTransmitter

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

示例9: parseLocator

import javax.media.MediaLocator; //导入依赖的package包/类
protected void parseLocator(MediaLocator locator) {
String rem = locator.getRemainder();
// Strip off starting slashes
while (rem.startsWith("/") && rem.length() > 1)
    rem = rem.substring(1);
StringTokenizer st = new StringTokenizer(rem, "/");
if (st.hasMoreTokens()) {
    // Parse the position
    String position = st.nextToken();
    StringTokenizer nums = new StringTokenizer(position, ",");
    String stX = nums.nextToken();
    String stY = nums.nextToken();
    String stW = nums.nextToken();
    String stH = nums.nextToken();
    x = Integer.parseInt(stX);
    y = Integer.parseInt(stY);
    width = Integer.parseInt(stW);
    height = Integer.parseInt(stH);
}
if (st.hasMoreTokens()) {
    // Parse the frame rate
    String stFPS = st.nextToken();
    frameRate = (Double.valueOf(stFPS)).floatValue();
}
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:LiveStream.java

示例10: initialize

import javax.media.MediaLocator; //导入依赖的package包/类
/**
 * Initialize the Audio Channel to make it able to send and receive audio
 */
public void initialize() {

    String ip;
    String localIp;
    int localPort;
    int remotePort;

    if (this.getLocal().getSymmetric() != null) {
        ip = this.getLocal().getIp();
        localIp = this.getLocal().getLocalIp();
        localPort = getFreePort();
        remotePort = this.getLocal().getSymmetric().getPort();

        LOGGER.fine(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort);

    }
    else {
        ip = this.getRemote().getIp();
        localIp = this.getLocal().getLocalIp();
        localPort = this.getLocal().getPort();
        remotePort = this.getRemote().getPort();
    }

    audioChannel = new AudioChannel(new MediaLocator(this.getMediaLocator()), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()),this);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:29,代码来源:AudioMediaSession.java

示例11: AudioChannel

import javax.media.MediaLocator; //导入依赖的package包/类
/**
 * Creates an Audio Channel for a desired jmf locator. For instance: new MediaLocator("dsound://")
 *
 * @param locator         media locator
 * @param localIpAddress  local IP address
 * @param remoteIpAddress remote IP address
 * @param localPort       local port number
 * @param remotePort      remote port number
 * @param format          audio format
 */
public AudioChannel(MediaLocator locator,
        String localIpAddress,
        String remoteIpAddress,
        int localPort,
        int remotePort,
        Format format, JingleMediaSession jingleMediaSession) {

    this.locator = locator;
    this.localIpAddress = localIpAddress;
    this.remoteIpAddress = remoteIpAddress;
    this.localPort = localPort;
    this.portBase = remotePort;
    this.format = format;
    this.jingleMediaSession = jingleMediaSession;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:26,代码来源:AudioChannel.java

示例12: parseLocator

import javax.media.MediaLocator; //导入依赖的package包/类
protected void parseLocator(MediaLocator locator) {
	String rem = locator.getRemainder();
	// Strip off starting slashes
	while (rem.startsWith("/") && rem.length() > 1)
		rem = rem.substring(1);
	StringTokenizer st = new StringTokenizer(rem, "/");
	if (st.hasMoreTokens()) {
		// Parse the position
		String position = st.nextToken();
		StringTokenizer nums = new StringTokenizer(position, ",");
		String stX = nums.nextToken();
		String stY = nums.nextToken();
		String stW = nums.nextToken();
		String stH = nums.nextToken();
		x = Integer.parseInt(stX);
		y = Integer.parseInt(stY);
		width = Integer.parseInt(stW);
		height = Integer.parseInt(stH);
	}
	if (st.hasMoreTokens()) {
		// Parse the frame rate
		String stFPS = st.nextToken();
		frameRate = (Double.valueOf(stFPS)).floatValue();
	}
}
 
开发者ID:mloobo,项目名称:Dolphin-Streaming-Server,代码行数:26,代码来源:StreamPantalla.java

示例13: MediaPlayer

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

import javax.media.MediaLocator; //导入依赖的package包/类
/**
 * Initialize the Audio Channel to make it able to send and receive audio
 */
public void initialize() {

    String ip;
    String localIp;
    int localPort;
    int remotePort;

    if (this.getLocal().getSymmetric() != null) {
        ip = this.getLocal().getIp();
        localIp = this.getLocal().getLocalIp();
        localPort = getFreePort();
        remotePort = this.getLocal().getSymmetric().getPort();

        LOGGER.debug(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort);

    }
    else {
        ip = this.getRemote().getIp();
        localIp = this.getLocal().getLocalIp();
        localPort = this.getLocal().getPort();
        remotePort = this.getRemote().getPort();
    }

    audioChannel = new AudioChannel(new MediaLocator(this.getMediaLocator()), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()),this);
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:29,代码来源:AudioMediaSession.java

示例15: createPlayer

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


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