美文网首页
android 打开视频相册

android 打开视频相册

作者: WilburLi | 来源:发表于2020-05-15 11:02 被阅读0次

android 5.0~9.0 亲测可用

val videoIntent = Intent(ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI)
startActivityForResult(videoIntent, PICK_VIDEO)


if (requestCode == PICK_VIDEO) {
                        val selectedVideo = data.data
                        val filePathColumn = arrayOf(MediaStore.Video.Media.DATA)
                        val cursor = context!!.contentResolver.query(selectedVideo, filePathColumn, null, null, null)
                        cursor.moveToFirst()
                        val columnIndex = cursor.getColumnIndex(filePathColumn[0])
                        var path = cursor.getString(columnIndex)
                        cursor.close()

                        val intent = Intent(getMContext(), EditVideoActivity::class.java)
                        intent.putExtra(Constant.FILE_PATH, path)
                        startActivity(intent)
                    } 

相关文章

网友评论

      本文标题:android 打开视频相册

      本文链接:https://www.haomeiwen.com/subject/gtaqohtx.html