Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Discussion > Android Media

Android Media For Ringtones, Video, TV, Audio or anything else Multimedia related...



Reply
 
LinkBack Thread Tools
Old February 18th, 2010, 05:31 PM   #1 (permalink)
New Member
 
Join Date: Feb 2010
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Audio file + mediaplayer error (1, -4)

Hello,

AFAIK this problem is not posted anywhere on this forum. I would like to play a short audio file (see short code sample below) in Android 2.x, and I encounter this error message:
mediaplayer error (1, -4).

This is what I found in one entry (after a Google search):
"-4 is PVMFErrNotSupported, which also seems to be a catch-all that
usually occurs during prepare() and probably means that OpenCore found
something it didn't like in the stream."

Btw, the audio files play fine from the command line, which launches the Windows Media Player (Windows Vista). I'm sure that there is a very simple solution;(

Suggestions welcome...
Oswald

================================================== ===
package oac.graphics;
import java.io.IOException;
import android.app.Activity;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
public class PlaySound extends Activity
{
// Called when the activity is first created
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new SimpleView(this));
}
private static class SimpleView extends View
{
private MediaPlayer mediaPlayer = null;
//private String mediaFile = "/assets/abc.wmv";
//private String mediaFile = "./assets/abc.wav";
//private String mediaFile = "./assets/abc.mp3";
private String mediaFile = "abc.mp3";

public SimpleView(Context context)
{
super(context);
setFocusable(true);
playSound(context);
}

private void playSound(Context context)
{
try {
mediaPlayer = new MediaPlayer();

if(mediaPlayer != null)
{
mediaPlayer.setDataSource(mediaFile);
mediaPlayer.prepare();
mediaPlayer.start();
mediaPlayer.pause();
mediaPlayer.stop();
}
}
catch(IllegalArgumentException iae) {
Log.i("media player exception: ", "IAE");
Log.w("media player exception: ", "IAE");
Log.e("media player exception: ", "IAE");
}
catch(IOException ioe) {
Log.i("media player exception: ", "IOE");
Log.w("media player exception: ", "IOE");
Log.e("media player exception: ", "IOE");
}
}
}
}

ocampesato is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Discussion > Android Media User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MediaPlayer cannot play downloaded mp3 file duykienvp Android Media 5 October 27th, 2010 04:02 PM
No audio in .avi file t0adman Droid X - Support and Troubleshooting 2 September 17th, 2010 05:47 PM
audio file through email whtteg Droid X - Support and Troubleshooting 2 July 19th, 2010 09:04 AM
Unexplained error from MediaPlayer Sir^Knigget Application Development 1 February 22nd, 2010 08:05 PM
Audio Analysis with MediaPlayer onionparadise Android Media 0 June 4th, 2009 11:58 AM



All times are GMT -5. The time now is 05:36 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo