Does any one have this error using mediaplayer?

All your problems with Audio, Video and Images.

Does any one have this error using mediaplayer?

Postby edwinkcw » Fri Feb 27, 2009 10:09 am

Why is it occur?
Attempt to call getDuration without a valid mediaplayer.

How can I make a valid media player?
Thanks
edwinkcw
Developer
Developer
 
Posts: 38
Joined: Wed Feb 18, 2009 2:04 pm

Top

Postby metachris » Mon Mar 02, 2009 1:28 am

be sure to read and understand the Audio and Video docs on dev.android.com. That should do the trick, if you exchange sound_file_1 with your imported audio file):

Code: Select all
    MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1);
    mp.start();
metachris
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sat Feb 07, 2009 11:40 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 7 guests