Click here to Skip to main content
13,090,930 members (47,472 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I have code for playing audio file using* package and i can only able to play small clip files but not large files which runs through for mins. Could any one able to guide me to overcome this problem  I provided my code for reference:

public class SunAudioClip implements java.applet.AudioClip {
    private AudioData audiodata;
    private AudioDataStream audiostream;
    private ContinuousAudioDataStream continuousaudiostream;
    static int length; 

public SunAudioClip (String filename) throws {
        FileInputStream fis = new FileInputStream (filename);
        AudioStream audioStream = new AudioStream (fis);
        audiodata = audioStream.getData();
        audiostream = null;
        continuousaudiostream = null;
    public void play () {
        audiostream = new AudioDataStream (audiodata);
        AudioPlayer.player.start (audiostream);
    public void loop () {
        continuousaudiostream = new ContinuousAudioDataStream (audiodata);
        AudioPlayer.player.start (continuousaudiostream);
    public void stop () {
        if (audiostream != null)
            AudioPlayer.player.stop (audiostream);
        if (continuousaudiostream != null)
            AudioPlayer.player.stop (continuousaudiostream);
    public static void main (String args[]) throws Exception {
        SunAudioClip sac = new SunAudioClip ("D:\\venkat\\project\\Babu\\choose_mode_trans.wav"); ();
Posted 20-Nov-09 1:28am
Updated 20-Nov-09 9:46am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You are unlikely to get much help with this as the API is pretty much depricated and it is not recommended to use it. You should use the new shiny media api. First of all look at this demo.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 26 Nov 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100