How to play videos from SD Card

前端 未结 5 1899
日久生厌
日久生厌 2020-12-17 16:51

I was creating a simple app which stream videos from net and I made it but now I want to change the code so that I can play video files from my SDCard

original code:

5条回答
  •  -上瘾入骨i
    2020-12-17 17:04

    The videoView.setVideoURI(vidFile); method needs to be replaced by the videoView.setVideoPath(path); method. Here path specifies the path of the video file on the SDCARD.

    This path can be easily retrieved using the MediaStore.Video.Media.DATA property of that video file or by just entering the songpath statically as /sdcard/songname.

提交回复
热议问题