| | |
nokia 6630 audio problem
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
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.
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
- audio problem with webcam (Cellphones, PDAs and Handheld Devices)
- Winfast Tv Turner Card Audio Problem (Monitors, Displays and Video Cards)
- DVD audio problem :@ (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: Java applet failed
- Next Thread: problem with swing
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application arguments array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class client code color component count database derby design eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui homework html ide if_statement image integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia keyword linux list macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object open-source os problem producer program programming project projectideas property read recursion reference replaysolutions ria scanner search server set size sms sort sourcelabs splash sql sqlite stop string swing threads transforms tree ui unicode validation windows






