Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios YTPlayerView缩略图自定义大小_Ios_Objective C_Youtube Javascript Api_Ytplayerview - Fatal编程技术网

Ios YTPlayerView缩略图自定义大小

Ios YTPlayerView缩略图自定义大小,ios,objective-c,youtube-javascript-api,ytplayerview,Ios,Objective C,Youtube Javascript Api,Ytplayerview,我正在使用Google上的YTPlayerView库。我想为我的iOS应用程序获取自定义大小的youtube视频缩略图 有人能帮我怎么做到这一点吗?当前,无论我的YTPlayerViewYTPlayerView的大小如何,它都会为视频提供相同大小的缩略图。load自动加载它自己的缩略图。不过,一种解决方法是将UIImageView放在YTPlayerview的顶部。并将自定义缩略图加载到该UIImageview中。使用YTplayerview.play单击UIImageview时,可以开始播放视

我正在使用
Google
上的
YTPlayerView
库。我想为我的
iOS
应用程序获取自定义大小的youtube视频缩略图


有人能帮我怎么做到这一点吗?当前,无论我的
YTPlayerView
YTPlayerView的大小如何,它都会为视频提供相同大小的缩略图。load
自动加载它自己的缩略图。不过,一种解决方法是将
UIImageView
放在
YTPlayerview
的顶部。并将自定义缩略图加载到该
UIImageview
中。使用
YTplayerview.play
单击
UIImageview
时,可以开始播放视频。然后隐藏缩略图。从本质上说,它会给视频播放的效果点击您的自定义缩略图图像。您可能需要对某些内容进行微调,以使此解决方案优雅地工作

要检索自定义缩略图的图像,可以使用youtube的4个生成图像中的任意一个。可以预见,它们的格式如下:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
对于高质量版本的缩略图,请使用类似以下内容的url:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
https://img.youtube.com/vi//hqdefault.jpg
我希望这有助于回答你的问题

https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg