小编jua*_*ito的帖子

JavaFx MediaPlayer“无法创建播放器!” Ubuntu 14.04 中的错误

我已经安装了 Ubuntu 14.04,当我实例化 MediaPlayer 时出现错误。

package mediatest;

import java.io.File;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Stage;

/**
 *
 * @author DESARROLLO
 */
public class MediaTest extends Application {

    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                Media media = new Media(new File("rotate.mp4").toURI().toASCIIString());
                MediaPlayer player = new MediaPlayer(media);
            }
        });

        StackPane root = new StackPane(); …
Run Code Online (Sandbox Code Playgroud)

javafx ubuntu-14.04

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

javafx ×1

ubuntu-14.04 ×1