Java Vlcj - 如何在EmbbededMediaPlayerComponent中更改媒体 [英] Java Vlcj - How to change media in EmbbededMediaPlayerComponent

查看:1331
本文介绍了Java Vlcj - 如何在EmbbededMediaPlayerComponent中更改媒体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个EmbbededMediaPlayerComponent和Javafx列表,其中包含可以在EmbbededMediaPlayerComponent中播放的url。然后,您单击的那个应该在EmbbededMediaPlayerComponent中播放。您选择的第一个网址工作正常并显示在播放器中。问题是,在我选择另一个网址之后,我想要将第一个网址替换为第二个网址。处理第一个媒体然后播放第二个媒体的正确方法是什么?

So I have a EmbbededMediaPlayerComponent and Javafx list full of urls which can be played in EmbbededMediaPlayerComponent. The one on which you click is then supposed to be played in EmbbededMediaPlayerComponent. The first url you choose works just fine and is displayed in the player. The thing is, after I choose another url I want the first one to be replaced with the second one. What is the correct way to dispose the first media and then play the second one?

推荐答案

我不确定它是否是正确的方式,但我会这样做:

I'm not sure if it's the "correct" way to do it but I would do:

EmbeddedMediaPlayerComponent.getMediaPLayer().playMedia(mrlToMedia);

如果我已经正确理解了这应该加载下一个文件并开始播放那个文件。

If I have understood correctly this should just load the next file and start playing that one.

也可以使用

EmbeddedMediaPlayerComponent.getMediaPLayer().startMedia(String mrl);

这应该尝试开始播放,区别在于这是一个阻止操作,直到播放开始。

which should try to start the playback with the difference that this is a blocking operation untill playback has started.

也可以这样做

EmbeddedMediaPlayerComponent.getMediaPLayer().prepareMedia(String mrl);
EmbeddedMediaPlayerComponent.getMediaPLayer().start();

这与上面的相同,但是分两步。

This is the same as the one above but in two steps.

这篇关于Java Vlcj - 如何在EmbbededMediaPlayerComponent中更改媒体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆