是否可以移植类TextureView到Android蜂窝 [英] Is it possible to transplant the class TextureView to Android Honeycomb

查看:435
本文介绍了是否可以移植类TextureView到Android蜂窝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算实现一个功能,同时播放一些视频在一个屏幕和视频的意见可以,而他们正在播放视频的滚动。

I plan to implement a feature playing several videos in one screen simultaneously and video views can be scrolled while they are playing videos.

我要的视频观看次数增加它作为自己的父视图一个ListView。我们不应该使用SurfaceView呈现视频流,因为SurfaceView无法通过Android设备上查看层次结构redrawed。这是一个坏主意,滚动SurfaceView。

I am going to add video views to a ListView which acts as their parent view. We should not use SurfaceView to render the video stream, because SurfaceView can not be redrawed by android view hierarchy. It is a bad idea to scroll SurfaceView.

幸运的是,TextureView是因为API级别14补充说,这是SurfaceView的替代品。因此,我可以用它来实现我的计划。

Fortunately, TextureView was added since API level 14, it was a replacer of SurfaceView. So I can use it to achieve my plan.

但TextureView仅高于API级别14.其实我是要求实现在一个平台上它并不比API级别低11此功能。

But TextureView is available only above API level 14. In fact, I was demanded to implement this feature in a platform which is not lower than API level 11.

我开始关注向其中添加自API级别11到Android表面纹理,
我们可以使用到表面纹理或者把相机图像流或视频去codeD流到一个OpenGL纹理,我也知道Android视图层次是OpenGL的,而不是因为Skia的API级别11 drawed。

I start to pay attention to SurfaceTexture which was added to android since API level 11, We can use SurfaceTexture to either put the camera image stream or video decoded stream onto an OpenGL texture, I also know that android view hierarchy is drawed by opengl instead of skia since api level 11.

所以我想如果我可以使视频流使用上一个表面纹理的Andr​​oid普通视图。

So I wonder if I can render the video stream onto a ordinary android view using SurfaceTexture.

在换句话说,我们可以实现对API级别11-13定制的小部件,以取代自加TextureView的位置API级别14?

In other words, can we implement a customized widget for api level 11-13 to replace the position of TextureView added since api level 14?

我看着android.view.TextureView源$ C ​​$ C,这是不是很复杂,依赖类如下:

I have looked into the source code of android.view.TextureView,it is not very complicated, the dependence classes are as follow:

package android.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;

和有4个原生API:

private native void nCreateNativeWindow(SurfaceTexture surface);
private native void nDestroyNativeWindow();

private static native boolean nLockCanvas(int nativeWindow, Canvas canvas, Rect dirty);
private static native void nUnlockCanvasAndPost(int nativeWindow, Canvas canvas);

是否有可能到类TextureView移植到Android API级11-13?

谁能给我一些建议?

推荐答案

我不能给你一个明确的答案,但我怀疑它的东西,你可以拖放到你的应用程序。有可能与私人API的反射访问。

I can't give you a definitive answer, but I doubt it's something you can just drop into your app. It might be possible with reflective access to private APIs.

我看不出这将是值得的。如果你看一下版本信息中心你会看到姜饼及更早账户约5.9%的有源器件(如2015年7月7日的),所以即使你做它用API 10工作,你只用百分之几来增加你的市场份额。硬件加速的浏览功能在API 11进行了介绍,所以我希望使得API 10 TextureView工作将更加的挑战。 11 API在仪表盘中甚至没有叫出来 - 据我所知,进行了蜂窝状的几台设备都符合升级ICS

I can't see how this would be worthwhile. If you look at the version dashboard you'll see that Gingerbread and earlier accounts for about 5.9% of active devices (as of July 7 2015), so even if you made it work with API 10 you would only be increasing your market share by a few percent. The hardware-accelerated View features were introduced in API 11, so I expect making TextureView work in API 10 would be even more of a challenge. API 11 isn't even called out in the dashboard -- AFAIK the few devices that got Honeycomb were all eligible for upgrades to ICS.

(哪些具体的设备,你希望能与11 API支持与API 14?只是有没有那么多未升级摩托罗拉Xooms在那里。你有一个API 11设备符合测试?)

(Which specific devices are you hoping to support with API 11 vs. API 14? There's just not that many un-upgraded Motorola Xooms out there. Do you have an API 11 device to test with?)

使事情更加复杂的是缺乏API源11 code的。蜂窝状的来源从未被释放。所以,你会做在黑暗中摸索设法得到它的工作了很多。

Making things even more complicated is the lack of API 11 source code. Honeycomb's sources were never released. So you'll be doing a lot of fumbling in the dark trying to get it to work.

我觉得你最好的选择是回推谁发出请求。

I think your best option is to push back on whoever is making the request.

这篇关于是否可以移植类TextureView到Android蜂窝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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