944,087 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 3197
  • Java RSS
Jun 17th, 2005
0

nokia 6630 audio problem

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nilesh is offline Offline
1 posts
since Jun 2005
Jun 17th, 2005
0

Re: nokia 6630 audio problem

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..
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: search and replace
Next Thread in Java Forum Timeline: problem with swing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC