捕获按钮点击屏幕截图来自YouTube播放器的Andr​​oid [英] Capture Screenshots on button click from Youtube Player Android

查看:238
本文介绍了捕获按钮点击屏幕截图来自YouTube播放器的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有从YouTube播放器捕捉按钮,点击视频帧任何可能的方式?或YouTube播放器不允许这样做?

下面code使图像与黑色的屏幕:

  rootView.setDrawingCacheEnabled(真);
rootView.buildDrawingCache(真);
FileOutputStream中的FileOutputStream =新的FileOutputStream(的ImagePath);
rootView.getDrawingCache(真).COM preSS(比较pressFormat.JPEG,100,
               FileOutputStream中);
fileOutputStream.flush();
fileOutputStream.close();
rootView.setDrawingCacheEnabled(假);


解决方案

正如有人说这里,儿童 SurfaceView 通常是硬件加速,因此不使用标准视图层次体系。

通过YouTube SDK最可能使用这个对象来显示视频,这就是为什么你的code是行不通的。

Is there any possible way to capture video frames on button click from Youtube Player? Or Youtube player does not allow this?

Below code gives image with black screen:

rootView.setDrawingCacheEnabled(true);
rootView.buildDrawingCache(true);          
FileOutputStream fileOutputStream = new FileOutputStream(imagePath);
rootView.getDrawingCache(true).compress(CompressFormat.JPEG, 100,
               fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
rootView.setDrawingCacheEnabled(false);

解决方案

As it has been said here, children of SurfaceView are typically hardware accelerated and thus do not use the standard view hierarchy system.

The YouTube SDK most likely uses this object to display the video, and that is why your code is not working.

这篇关于捕获按钮点击屏幕截图来自YouTube播放器的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆