0

In my app i m loading some video mp4 files and it plays on tablet and other android devices but when i try to play the same video on kindle fire the application crashes. Any suggestions please. Please look into my code

public class VideoPlayer extends Activity {

private VideoView vidPlayer;
private ImageView ivPlayerBG;
private MediaController mc;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.videoplayer);
    Utils.setOrientation(this);
    vidPlayer = (VideoView) findViewById(R.id.vidPlayer);
    ivPlayerBG = (ImageView) findViewById(R.id.ivPlayerBG);
    mc = new MediaController(this);
    vidPlayer.setMediaController(mc);
    vidPlayer.setFocusable(true);
    mc.show(0);
    //onControllerHide();

    AudioManager audioMan = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    if (audioMan.getStreamVolume(AudioManager.STREAM_MUSIC) <= 0) {
        Toast.makeText(this, "volume is set to mute", Toast.LENGTH_LONG)
                .show();
    }

    Log.v("totla memory play", "" + Runtime.getRuntime().totalMemory());
    Log.v("HEAP_SIZE ", "" + Debug.getNativeHeapAllocatedSize());

    Boolean isAudio = getIntent().getExtras().getBoolean("audio");
    if (null != isAudio && isAudio) {
        ivPlayerBG.setBackgroundResource(R.drawable.ic_launcher);
    }

    Uri videoUrl = Uri.parse(Utils.getSDCardPath(getIntent().getExtras()
            .getString("url"))); // Uri.parse(Utils.getSDCardPath("Media/video.mp4"));
    Log.v("log" + videoUrl.getPath(), "logv");
    playVideo(videoUrl);

}

public void onControllerHide() {
    mc.hide();
}

public void playVideo(Uri videouri) {
    try {
        vidPlayer.setVideoURI(videouri);
        vidPlayer.requestFocus();
        vidPlayer.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

@Override
protected void onDestroy() {
    super.onDestroy();

}

}

cavallo
  • 4,414
  • 9
  • 39
  • 61

2 Answers2

2

Just use this code.

 Intent browserIntent = new Intent(Intent.ACTION_VIEW,
             Uri.parse(url));
      startActivity(browserIntent);
H.Muster
  • 9,297
  • 1
  • 35
  • 46
Reddy
  • 140
  • 1
  • 5
0

Kindle fire is an amazon specific book reading application. If you want to install any application in it, you need to first root the device. Try installing apk of Daroon Player (available on their website) and then install your application. It will work.

Rashmi.B
  • 1,787
  • 2
  • 18
  • 34
  • my device has been rooted and been installing android apps quiet long back... whre would i get the player – cavallo Apr 27 '12 at 06:09
  • you will get it in Daroon's website. http://www.androidzoom.com/android_applications/media_and_video/daroon-player_bdqdv.html – Rashmi.B Apr 27 '12 at 06:11
  • Also this https://play.google.com/store/apps/details?id=com.daroonplayer.dsplayer&feature=search_result – Rashmi.B Apr 27 '12 at 06:17