JavaFX MediaPlayer在Ubuntu 14.04 64位 [英] JavaFX MediaPlayer in Ubuntu 14.04 64 bits

查看:430
本文介绍了JavaFX MediaPlayer在Ubuntu 14.04 64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Ubuntu 14.04 64位中执行下面的简单程序。

I am trying to execute the simple program below in Ubuntu 14.04 64 bits.

import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.media.*;
import javafx.stage.Stage;

public class simple extends Application {
  public static void main(String[] args) throws Exception { launch(args); }
  @Override public void start(final Stage stage) throws Exception {
    final MediaPlayer oracleVid = new MediaPlayer(
      new Media("http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8")
    );
        oracleVid.setAutoPlay(true);
    stage.setScene(new Scene(new Group(new MediaView(oracleVid)), 540, 208));
    stage.show();

    oracleVid.play();
  }
}

我知道视频和音频格式是正确的。实际上,这个URL取自JavaFX的演示。此外,我已经使用JavaSDK 1.7和相同的硬件在Ubuntu 13.10中测试了应用程序,一切都很好。该应用程序也在Windows中执行。但是,当我在Ubuntu 14.04中同时尝试Java SDK 1.7和1.8时,它失败了。

I know that the video and audio format are correct. Actually, this URL was taken from a JavaFX's demo. Moreover, I already tested the application in Ubuntu 13.10 with JavaSDK 1.7 and the same hardware, everything was Ok. The application also executes in Windows. However, it fails when I try in Ubuntu 14.04 for both, Java SDK 1.7 and 1.8.

我想它与我在配置中缺少的某些编解码器有关或者到某个14.04不可用的库。

I guess it is related either to some codec I am missing in my configuration or to some library which is not available in 14.04.

对我来说最糟糕的是应用程序失败的方式。它不会抛出异常,它不会因分段错误而崩溃,它不会抱怨某些丢失的库。相反,它只显示一个背景颜色的窗口,没有声音,视频或任何类型的日志。

The worst for me is the way the application fails. It doesn't throw an exception, it doesn't crash with a segmentation fault, it doesn't complaint about some missing library. Instead, it just shows a Window with the background colour, without sound, video or any kind of log.

有没有人遇到同样的问题?我一直在浏览几个小时,没有。

Have anyone run into the same problem? I have been browsing for hours and nothing.

编辑。
我一直在使用oracle-java。

EDIT. I am using oracle-java always.

推荐答案

这是在Ubuntu 14.04下运行的JavaFX的已知问题。

This is a known issue with JavaFX running under Ubuntu 14.04.

  • RT-37914 [Linux] JavaFX Media does not run on Ubuntu 14.04

此问题已针对Java 8u40修复。

The issue has been fixed for Java 8u40.

Java 8u40早期访问版本是可用,这样您就可以测试修复并确保它在您的系统上运行。

Java 8u40 early access builds are available so you can test the fix and ensure it works on your system.

这篇关于JavaFX MediaPlayer在Ubuntu 14.04 64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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