Android — Can't play any videos (mp4/mov/3gp/etc.)?

前端 未结 3 1124
旧时难觅i
旧时难觅i 2020-12-03 06:16

I\'m having great difficulty getting my Android application to play videos from the SD card. It doesn\'t matter what size, bitrate, video format, or any other setting I can

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 06:53

    I was facing this problem until I figured out that the problem was in the directory of my video. I was saving my videos to a directory that is unreachable to the video view. So every time I try to play a video it gives me error message says: "Can’t open video" or something like that. Try and save your video to this directory which will be also visible in phone gallery.

    String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/" + "your app name ";
    

提交回复
热议问题