Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

JMF Project - Urgent help needed!!

sockysocky Posts: 1Member

Hi all

I am writing a jmf based applet to play mp3's for my final year project, but can't get it to work.
I've checked all the examples i could find on the net and still can't see what i'm doing wrong. When i try to load the the page i keep getting "Applet Crashed". JMF is correctly installed on my system. I've been stuck with it for over a month, and the project is due in the next week

If anyone has experience with JMF i'd appreciate it greatly if you could take a look at my code and maybe you can help point out where i'm going wrong

thanks

Tim

0132888@student.ul.ie

__________________________________________________________________

package playerappletfinal;

import java.applet.*;
import java.awt.*;
import java.net.*;
import javax.media.*;

/**
*

Title: NetRadio Applet

*
*

Description: Applet to play an mp3 when loaded

*
*

Copyright: Copyright (c) 2005

*
*

Company:

*
* @author not attributable
* @version 1.0
*/

public class NetRadio extends Applet implements ControllerListener
{
Player netRadio = null;

public void init()
{
setLayout( new BorderLayout() );
String fileName = getParameter( "FILE" );
try
{
MediaLocator fileAddress = new MediaLocator( fileName );
netRadio = Manager.createPlayer( fileAddress );
netRadio.addControllerListener( this );
netRadio.realize();
}
catch (Exception error)
{
System.err.println( "Exception " + error );
}
}

public void start()
{
netRadio.start();
}

public void stop()
{
netRadio.stop();
netRadio.deallocate();
}

public void destroy()
{
netRadio.close();
}

public synchronized void controllerUpdate( ControllerEvent event )
{
if ( event instanceof RealizeCompleteEvent )
{
Component component;
if ( ( component = netRadio.getControlPanelComponent() ) != null )
add ( "Center", component );
}
}
}

_________________________________________________________________






Sign In or Register to comment.