In JavaFX audio has first-class support. The API to playback audio is located in package javafx.scene.media. You use two classes to achieve media playback
The following shows you how to playback an MP3 file: def mediaSource = "http://streaming.oracle.com/ebn/podcasts/media/8576726_Nandini_Ramani_030210.mp3";def player = MediaPlayer { media:Media{ source:mediaSource }}player.play(); | The materials on this website represent a small sample of content loosely based on the book JavaFX Application Development Cookbook. The book offers far more content with over 80 recipes covering a range of topics from basics to advanced concepts. Buy the BookYou can get your copy of the book directly from the publisher. Click here to order! |
