Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 940371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:56:43+00:00 2026-05-15T21:56:43+00:00

I was trying out the method of creating a background music for a java

  • 0

I was trying out the method of creating a background music for a java program, but it displayed an IO excedption error when i clicked the play button.

package javaentertainment;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.*;
import sun.audio.AudioData;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;

public class Music
{

    public static void main(String args[])
    {
        JFrame frame=new JFrame();
        frame.setSize(100,100);
        JButton button=new JButton("P L A Y");
        frame.add(button);
        button.addActionListener(new AL());
        frame.show();
    }

   public static class AL implements ActionListener
   {

        public void actionPerformed(ActionEvent e) {
            music();
        }
    }

    public static void music()
    {
        AudioPlayer MGP=AudioPlayer.player;
        AudioStream BGM;
        AudioData MD;
        ContinousAudioDataStream loop=null;

        try
        {
            BGM = new AudioStream(new FileInputStream("Vision.wmv"));
            MD=BGM.getData();
            loop=new ContinousAudioDataStream(MD);

        }
        catch (IOException ex)
        {
           System.out.println(ex);
        }

        MGP.start(loop); // word loop was underlined by netbeans
    }
}

When I run the program and click on play it displays the following error,
java.io.IOException: could not create audio stream from input stream

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:56:44+00:00Added an answer on May 15, 2026 at 9:56 pm

    You should use JMF (Java Media Framework). For your interest: The list of accepted formats can be found here.

    In short, it supports AIFF, AVI, GSM, MVR, MID, MPG, MP2, MOV, AU and WAV files.

    But there is a workarond as stated here:

    On a side note, if you add a
    mime-setting in JMFRegistry to map
    Windows Media content (such as .asf
    and .wmv) to the content-type
    “video/mpeg”, JMF can actually play
    Windows Media or any other DirectShow
    file (and only file – http wont work).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying out the Runtime.exec() method to run a command line process. I wrote
I am trying to configure out a method for checking conflicts between the head
i'm trying to work out the best method to perform logging in the application
I'm trying to work out the best method to search a vector of type
I'm trying to work out what the best method to passing a large number
I’m trying to figure out whether FormsAuthentication.RedirectFromLoginPage (called inside method M() ), performs redirection
I am trying to figure out why my $.getJSON method does not seem to
I'm trying to figure out how to get the value from a method in
I'm trying to figure out if the boost::multi_array constructor or resize method can throw
I'm trying to find out if there are any methods in Java which would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.