1

I trying this code :

1- Initialization

private static final int PICK_FROM_GALLERY = 1;
VideoView video;

2- onCreate Methos

video = (VideoView) findViewById(R.id.VideoID);

3- onClick (implements OnClickListener)

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.VideoID:
            Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(galleryIntent, PICK_FROM_GALLERY);
        break;
        }
    }

4- onActivityResult Method

if (requestCode == PICK_FROM_GALLERY) {
                Uri uri = data.getData();
                video.setVideoURI(uri);
                video.requestFocus();
                video.start();
            }

OUTPUT on my Galaxy Note 3: 1- as Toast:

data: Intent { dat=content://media/external/video/media/8899 (has extras) } 

2- as Message Dialog:

Can't play this video

I want to play a videoview from (the gallery or from anywhere) with any path (internal or external path)

iibrahimbakr
  • 1,116
  • 1
  • 13
  • 32
  • refer my ans for absolute path http://stackoverflow.com/questions/32049962/filenotfound-exception-while-loading-bitmap-images-from-android-gallery/32050040?noredirect=1#comment51999547_32050040 – koutuk Aug 17 '15 at 12:26
  • Check the path URI first and also what type of video you are trying to play..i mean the extension? – Santosh Kathait Aug 17 '15 at 12:37
  • I said in my question OUTPUT look it URI path, and the video extention is mp4 – iibrahimbakr Aug 17 '15 at 12:57

0 Answers0