Media player Problem-The application videoplayer has stopped unexpectedly please try again.

by Dagger » Sun, 02 Nov 2008 23:45:56 GMT


Sponsored Links
  am using the 0.9 version of android SDK
Encountering the error The application videoplayer has stopped
unexpectedly please try again.
This is the code which I have
Videoplayer.java

package com.android.VideoPlayer;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import android.app.Activity;
import android.graphics.PixelFormat;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.ImageButton;

public class VideoPlayer extends Activity implements OnErrorListener,
OnBufferingUpdateListener, OnCompletionListener,
MediaPlayer.OnPreparedListener, SurfaceHolder.Callback {
private static final String TAG = "VideoPlayer";

private MediaPlayer mp;
private SurfaceView mPreview;
private EditText mPath;
private SurfaceHolder holder;
private ImageButton mPlay;
private ImageButton mPause;
private ImageButton mReset;
private ImageButton mStop;
private String current;

/**
* Called when the activity is first created.
*/
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

setContentView(R.layout.main);

// Set up the play/pause/reset/stop buttons
mPreview = (SurfaceView) findViewById(R.id.surface);
mPath = (EditText) findViewById(R.id.path);
mPlay = (ImageButton) findViewById(R.id.play);
mPause = (ImageButton) findViewById(R.id.pause);
mReset = (ImageButton) findViewById(R.id.reset);
mStop = (ImageButton) findViewById(R.id.stop);

mPlay.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
playVideo();
}
});
mPause.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (mp != null) {
mp.pause();
}
}
});
mReset.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (mp != null) {
mp.seekTo(0);
}
}
});
mStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
if (mp != null) {
mp.stop();
mp.release();
}
}
});

// Set the transparency
getWindow().setFormat(PixelFormat.TRANSPARENT);

// Set a size for the video screen
holder = mPreview.getHolder();
holder.addCallback(this);
holder.setFixedSize(400, 300);
}

private void playVideo() {
try {
final String path = mPath.getText().toString();
Log.v(TAG, "path: " + path);

// If the path has not changed, just start the media
player
if (path.equals(current) && mp != null) {



Media player Problem-The application videoplayer has stopped unexpectedly please try again.

by Dagger » Sun, 02 Nov 2008 23:53:50 GMT


 ey developers I need help with this problem

On Nov 2, 8:45pm, Dagger <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Media player Problem-The application videoplayer has stopped unexpectedly please try again.

by Dagger » Mon, 03 Nov 2008 00:32:28 GMT


 omeone reply please

On Nov 2, 9:04pm, "Kipling Inscore" <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to add button to MediaController?

Hi, been trying to modify the MediaController widget to add a few
custom buttons.
I have tried to subclass it and add buttons to the linearlayout before
te rewind and after tge fast forward with no success... is this even
possible?

I can always create my own MediaController class but that seems to be
a waste...

Thanks

--~--~---------~--~----~------------~-------~--~----~

2. FTP?

Hi everyone,
1) Does android have its own FTP client?
2) Does android use TCP by default to establish a connection?
3) Does Android have its own TCP library?

--~--~---------~--~----~------------~-------~--~----~

3. my post is not appearing

4. enable/disable 3g

5. layout_gravity Problem

6. ScrollView and TextView

7. browser fails to open URL in emulato build