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


Java MediaPlayer类代码示例

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


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

示例1: getResolution

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
private String getResolution(File file){
	MediaPlayer player = EpisodePanel.player;
	
	if(player.isPlaying()){
		player.stop();
	}
	
	player.playMedia(file.getAbsolutePath());
	player.mute(true);
	while(player.getVideoDimension() == null){
		try {
			Thread.sleep(100);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	VideoTrackInfo track = (VideoTrackInfo) player.getTrackInfo(TrackType.VIDEO).get(0);
	player.stop();
	return track.height() + "P";
}
 
开发者ID:redSpoutnik,项目名称:AutoRename,代码行数:22,代码来源:EpisodeManager.java

示例2: playing

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
public void playing(MediaPlayer mediaPlayer) {
	if (msPerFrame <= 0) {
	    float fps = mediaPlayer.getFps();
	    if (fps > 1) {
	    	msPerFrame = (1000d / fps);
	    	stdev = msPerFrame / 2;
        }
    }
	List<IMediaPlayerListener> localObservers;
	synchronized(MUTEX) {
		localObservers = new ArrayList<IMediaPlayerListener>(observers);
	}
	for(IMediaPlayerListener l : localObservers){
		l.mediaStarted();
	}
}
 
开发者ID:UiL-OTS-labs-backoffice,项目名称:UiL-OTS-Video-Coding-System,代码行数:17,代码来源:VLCMediaPlayer.java

示例3: mediaStateChanged

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void mediaStateChanged(MediaPlayer mediaPlayer, int newState) {
	super.mediaStateChanged(mediaPlayer, newState);
	logger.debug("New State " + newState);
	Display display = Display.getDefault();
	//listener to handle displaying a new page when the audio ends
	if ((newState==6) && isPlaying){
		if (!target.equals(""))  {
			//run on the main UI thread
			display.syncExec(
					new Runnable() {
						public void run(){
							mainShell.runJscript(jscript, false);
							mainShell.displayPage(target);
						}
					});											
		}
		ComonFunctions comonFunctions = ComonFunctions.getComonFunctions();
		comonFunctions.processSrciptVars(scriptVar, mainShell.getGuideSettings());
		isPlaying = false;
	}
	display = null;
}
 
开发者ID:guide-me,项目名称:GuideMe,代码行数:24,代码来源:AudioPlayer.java

示例4: finished

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void finished(MediaPlayer mediaPlayer) {
	logger.debug("MediaListener finished");
	super.finished(mediaPlayer);
	try {
		//run on the main UI thread
		myDisplay.syncExec(
				new Runnable() {
					public void run(){
						mediaPanel.setVisible(false);
						imageLabel.setVisible(true);
						leftFrame.layout(true);
					}
				});											
	}
	catch (Exception ex) {
		logger.error(" MediaListener finished " + ex.getLocalizedMessage(), ex);
	}
}
 
开发者ID:guide-me,项目名称:GuideMe,代码行数:20,代码来源:MainShell.java

示例5: mediaStateChanged

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void mediaStateChanged(MediaPlayer lmediaPlayer, int newState) {
	super.mediaStateChanged(lmediaPlayer, newState);
	logger.debug("MediaListener newState: " + newState + " videoPlay: " + videoPlay +  " VideoTarget: " + videoTarget);
	try {
		if ((newState==5 || newState==6) && videoPlay){
				if (!videoTarget.equals(""))  {
					//run on the main UI thread
					myDisplay.syncExec(
							new Runnable() {
								public void run(){
									logger.debug("MediaListener Video Run: " + videoJscript + " videoTarget: " + videoTarget);
									mainShell.runJscript(videoJscript, false);
									mainShell.displayPage(videoTarget);
								}
							});											
				}
				comonFunctions.processSrciptVars(videoScriptVar, guideSettings);
		}
	} catch (Exception e) {
		logger.error("mediaStateChanged " + e.getLocalizedMessage(), e);
	}
}
 
开发者ID:guide-me,项目名称:GuideMe,代码行数:24,代码来源:MainShell.java

示例6: playing

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void playing(MediaPlayer mediaPlayer) {
    stop.setEnabled(true);
    stop.setText("❚❚");
    long len = PLAYER.getLength();
    timeSlider.setMaximum((int) TimeUnit.MILLISECONDS.toSeconds(len));
    max.setText(TimeUnit.MILLISECONDS.toHours(len) +
                ":" +
                TimeUnit.MILLISECONDS.toMinutes(len) +
                ":" +
                TimeUnit.MILLISECONDS.toSeconds(len));
}
 
开发者ID:RanolP,项目名称:YtQueue,代码行数:13,代码来源:VideoViewer.java

示例7: finished

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void finished(MediaPlayer mediaPlayer) {
    stop.setEnabled(false);
    stop.setText("▶");
    timeSlider.setValue(0);
    component.getVideoSurface().repaint();
}
 
开发者ID:RanolP,项目名称:YtQueue,代码行数:8,代码来源:VideoViewer.java

示例8: run

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
public void run(String file) throws Exception {
        MediaPlayer player = mediaPlayerFactory.newHeadlessMediaPlayer();
        // TODO: change the listener
        player.addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
            @Override
            public void finished(uk.co.caprica.vlcj.player.MediaPlayer mediaPlayer) {
                LOGGER.info("stream finished");
            }
        });

        String mrl = "rtsp://:8554/vlc";
        // TODO: allow display and save file at same time
//        String options = ":sout=#transcode{vcodec=h264,venc=x264{cfr=16},scale=1,acodec=mp4a,ab=160,channels=2,samplerate=44100}:file{dst=D:/pt/t.mp4}";
        player.playMedia(mrl, getOptions(file));

        boolean shouldStop = false;
        while (!shouldStop) {
            Thread.sleep(1000);
            LOGGER.debug("waiting for vlc to finish receiving stream");
            if (player.getTime() == -1) {
                player.stop();
                player.release();
                shouldStop = true;
            }
        }

        mediaPlayerFactory.release();
        writeFinishFlag(file);
    }
 
开发者ID:at15,项目名称:cs433,代码行数:30,代码来源:StreamClient.java

示例9: timeChanged

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
public void timeChanged(MediaPlayer mediaPlayer, long newTime) {
	if (msPerFrame <= 0) {
		float fps = mediaPlayer.getFps();
		if (fps > 1) {
			msPerFrame = (1000d / fps);
			stdev = msPerFrame / 2;
		}
	}
	mediaTimeChanged();
}
 
开发者ID:UiL-OTS-labs-backoffice,项目名称:UiL-OTS-Video-Coding-System,代码行数:11,代码来源:VLCMediaPlayer.java

示例10: paused

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void paused(MediaPlayer arg0) {
	List<IMediaPlayerListener> localObservers;
	synchronized(MUTEX) {
		localObservers = new ArrayList<IMediaPlayerListener>(observers);
	}
	for(IMediaPlayerListener l : localObservers){
		l.mediaPaused();
	}
}
 
开发者ID:UiL-OTS-labs-backoffice,项目名称:UiL-OTS-Video-Coding-System,代码行数:11,代码来源:VLCMediaPlayer.java

示例11: finished

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void finished(MediaPlayer mediaPlayer) {
    // Used for YouTube videos
    List<String> subItems = mediaPlayer.subItems();
    if (subItems != null && !subItems.isEmpty()) {
        String subItemURI = subItems.get(0);
        mediaPlayer.playMedia(subItemURI);
    } else {
        renderer.setState(RendererState.STOPPED);
    }
}
 
开发者ID:sk89q,项目名称:playblock,代码行数:12,代码来源:PlayerEventListener.java

示例12: playing

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void playing(MediaPlayer mediaPlayer) {
    renderer.setState(RendererState.PLAYING);
    long position = getSeekPosition();
    if (position > 0) {
        mediaPlayer.setTime(position);
    }
}
 
开发者ID:sk89q,项目名称:playblock,代码行数:9,代码来源:PlayerEventListener.java

示例13: playMedia

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void playMedia(String file) {
	lastPlayedMedia = file;
	// vlc(j) path fix
	file = file.replace("file:/", "file:///");

	MediaPlayer mediaPlayer = _mediaPlayer;
	if(mediaPlayer != null){
		boolean success = mediaPlayer.playMedia(file);
           logger.debug("playMedia succeeded? " + success + " - playing file: " + file);
	}else{
           logger.error("Media player not available!");
	}
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:15,代码来源:VLCMediaController.java

示例14: setCropGeometry

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public void setCropGeometry(String aspectRatio) {
	MediaPlayer mediaPlayer = _mediaPlayer;
	if(mediaPlayer != null){
		mediaPlayer.setCropGeometry(aspectRatio);
	}else {
           logger.error("media player not available!");
	}
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:10,代码来源:VLCMediaController.java

示例15: setScale

import uk.co.caprica.vlcj.player.MediaPlayer; //导入依赖的package包/类
@Override
public  void setScale(float factor){
	MediaPlayer mediaPlayer = _mediaPlayer;
	if(mediaPlayer != null){
		mediaPlayer.setScale(factor);
           logger.debug("scale set to " + factor + " scale is now " + mediaPlayer.getScale());
	}else {
           logger.error("Media player not available!");
	}
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:11,代码来源:VLCMediaController.java


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