简体   繁体   English

文件未完成时,JavaFX MediaPlayer停止

[英]JavaFX MediaPlayer stops when file isn't complete

I have a MediaPlayer and when there is a file that it is trying to play that isn't fully downloaded, it just stops. 我有一个MediaPlayer ,当它尝试播放的文件没有完全下载时,它就停止了。 There is no indication that it has stopped either, just that there is no more audio. 也没有迹象表明它已经停止,只是没有更多的音频。 I have tried outputing the status of the MediaPlayer with a ChangeListener , but the status doesn't change when it stops. 我尝试使用ChangeListener输出MediaPlayer的状态,但是停止时状态不会改变。 Any ideas on how to detect this event? 关于如何检测此事件的任何想法? I assume this is easy enough to understand without code :). 我认为这很容易理解,而无需代码:)。

I think this also might happen if trying to play a download ing file, not sure though. 我觉得这一点,如果尝试播放下载荷兰国际集团的文件,不知道虽然还可能发生。

The darn MediaPlayer was being garbage collected. 该死的MediaPlayer正在被垃圾回收。 I was so sure it wasn't because it was a field, come to find that the entire program was being garbage collected. 我确定不是因为它是一个字段,所以才发现整个程序都在被垃圾回收。 Stupid me. 愚蠢的我。

I highly recommend, anybody else that has stopping problems with MediaPlayer , check thoroughly for garbage collection. 我强烈建议其他人停止MediaPlayer问题,请彻底检查垃圾回收。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM