Skip to content

Conversation

nbradbury
Copy link
Contributor

Fixes #6572 - the media browser now shows a thumbnail for local videos (ie: videos that are still uploading).

Note that this fix uncovers a separate issue: after the video is uploaded, we don't immediately have the thumbnail URL from the backend, so it shows as blank in the media browser after the upload completes.

cc: @daniloercoli

@daniloercoli daniloercoli self-assigned this Aug 24, 2017
}
}

private void loadLocalVideoThumbnail(final String filePath, final WPNetworkImageView imageView) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to investigate if ImageUtils.getVideoFrameFromVideo can be used in this case?
We're using it in Aztec and it seems to work very fine for both remote and local videos.

if (isLocalFile) {
loadLocalVideoThumbnail(media.getFilePath(), holder.imageView);
} else {
holder.imageView.setImageUrl(media.getThumbnailUrl(), WPNetworkImageView.ImageType.VIDEO);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media.getThumbnailUrl() seems to return null for self hosted sites. ImageUtils.getVideoFrameFromVideo should load the frame from the network instead. Note that's a blocking routine.

@nbradbury
Copy link
Contributor Author

@daniloercoli Good call on using getVideoFrameFromVideo(). I made that change in 3f49029 and it seems to work well, plus it also takes care of the problem I mentioned above about the thumbnail url not being available right after upload.

@daniloercoli
Copy link
Contributor

I noticed a wrong thumb picture is shown on the screen as soon as the video is uploaded.
See the recording here: https://cloudup.com/cKvGn2towOA

  • The video is uploaded to the server and the thumb is correct

  • The upload finishes and the wrong picture is shown on the screen

  • Re-opening media doesn't show the thumb, but this could be a problem on my end where the network connection is slow and the remote video downloading could take time. At the endi of the video you can see the proper thumb.

@nbradbury
Copy link
Contributor Author

I noticed a wrong thumb picture is shown on the screen as soon as the video is uploaded.

I wasn't able to repro that, but I suspect it was due to me not clearing the existing bitmap before retrieving it (which can cause incorrect images to appear from recycled views). Fixed in 56f538c

@daniloercoli
Copy link
Contributor

Setting the bitmap to null seems seems to fix the issue.
:shipit:

@daniloercoli daniloercoli merged commit a133fa3 into develop Aug 25, 2017
@daniloercoli daniloercoli deleted the issue/6572-local-video-thumb branch August 25, 2017 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Media Library - Video thumb and details screen aren't available while uploading

2 participants