.wav plays well but not .mp3
In my swing code, I am playing .wav files (using getAudioClip() etc...)
But I am unable to play .mp3
can anybody help me out ?/ any kinda code ???
thanx in advance
* @(#)MiniPlayer.java Tiger 2005 May 04
* Copyright 2005 Ronillo Ang
* All rights reserved
package com.yahoo.ron.media;
import java.awt.Component;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.net.URL;
import javax.media.ControllerEvent;
import javax.media.ControllerListener;
import javax.media.Manager;
import javax.media.Player;
import javax.media.RealizeCompleteEvent;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
* @author Ronillo Ang
* @version vm1.5.0-b64
* A simple demo or usage of JMF.
* NOTE: This program will not run without modification. Check the code and make some modification.
final public class MiniPlayer extends WindowAdapter implements ActionListener, ControllerListener{
final private String imageName = "com/yahoo/ron/images/t10.gif";
private Frame frame;
private MiniPlayerRecentFileMenu mprfm;
private Player player;
private MiniPlayer() throws Exception{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
frame = new Frame("Mini Player");
frame.setMenuBar(createMenuBar(new MenuBar()));
frame.setLayout(new BorderLayout());
frame.add(BorderLayout.CENTER, new JLabel(new ImageIcon(imageName)));
frame.pack();
frame.addWindowListener(this);
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
int x = (dimension.width - frame.getWidth()) / 2;
int y = (dimension.height - frame.getHeight()) / 2;
frame.setLocation(x, y);
frame.setVisible(true);
public void actionPerformed(ActionEvent ae){
Object source = ae.getSource();
try{
if(source instanceof MenuItem){
String command = ((MenuItem)source).getLabel().trim();
if(command.equalsIgnoreCase("open..."))
createPlayer(open());
else if(command.equalsIgnoreCase("exit"))
windowClosing(null);
else
createPlayer(open(command));
} catch (Exception exception) {
showThrowableMessage(exception);
public void controllerUpdate(ControllerEvent ce){
if(ce instanceof RealizeCompleteEvent){
frame.removeAll();
Component component = player.getVisualComponent();
if(component != null){
frame.add(BorderLayout.CENTER, component);
component = null;
component = player.getControlPanelComponent();
if(component != null){
frame.add(BorderLayout.SOUTH, component);
component = null;
frame.pack();
public void windowClosed(WindowEvent we){
System.exit(0);
public void windowClosing(WindowEvent we){
try{
mprfm.close();
removePlayer();
} catch (Exception exception) {
exception.printStackTrace();
frame.dispose();
private MenuBar createMenuBar(MenuBar bar) throws Exception{
Menu file = bar.add(new Menu("File"));
file.add(new MenuItem("Open...")).addActionListener(this);
mprfm = (MiniPlayerRecentFileMenu) file.add(new MiniPlayerRecentFileMenu(this));
file.addSeparator();
file.add(new MenuItem("Exit")).addActionListener(this);
return bar;
private URL open() throws Exception{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int option = fileChooser.showOpenDialog(frame);
if(option == JFileChooser.APPROVE_OPTION)
return open(fileChooser.getSelectedFile().getCanonicalPath());
return null;
private URL open(String fileName) throws Exception{
if(fileName == null)
return null;
if(fileName.equals(""))
return null;
File file = new File(fileName);
if(!file.exists())
return null;
if(file.isDirectory())
return null;
mprfm.update(file.getCanonicalPath());
return file.toURL();
private void createPlayer(URL url) throws Exception{
if(url == null)
return;
removePlayer();
player = Manager.createPlayer(url);
player.addControllerListener(this);
player.start();
private void removePlayer(){
if(player == null) return;
frame.removeAll();
frame.add(BorderLayout.CENTER, new JLabel(new ImageIcon(imageName)));
frame.pack();
player.close();
player = null;
private void showThrowableMessage(Throwable throwable){
String title = (throwable instanceof Error? "Error" : "Exception");
String message = throwable.toString();
JOptionPane.showMessageDialog(frame, message, title, JOptionPane.ERROR_MESSAGE);
static public void main(String[] args) throws Exception{
new MiniPlayer();
* @(#)MiniPlayerRecentFileMenu.java Tiger 2005 May 04
* Copyright 2005 Ronillo Ang
* All rights reserved
package com.yahoo.ron.media;
import com.yahoo.ron.sql.QueryResult;
import com.yahoo.ron.sql.OdbcConnector;
import com.yahoo.ron.sql.OdbcConnection;
import java.awt.Menu;
import java.awt.MenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Stack;
* @author Ronillo Ang
* @version vm1.5.0-b64
* A class that stores recently opened file to a database.
final class MiniPlayerRecentFileMenu extends Menu implements ActionListener{
private ActionListener actionListener;
private OdbcConnection odbcConnection;
MiniPlayerRecentFileMenu(){
this(null);
MiniPlayerRecentFileMenu(ActionListener actionListener){
super("Recent Files");
try{
if(actionListener == null)
this.actionListener = this;
else
this.actionListener = actionListener;
odbcConnection = OdbcConnector.getOdbcConnection("RecentMenu");
add(new MenuItem("empty"));
update();
} catch (Exception exception) {
exception.printStackTrace();
void update(String fileName){
String extension = fileName.substring(fileName.lastIndexOf('.') + 1);
try{
String sql = "SELECT [filename] FROM tblfiles WHERE [filename]='" + fileName + "'";
QueryResult queryResult = odbcConnection.executeQuery(sql);
if(!queryResult.isEmpty()){
sql = "DELETE * FROM tblfiles WHERE [filename]='" + fileName + "'";
odbcConnection.executeUpdate(sql);
sql = "INSERT INTO tblfiles VALUES ('" + extension + "', '" + fileName + "')";
int updateCount = odbcConnection.executeUpdate(sql);
if(updateCount == 1)
update();
} catch (Exception exception) {
exception.printStackTrace();
private void update(){
try{
int[] counter = {0, 0};
QueryResult[] queryResult = {null, null};
String sql = "SELECT [filetype] FROM tblfiles";
queryResult[0] = odbcConnection.executeQuery(sql);
removeAll();
Stack stack = new Stack();
if(queryResult[0].next())
do{
String filetype = queryResult[0].getStringAt(0);
if(!stack.contains(filetype)){
stack.push(filetype);
sql = "SELECT [filename] FROM tblfiles WHERE [filetype]='" + filetype + "'";
queryResult[1] = odbcConnection.executeQuery(sql);
Menu menu = (Menu) add(new Menu(filetype));
if(queryResult[1].last()){
counter[1] = 0;
do{
String filename = queryResult[1].getStringAt(0);
menu.add(new MenuItem(filename)).addActionListener(actionListener);
while(++counter[1] < 15 && queryResult[1].previous());
else
menu.add(new MenuItem("empty"));
while(++counter[0] < 15 && queryResult[0].next());
else
add(new MenuItem("empty"));
} catch (Exception exception) {
exception.printStackTrace();
void close() throws Exception{
odbcConnection.close();
public void actionPerformed(ActionEvent ae){
}Make some modification for this program to run.
Okie! I'll log out na I have to study pa eh, God bless you all and take care!
Similar Messages
-
Some songs, which are bought in the iTunes store, will be played iTunes but not on my iPod touch. Has somebody an explanation for that? Thanks,
No, you should have Restrictions OFF.
Computer's iTunes > Preferences > Parental Preferences > everything should be unchecked.
Are the songs also on computer's iTunes? -
after updating iOS on my iPod touch 4th gen my Philips speaker dock DC290B/37 no longer charges the iPod. It will play music but not charge, is there anyway to find out if Apple is working on an update/fix?
Try:
- Reset the dock
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup. See:
iOS: Back up and restore your iOS device with iCloud or iTunes
- Restore to factory settings/new iOS device.
Otherwise you are out of luck. Apple is not making any more update for the 4G.
Also check with Phillips. Maybe they have an firmware update available -
I have a Imac G5 with a superdrive and if will play DVD but not CD. Anyway i can fix this?
Two ways that might fix it (the superdrive uses different lasers for CDs and DVDs):
1. Clean the superdrive with a proprietary lens cleaner that uses tiny brushes.
2. Reset the SMU:
Resetting the SMU on a G5 iMac:
http://support.apple.com/kb/HT1767 -
Flash Video plays locally, but not on web
I have a htm page that I have inserted a Flash Video. It
plays locally, but not when I have it on the web. I get nothing -
no skins, nothing. If I rt click, there are the settings for flash.
I have the scripts in my scripts folder - double checked that. Can
anyone see what I'm doing wrong?
Here is the link.
http://www.metuchen-edisonymca.org/video/test.htmright off the top ..
You have two script calls to the Scripts folder and file ..
one is root
relative and the other goes up one level. One of them needs
to be removed.
Nancy Gill
Adobe Community Expert
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August,
2003)
Technical Editor: Dreamweaver CS3: The Missing Manual,
DMX 2004: The Complete Reference, DMX 2004: A Beginner's
Guide
Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP
Web Development
"motomoto111" <[email protected]> wrote in
message
news:fm8808$7lo$[email protected]..
>I have a htm page that I have inserted a Flash Video. It
plays locally,
>but
> not when I have it on the web. I get nothing - no skins,
nothing. If I
> rt
> click, there are the settings for flash. I have the
scripts in my scripts
> folder - double checked that. Can anyone see what I'm
doing wrong?
>
> Here is the link.
>
>
http://www.metuchen-edisonymca.org/video/test.htm
> -
IMac will play DVDs but not CDs
My 2009 iMac will play DVDs but not CDs (bought music CDs and burnt CDs). The last time I tried (successfully) was December 2013. Can anyone help?
Start a new topic and don't hijack this one. You're problem is different from the OPs. When you start the new topic give your system version, iMac year and model and what type of CDs you can't read, i.e. commercial or those you created yourself. Also if you can read DVDs.
-
HT201335 While air play setting I am getting air play symbol but not getting mirroring option
While try for AirPlay setting I am getting air play symbol but not getting mirroring option
Please explain more, such as what device you are trying to mirror from.
-
hello is there a solution to play some avi formats with quicktime because with all the codec i can play video but not the sound thank you by advance (im on windows 7 so perian cant help me)
I did some googling and found alot of topics from you on this issue, to me it simply seems like on of the connectors is broken or loose.
-
Superdrive plays cds but not dvds
My mini plays cds but not dvds. Wouldn't this indicate a software, not hardware problem?
Jeffrey Tashman wrote:
Wouldn't this indicate a software, not hardware problem?
Not necessarily, the drive uses a different laser to read DVDs.
1. Reset your Mac's PRAM > Resetting your Mac's PRAM
2. Clean the drive with a DVD lens cleaner?
Example > Amazon.com: Memtek 32020029479 CD and DVD Lens Cleaning Kit: Electronics -
Certain music videos will not play in iTunes. The music plays fine but not the video. No picture. Same with the iPod. Other videos in the library play fine. Help.
Regular playlists vs smart playlist does not make a difference. What I noticed is that some videos create this behavior and some not. I created 2 videos and 2 music playlists, one with 2 songs and 2 videos (that I encoded myself with Handbrake). Another list with 2 videos and 2 songs, videos encoded with Handbrake, but that I noticed they triggered the behavior. The first playlist played fine, with no problems. The second one, created the problem. When I look at the video, it is the same type of video (bit rate, audio channels, etc...) I don't see why it would do that.
Later I will test: playing those videos in question and then selecting songs to see if they play. -
Flash Vidio plays locally, but not online - Help!
I have a htm page that I have inserted a Flash Video. It
plays locally, but not when I have it on the web. I get nothing -
no skins, nothing. If I rt click, there are the settings for flash.
I have the scripts in my scripts folder - double checked that. Can
anyone see what I'm doing wrong?
Here is the link.
http://www.metuchen-edisonymca.org/video/test.htm"motomoto111" <[email protected]> wrote in
message
news:fmbc9v$l68$[email protected]..
>I have a htm page that I have inserted a Flash Video. It
plays locally, but
>not
> when I have it on the web. I get nothing - no skins,
nothing. If I rt
> click,
> there are the settings for flash. I have the scripts in
my scripts
> folder -
> double checked that. Can anyone see what I'm doing
wrong?
>
> Here is the link.
>
>
http://www.metuchen-edisonymca.org/video/test.htm
Make sure your server is configured to serve .flv files. Ask
your host if
there is a mime type set up for that file extension.
Al Sparber - PVII
http://www.projectseven.com
Extending Dreamweaver - Nav Systems | Galleries | Widgets
Authors: "42nd Street: Mastering the Art of CSS Design" -
10.5.2 iTunes on Windows 7 x64 bit laptop - Quick Time will play videos but not iTunes
I'm hoping you can help, I've looked for a solution to this for a while now.
I store my itunes library on an external hard drive. I completed a clean install of x64 bit Windows 7 on my laptop - all went perfectly. Downloaded and installed the 64 bit version of 10.5.2 iTunes and located my library...the music plays fine but no videos. I opened iTunes in safe mode and it said that I needed the up to date version of Quick Time. Downloaded and installed that...no problems. Now my vidoes will play in the Quick Player but still not in iTunes! They apprear in the "Now Playing" pane but the timer doesn't move - even after pressing pause and play. Can anyone help me please? Do I need to open iTunes in 32 bit mode? If so, how do I do that in Windows 7? i can only find solutions for Mac's....
Thanks in advanceI should have posted this earlier, but anyway. I restored my laptop to factory version after backing up any useful data, and the first thing I the laptop was restored was connect to the internet, download and install the latest version of iTunes. And Bingo! It worked.
Apple helps you find Original Sin with the Windows. -
Flash player 11.6.602.180 plays audio but not video...
Very similar to problems reported by others. Just started recently... flash player on Win 7 and IE 10 plays audio but no video... just black box or blank.
Have reinstalled flash player several times... including following all clean install instructions several times. Installation completes and and tells me it's installed successfully.
Have carefully matched IE settings to allow activeX content and have enabled the flash player object and turned on active scripting for all zones, etc. Still no video.
Going to the flash verification page shows a blank box where the current installed version should be.
If I look in control panel under Flash Player it tells me the activeX version is 11.6.602.180 and that the plug in is "Not Installed"... could that be the problem?
What can I do to fix this? Thanks in advance for any help.What is your display adapter, device driver version and date? See http://forums.adobe.com/thread/945765
-
Adobe premire CC will play audio but not video
Hello guys I'm having an issue i recently upgrade my pc and added a second video card I have two amd readeon r9 290 with crossfire enable. Last night after installing both video card I ran premire and it would show the thumnail of my video but when i played it back only the audio would play but not the video.
Pc specs
Cpu: amd fx 8350
Motherboard sabertooth 990fx r2
2x readon ati amd r9 290
Thanks in advance for the helphttp://docs.info.apple.com/article.html?artnum=302828
-
Is it possible for my dvd player to be able to play dvds but not burn them anymore?
So my dvd player will play movies but it will not let me burn them anymore. I didn't even think this was possible? Do I need to just replace it or is there a way to actually get it to burn again?
Welcome to the Apple Support Communities
Probably the SuperDrive is damaged, if it doesn't allow you to burn DVDs. You have two possibilities:
1. Take the computer to an Apple Store or reseller to get a new SuperDrive.
2. Buy an external optical drive for your iMac
Maybe you are looking for
-
On my adobe reader on my pic I am able to sign in and convert PDF files to word documents in order to change them. I have paid for this upgrade and was wondering how I can go about using this function on my iPad.
-
All web images are being saved as web clippings...
Dear Apple Community, For the past 2 days every image I try to save to my mac from a website (via Safari), remote server (ie: .me), etc. Is being saved as a .RTF web clipping. When I click on the files, TextEditor opens, but the file is empty even th
-
I get a message that says an incompatible browser was detected and i can't view a web page.
I get a message that says an incompatible web browser was detected when I click a link on a certain web site. it said try using firefox or mozilla or internet explorer. I got firefox and it still says the same thing. I just got my computer saturday a
-
Request for some sample resumes on XI
Hi, I request anyone to send some sample resumes on SAP XI and WebDynPro. regards, Ram Mohan
-
HT2470 How do I move a picture album in "Finder" to iPhoto?
How do I take an album I created in my pictures in finder and move it to my iphoto? Thanks in advance!