Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package player;
- import java.io.DataInputStream;
- import java.io.FileInputStream;
- public class FilePlayer {
- public static void main(String[] args) throws Exception {
- String fileName = args.length != 1 ? "/Users/rubenramos/Documents/RC/t2/finding-dory/128.ts" : args[0];
- Player player = JavaFXMediaPlayer.getInstance().setSize(800, 460).mute(false);
- FileInputStream fis = new FileInputStream(fileName);
- DataInputStream dis = new DataInputStream(fis);
- while (!dis.readUTF().equals("eof")) {
- dis.readLong(); // timestamp
- dis.readLong(); // duration
- byte[] data = new byte[dis.readInt()];
- dis.readFully(data);
- player.decode(data);
- }
- dis.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement