audio applet or swing based application to play, pause and stop options
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
project report helper
Active In SP
**

Posts: 2,270
Joined: Sep 2010
#1
15-10-2010, 03:03 PM



.doc   Multimedia_Docs.doc (Size: 2.1 MB / Downloads: 90)
audio applet or swing based application to play, pause and stop options

• An applet is created. An applet will show three buttons-play, loop and stop.
• Whenever user clicks on play button an audio file with .wav extension starts playing.
• Whenever user clicks on loop button, same audio file will be played again and again.
• User can click on stop button to stop the audio file.

SOURCE CODE

import java.io.*;
import java.sql.*;
import javax.swing.*;
import javax.media.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class Audio extends JFrame implements ActionListener
{
Player player;
Component center;
Component south;
File f;
JButton jb1,jb2,jb3;
Container c;
public static void main(String[] args)
{
Audio vi=new Audio ();
}
Audio ()
{
jb1 = new JButton("Play");
jb2 = new JButton("Loop");
jb3 = new JButton("Stop");
c = getContentPane();
c.setLayout(new FlowLayout());
c.add(jb1);
c.add(jb2);
c.add(jb3);
jb1.addActionListener(this);
jb2.addActionListener(this);
jb3.addActionListener(this);
setSize(300,300);
try
{
f =new File("D:/Devendra/Pracs/Multimedia/2.mp3");
try
{
load(f);
}
catch (Exception e)
{
System.out.println(e);
}
pack();
setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void load(final File file) throws Exception
{
URL url = file.toURL();
if (player != null)
{
player.stop();
}
player = Manager.createPlayer(url);
ControllerListener listener = new ControllerAdapter()
{
public void realizeComplete(RealizeCompleteEvent event)
{
Component vc = player.getVisualComponent();
if (vc != null)
{
c.add(vc,BorderLayout.CENTER);
center = vc;
}
else
{
if (center != null)
{
c.remove(center);
c.validate();
}
}
Component cpc = player.getControlPanelComponent();
if (cpc != null)
{
c.add(cpc,BorderLayout.SOUTH);
south = cpc;
}
else
{
if (south != null)
{
c.remove(south);
c.validate();
}
}
pack();
setTitle(file.getName());
}
};
player.addControllerListener(listener);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == jb1)
{
player.start();
}
if (ae.getSource() == jb2)
{
player.stop();
player.start();
}
if (ae.getSource() == jb3)
{
player.stop();
}
}
}


OUTPUT


Reply
hanka
Active In SP
**

Posts: 1
Joined: Jan 2011
#2
06-01-2011, 07:08 PM

Hi,the aplet doesn't work in my comp (player.getVisualComponent() is still null), which version of java it needs? I used it in RAD 6.0.0, J2EE 1.4,mediaplayer.jar from 1.5.2003.Thanks for yuor answer.Hanka
Reply
project topics
Active In SP
**

Posts: 2,492
Joined: Mar 2010
#3
19-01-2011, 01:53 PM

what error you are getting while compiling ?
Use Search at http://topicideas.net/search.php wisely To Get Information About Project Topic and Seminar ideas with report/source code along pdf and ppt presenaion
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page

Quick Reply
Message
Type your reply to this message here.


Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Developing a web application to transfer image and patient information project report maker 2 4,964 17-03-2014, 03:03 PM
Last Post: MichaelKa
  Google Map Application using Andriod SDK Abstract seminar projects maker 0 364 19-09-2013, 03:48 PM
Last Post: seminar projects maker
  SMS Protection Application Abstract seminar projects maker 0 364 19-09-2013, 03:47 PM
Last Post: seminar projects maker
  php based project and implimentations project report maker 5 24,867 09-09-2013, 10:04 AM
Last Post: study tips
  Multi-pose lipreading and audio-visual speech recognition Report study tips 0 430 20-08-2013, 01:16 PM
Last Post: study tips
  Secret Communication through Audio for Defense Application PPT project girl 1 715 03-08-2013, 03:10 PM
Last Post: study tips
  Sensor Network Based Oilwell Health Monitoring and Intelligent Control pdf study tips 0 418 01-08-2013, 12:47 PM
Last Post: study tips
  TEXT FILE HIDING IN AUDIO FILE USING LOW BIT ENCODING STEGANOGRAPHY FULL REPORT study tips 0 482 16-07-2013, 04:35 PM
Last Post: study tips
  Design and Implementation of a Web-based Internet/Intranet Mail Server pdf study tips 0 730 26-06-2013, 03:15 PM
Last Post: study tips
  Gsm-based lan monitoring and controlling system seminar flower 3 1,301 14-06-2013, 09:18 AM
Last Post: study tips