Comment on Tutorial - Play a multimedia file in J2ME Program (Audio/Video) using MMAPI By Vikram Goyal



Comment Added by : Rowan

Comment Added at : 2014-07-17 10:26:02

Comment on Tutorial : Play a multimedia file in J2ME Program (Audio/Video) using MMAPI By Vikram Goyal
public void playSound(String filename) {
//stop current playing sound
try {
if (player != null) {
player.stop();
player.close();
player.deallocate();
player = null;
}
} catch (Exception ex) {
ex.printStackTrace();
}

//play new sound
try {
inStream = getClass().getResourceAsStream(filename);
player = Manager.createPlayer(inStream, "audio/x-wav");
player.realize();
player.prefetch();
//player.setMediaTime(-1);
//player.setTimeBase(null);
player.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. i want to know how to read a file inside zipfile.<
View Tutorial          By: iman at 2009-11-26 12:50:21

2. aoa i am for the first time learning programing pl
View Tutorial          By: manaal siddiqui at 2011-11-02 09:38:00

3. sample program in packages and interface combined
View Tutorial          By: priya at 2009-09-10 05:42:31

4. Thanks! Very helpful in creating a program i am tr
View Tutorial          By: BHaos at 2014-12-05 16:32:53

5. this is the output i get.
Help me.
<

View Tutorial          By: shubham saxena at 2014-04-01 17:06:00

6. iam getting intrest to watch this site
View Tutorial          By: monika at 2013-02-15 15:48:57

7. @Zero Code

@
Catch ex As Ex

View Tutorial          By: Chitz at 2011-12-24 19:50:45

8. i am new to SMS, i think i need a device too. Whic
View Tutorial          By: Usman at 2015-10-05 12:06:34

9. im having errors in sPort.sendBreak in SerialConne
View Tutorial          By: mrrrc at 2013-03-18 08:54:50

10. Thanks , really appreciate
View Tutorial          By: Marlen at 2010-11-23 10:50:29