本文整理汇总了Java中uk.co.caprica.vlcj.player.MediaPlayerFactory类的典型用法代码示例。如果您正苦于以下问题:Java MediaPlayerFactory类的具体用法?Java MediaPlayerFactory怎么用?Java MediaPlayerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaPlayerFactory类属于uk.co.caprica.vlcj.player包,在下文中一共展示了MediaPlayerFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
/**
* Inicia el programa.
*
* @param args Ninguno.
*/
public static void main(String[] args) {
// Inicia DDS
iniciaDds();
// Crea la ventana del reproductor
Canvas canvas = new Canvas();
canvas.setBackground(Color.black);
JPanel contentPane = new JPanel();
contentPane.setBackground(Color.black);
contentPane.setLayout(new BorderLayout());
contentPane.add(canvas, BorderLayout.CENTER);
JFrame frame = new JFrame("Capture");
frame.setContentPane(contentPane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(50, 50);
frame.setSize(800, 600);
MediaPlayerFactory factory = new MediaPlayerFactory();
EmbeddedMediaPlayer mediaPlayer = factory.newEmbeddedMediaPlayer();
CanvasVideoSurface videoSurface = factory.newVideoSurface(canvas);
mediaPlayer.setVideoSurface(videoSurface);
// Reproduce el vídeo.
frame.setVisible(true);
mediaPlayer.playMedia("http://localhost:" + PORT);
}
示例2: initialize
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
/**
* Initialize the instance and create a new player.
*
* @param factory
* the factory for creating a new player
* @param volume
* the initial volume
*/
void initialize(final MediaPlayerFactory factory, final float volume) {
final MediaRenderer instance = this;
// Release the VLC player instance in the dedicated thread
mediaManager.executeThreadSafe(new Runnable() {
@Override
public void run() {
// Create the VLC media player instance
DirectMediaPlayer player = factory.newDirectMediaPlayer("RGBA", width, height, width * 4, instance);
player.setPlaySubItems(true);
player.setRepeat(true);
player.addMediaPlayerEventListener(listener = new PlayerEventListener(instance));
player.setVolume((int) (volume * 100));
instance.player = player;
}
});
}
示例3: VLCPlayer
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
VLCPlayer(ElphelVision parent) {
this.Parent = parent;
List<String> vlcArgs = new ArrayList<String>();
vlcArgs.add("--no-video-title-show");
vlcArgs.add("--rtsp-caching=50");
vlcArgs.add("--clock-jitter=0");
// This burns so many people on Windows that I decided to leave it in...
if (RuntimeUtil.isWindows()) {
vlcArgs.add("--plugin-path=" + WindowsRuntimeUtil.getVlcInstallDir() + "\\plugins");
}
// fullScreenStrategy = new
// DefaultFullScreenStrategy(Parent.GetMainframe());
mediaPlayerFactory = new MediaPlayerFactory(vlcArgs.toArray(new String[vlcArgs.size()]));
mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer(fullScreenStrategy);
// mediaPlayer = mediaPlayerFactory.newMediaPlayer(null);
}
示例4: VLCPlayer
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
VLCPlayer(ElphelVision parent) {
this.Parent = parent;
List<String> vlcArgs = new ArrayList<String>();
vlcArgs.add("--no-video-title-show");
vlcArgs.add("--rtsp-caching=50");
vlcArgs.add("--clock-jitter=0");
// This burns so many people on Windows that I decided to leave it in...
if (RuntimeUtil.isWindows()) {
vlcArgs.add("--plugin-path=" + WindowsRuntimeUtil.getVlcInstallDir() + "\\plugins");
}
//fullScreenStrategy = new DefaultFullScreenStrategy(Parent.GetMainframe());
mediaPlayerFactory = new MediaPlayerFactory(vlcArgs.toArray(new String[vlcArgs.size()]));
mediaPlayer = mediaPlayerFactory.newMediaPlayer(fullScreenStrategy);
//mediaPlayer = mediaPlayerFactory.newMediaPlayer(null);
}
示例5: create
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public void create(String filepath) throws Error {
camera = new OrthographicCamera();
camera.setToOrtho(false, w, h);
camera.update();
LibXUtil.initialise();
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), vlcpath);
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()
.createCompatibleImage((int) w, (int) h);
image.setAccelerationPriority(1.0f);
String[] args = null;
if ((System.getProperty("os.name").toLowerCase().indexOf("mac") >= 0)) {
String pluginpath = vlcpath.substring(0, vlcpath.lastIndexOf('/')) + "/plugins";
System.out.println(pluginpath);
uk.co.caprica.vlcj.binding.LibC.INSTANCE.setenv("VLC_PLUGIN_PATH", pluginpath, 1);
args = new String[] { "--no-video-title-show", "--verbose=3", "--vout=macosx" };
} else {
args = new String[] { "--no-video-title-show", "--verbose=3" };
}
factory = new MediaPlayerFactory(args);
mediaPlayer = factory.newDirectMediaPlayer(new TestBufferFormatCallback(), new TestRenderCallback());
mediaPlayer.prepareMedia(filepath);
mediaPlayer.start();
mediaPlayer.pause();
System.out.println(LibVlc.INSTANCE.libvlc_get_version());
}
示例6: MediaManager
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
/**
* Construct a new media manager.
*/
public MediaManager() {
// In order to prevent freezing when changing media, the player will be
// called from this dedicated thread
executor = Executors.newFixedThreadPool(1);
try {
factory = new MediaPlayerFactory(getFactoryOptions());
} catch (Throwable t) {
PlayBlock.log(Level.WARN, "Failed to find VLC!", t);
}
volume = PlayBlock.getClientRuntime().getClientOptions().getFloat("volume", 1);
}
示例7: setVideoRelease
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public void setVideoRelease(EmbeddedMediaPlayer mediaPlayer, MediaPlayerFactory mediaPlayerFactory) {
try {
mediaPlayerFactoryThread = mediaPlayerFactory;
mediaPlayerThread = mediaPlayer;
}
catch (Exception ex) {
logger.error("Video release " + ex.getLocalizedMessage(), ex);
}
}
示例8: getMediaPlayerFactory
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
private MediaPlayerFactory getMediaPlayerFactory(){
if(vlcfactory == null){
vlcfactory = createFactory();
releasePlayer();
}
return vlcfactory;
}
示例9: ScreenRecorder
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public ScreenRecorder() {
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), System.getProperty("user.dir")+"/lib");
System.setProperty("VLC_PLUGIN_PATH", System.getProperty("user.dir")+"/lib/plugins");
mediaPlayerFactory = new MediaPlayerFactory(OPTIONS);
mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
}
示例10: EpisodePanel
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public EpisodePanel(Frame owner){
this.owner = owner;
this.setLayout(new BorderLayout());
Canvas canvas = new Canvas();
canvas.setBackground(Color.black);
this.add(canvas, BorderLayout.CENTER);
player.setVideoSurface(new MediaPlayerFactory().newVideoSurface(canvas));
player.mute(true);
player.addMediaPlayerEventListener(new MediaPauserEventListener());
this.add(Box.createRigidArea(new Dimension(120, 140)), BorderLayout.SOUTH);
}
示例11: VlcPlayerImplementation
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
protected VlcPlayerImplementation(String[] options) {
this.mediaPlayerFactory = new MediaPlayerFactory(options);
mediaPlayer = this.mediaPlayerFactory.newEmbeddedMediaPlayer(null);
}
示例12: StreamServer
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public StreamServer(String libPath) {
LOGGER.info("add libvlc path" + libPath);
NativeLibrary.addSearchPath("libvlc", libPath);
mediaPlayerFactory = new MediaPlayerFactory();
}
示例13: StreamClient
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
public StreamClient(String libPath){
LOGGER.info("add libvlc path" + libPath);
NativeLibrary.addSearchPath("libvlc", libPath);
mediaPlayerFactory = new MediaPlayerFactory();
}
示例14: createMediaPlayer
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
private MediaPlayer createMediaPlayer(){
MediaPlayer mediaPlayer = null;
MediaPlayerFactory playerFactory = getMediaPlayerFactory();
mediaPlayer = playerFactory.newDirectMediaPlayer(formatCallback, renderCallback);
return mediaPlayer;
}
示例15: createFactory
import uk.co.caprica.vlcj.player.MediaPlayerFactory; //导入依赖的package包/类
private MediaPlayerFactory createFactory(){
logger.info("creating new MediaPlayerFactory...");
String[] myargs = args;
if(!applicationSettings.isEnableDirectPlaySound())
myargs = Lists.concat(args, directPlaySund);
return new MediaPlayerFactory(myargs);
}