【问题标题】:How to get thumb image of picked video from gallery?如何从图库中获取所选视频的拇指图像?
【发布时间】:2018-02-26 00:39:40
【问题描述】:

我从图库中挑选了一个视频。但我想将此选定视频的拇指图像显示到 imageview。 我做了什么

   @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK) {
            if (requestCode == REQUEST_TAKE_GALLERY_VIDEO) {
                Uri selectedImageUri = data.getData();

                thumbVideoImage.setImageURI(selectedImageUri);


              String  filemanagerstring = selectedImageUri.getPath();

              thumbVideoImage.setImageURI(selectedImageUri);
                // MEDIA GALLERY
                selectedVideoPath = getPath(selectedImageUri);
                if (selectedVideoPath != null) {



                }
            }
        }
    }

但什么也没发生。请问有什么建议或示例代码吗? 另一个问题是我应该使用哪个视频网址将其发布到服务器?谢谢:)

【问题讨论】:

  • 我试过这个代码:video_imageview.setImageBitmap(ThumbnailUtils.createVideoThumbnail(selectedVideoFilePath, MediaStore.Video.Thumbnails.FULL_SCREEN_KIND));但什么也没发生

标签: android video android-intent imageview


【解决方案1】:

当您从图库中选择图像时,您应该转换为位图并将位图调整为更小 -> 此位图是缩略图,同时您从变量中保存 url 以在需要时获取原始图像。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-23
    • 2021-04-14
    • 1970-01-01
    • 2020-02-03
    • 2012-10-12
    相关资源
    最近更新 更多