Example usage for javafx.scene.media MediaPlayer MediaPlayer

List of usage examples for javafx.scene.media MediaPlayer MediaPlayer

Introduction

In this page you can find the example usage for javafx.scene.media MediaPlayer MediaPlayer.

Prototype

public MediaPlayer(@NamedArg("media") Media media) 

Source Link

Document

Create a player for a specific media.

Usage

From source file:utybo.branchingstorytree.swing.impl.SSBClient.java

@Override
public void load(final InputStream in, final String name) throws BSTException {
    // Write the input stream in a temporary folder
    try {//from  w  w  w. ja  v a2 s  .  co m
        File f = File.createTempFile("openbst" + name, "");
        f.deleteOnExit();
        IOUtils.copy(in, new FileOutputStream(f));
        final Media m = new Media(f.toURI().toString());
        resources.put(name, new MediaPlayer(m));
    } catch (IOException e) {
        throw new BSTException(-1, "Could not create temporary file", e, "<none>");
    }
}

From source file:utybo.branchingstorytree.swing.impl.SSBClient.java

@Override
public void load(final File file, final String name) throws BSTException {
    final Media m = new Media(file.toURI().toString());
    resources.put(name, new MediaPlayer(m));
}