Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27

Thread: Getting audio stream to play from jar file instead of system directory?

  1. #26
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Getting audio stream to play from jar file instead of system directory?

    After googling "Java AudioPlayer loop", I found this API: sun.audio: public class: AudioPlayer

    Which contains the following, at the very top of the page:

    To play a continuous sound you first have to create an AudioData instance and use it to construct a ContinuousAudioDataStream. For example:

    AudioData data = new AudioStream(url.openStream()).getData();
    ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
    AudioPlayer.player.start(audiostream);
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  2. #27

    Default Re: Getting audio stream to play from jar file instead of system directory?

    Quote Originally Posted by KevinWorkman View Post
    After googling "Java AudioPlayer loop", I found this API: sun.audio: public class: AudioPlayer

    Which contains the following, at the very top of the page:

    To play a continuous sound you first have to create an AudioData instance and use it to construct a ContinuousAudioDataStream. For example:

    AudioData data = new AudioStream(url.openStream()).getData();
    ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
    AudioPlayer.player.start(audiostream);
    My code in the OP had ContinuousAudioDataStream and I wanted it to play from the jar. But never mind I think this thread is solved because I came up with something similar but it reads the files off the current working directory with InputStream. Thanks though.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. How to play Audio file?
    By sush in forum Object Oriented Programming
    Replies: 3
    Last Post: June 29th, 2011, 08:11 AM
  2. could not create audio stream from input stream
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 11
    Last Post: June 2nd, 2011, 02:08 AM
  3. problem with File Stream
    By amr in forum What's Wrong With My Code?
    Replies: 6
    Last Post: April 11th, 2011, 09:57 PM
  4. Object and text file stream code problmes
    By Kakashi in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 3rd, 2011, 04:34 PM
  5. [SOLVED] Web portal accessing files on the user's system via the Java I/O stream?
    By rendy.dev in forum Web Frameworks
    Replies: 2
    Last Post: January 18th, 2010, 08:46 PM

Tags for this Thread