nokia 6630 audio problem

Reply

Join Date: Jun 2005
Posts: 1
Reputation: nilesh is an unknown quantity at this point 
Solved Threads: 0
nilesh nilesh is offline Offline
Newbie Poster

nokia 6630 audio problem

 
0
  #1
Jun 17th, 2005
I am developing a J2ME application for Nokia 6630.
In which I'm trying to play audio (.mp3 & .amr formats).
I use " player.stop(); " to pause audio.
But when I try to resume audio, Player strarts audio from beginning.


import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
import javax.microedition.media.PlayerListener.*;
import java.lang.String.*;
import javax.microedition.rms.*;

final class PlayerCanvas implements Runnable {
private Player player = null;
private Thread dThread = null;
private InputStream s2 = null;
PlayerCanvas(InputStream s1){
super();
s2=s1;
}
private void createPlayer() {
try {
player = Manager.createPlayer(s2, "audio/mpeg");

}
catch (Exception e) {
}
}
public final void playSound() {
if (dThread == null) {
dThread = new Thread(this);
dThread.start();
} else if (player != null) {
try {
player.start();
} catch (Exception ex){

}
}
}


public final void stopSound() {

try {
dThread = null;

if (player != null) {
player.stop();
player.close();
player = null;
s2.close();
s2=null;
}
} catch (Exception ex) {
System.err.println("Problem closing player");
}
}


final void pauseSound() {//to pause audio
try {
if (player != null)
player.stop();

} catch (Exception ex){
System.err.println("Problem stopping player");
}
}


public final void run()
{
if (player == null)
{
try {

createPlayer();
player.realize();
player.prefetch();
player.start();
}
catch(Exception me1)
{
}
}
}

}

1 ) i use createPlayer() method to create player
2 ) i call playSound() method audio play . then i use
pauseSound() to stop audio,audio stop but when i call once again playSound() method audio start from beginning.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: nokia 6630 audio problem

 
0
  #2
Jun 17th, 2005
The stop method will stop the sound completely, not at a specific. You need something that will actually pause it, instead of stoping the audio..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC