本文介绍了如何在 android 中制作 YouTube 视频缩略图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 android 活动中,我想通过 YouTube 应用程序或其他应用程序播放来自 YouTube 的视频.为此,我想在我的活动中加载视频的缩略图.

In my android Activity I want to play video from YouTube through YouTube application or some other. For that I want to load thumbnails of the video in my activity.

这可能吗?如果是,怎么办?

Is this possible? If so, how?

推荐答案

YouTube 将视频的缩略图放在特定的可预测 URL 中.这会有点麻烦,但我相信你可以找到一种方法来显示 URL 中的图像,或者下载它们然后显示它们.

YouTube puts the thumbnails of the video at a specific predictable URL. It would be a bit of a pain, but I'm sure you could find a way to display the images from the URL, or to download them and then display them.

这里 在我的博客上关于这些缩略图 URL 的信息.

Here's information on my blog on what those thumbnail URLs are.

我将复制并粘贴我在博文中写的内容:

I'll copy and paste what I wrote in the blog post:

查看视频链接 - 例如,http://www.youtube.com/watch?v=GDFUdMvacI0

Look at the link for the video–for example, http://www.youtube.com/watch?v=GDFUdMvacI0

视频ID...v="​​之后的部分,在本例中为GDFUdMvacI0.如果 URL 比这更长,则只转到下一个与符号.例如,http://www.youtube.com/watch?v=GDFUdMvacI0&feature=youtu.be 是一样的,GDFUdMvacI0.

Take the video ID… the portion after "v=", in this case GDFUdMvacI0. If the URL is longer than that, only go until the next ampersand. For example, http://www.youtube.com/watch?v=GDFUdMvacI0&feature=youtu.be is the same, GDFUdMvacI0.

然后只需将您的视频 ID 替换为这些缩略图的以下网址中的视频 ID:

Then just substitute your video ID for the video ID in the following URLs to these thumbnail images:

0.jpg 是全尺寸图像.其他三个非常小(120×90),由 YouTube 从视频中的三个特定点自动拍摄.

0.jpg is a full-sized image. The other three are very small (120×90) and are taken automatically by YouTube from three certain points in the video.

这篇关于如何在 android 中制作 YouTube 视频缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:49
查看更多