Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package player;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.FileInputStream;
  5.  
  6. public class FilePlayer {
  7.  
  8. public static void main(String[] args) throws Exception {
  9. String fileName = args.length != 1 ? "/Users/rubenramos/Documents/RC/t2/finding-dory/128.ts" : args[0];
  10. Player player = JavaFXMediaPlayer.getInstance().setSize(800, 460).mute(false);
  11. FileInputStream fis = new FileInputStream(fileName);
  12. DataInputStream dis = new DataInputStream(fis);
  13.  
  14. while (!dis.readUTF().equals("eof")) {
  15. dis.readLong(); // timestamp
  16. dis.readLong(); // duration
  17. byte[] data = new byte[dis.readInt()];
  18. dis.readFully(data);
  19. player.decode(data);
  20. }
  21. dis.close();
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement