Video SDK for Android API Reference
Loading...
Searching...
No Matches
ZoomVideoSDKVideoView.java
Go to the documentation of this file.
1package us.zoom.sdk;
2
3import android.content.Context;
4import android.content.res.TypedArray;
5import android.os.Build;
6import android.util.AttributeSet;
7import android.view.View;
8import android.widget.FrameLayout;
9
10import us.zoom.internal.video.BaseSDKVideoView;
11import us.zoom.internal.video.SDKVideoRender;
12import us.zoom.internal.video.SDKVideoSurfaceView;
13import us.zoom.internal.video.SDKVideoTextureView;
14import us.zoom.internal.video.SDKVideoUnitMgr;
15import us.zoom.internal.video.ZPGLSurfaceView;
16import us.zoom.internal.video.ZPGLTextureView;
17import us.zoom.videomeetings.R;
18
22public class ZoomVideoSDKVideoView extends FrameLayout {
23
27 protected boolean renderTextureView = false;
28
32 protected boolean translucent = true;
33
34 private final static String TAG = ZoomVideoSDKVideoView.class.getSimpleName();
35
36 private BaseSDKVideoView mVideoView;
37
38 private SDKVideoRender mVideoRender;
39
40 private boolean isShareView = false;
41
42 public ZoomVideoSDKVideoView(Context context) {
43 super(context);
44 init(context, renderTextureView);
45 }
46
52 public ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView) {
53 super(context);
54 this.renderTextureView = isRenderTextureView;
55 init(context, isRenderTextureView);
56 }
57
64 public ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView, boolean translucent) {
65 super(context);
66 this.renderTextureView = isRenderTextureView;
67 this.translucent = translucent;
68 init(context, isRenderTextureView);
69 }
70
71 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs) {
72 super(context, attrs);
73 initAttr(context, attrs);
74 init(context, renderTextureView);
75 }
76
77 private void initAttr(Context context, AttributeSet attrs) {
78 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ZoomVideoSDKVideoView);
79 renderTextureView = typedArray.getBoolean(R.styleable.ZoomVideoSDKVideoView_render_textureView, false);
80 translucent = typedArray.getBoolean(R.styleable.ZoomVideoSDKVideoView_render_translucent, true);
81 typedArray.recycle();
82 }
83
84 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs, int defStyle) {
85 super(context, attrs, defStyle);
86 initAttr(context, attrs);
87 init(context, renderTextureView);
88 }
89
90
91 private void init(Context context, boolean isRenderTextureView) {
92 if (isRenderTextureView) {
93 mVideoView = new SDKVideoTextureView(context, translucent, 0, 0);
94 } else {
95 mVideoView = new SDKVideoSurfaceView(context, translucent, 0, 0);
96 }
98 this.addView((View) mVideoView);
99 }
100
101 private void initVideoView() {
102 mVideoRender = new SDKVideoRender(mVideoView, mVideoView.hashCode(), this);
103 setTag(SDKVideoRender.KEY_TAG, mVideoRender);
104
105 if (mVideoView instanceof ZPGLSurfaceView) {
106 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
107 videoSurfaceView.setVideoRender(mVideoRender);
108 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
109 videoSurfaceView.setLayoutParams(lp);
110 } else if (mVideoView instanceof ZPGLTextureView) {
111 SDKVideoTextureView videoSurfaceView = (SDKVideoTextureView) mVideoView;
112 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
113 videoSurfaceView.setPreserveEGLContextOnPause(true);
114 videoSurfaceView.setVideoRender(mVideoRender);
115 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
116 videoSurfaceView.setLayoutParams(lp);
117 }
118 }
119
127 public void setZOrderMediaOverlay(boolean isMediaOverlay) {
128 if (!renderTextureView) {
129 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
130 videoSurfaceView.setZOrderMediaOverlay(isMediaOverlay);
131 }
132 }
133
142 public void setZOrderOnTop(boolean onTop) {
143 if (!renderTextureView) {
144 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
145 videoSurfaceView.setZOrderOnTop(onTop);
146 }
147 }
148
155 public void switchToLevel(float level, float x, float y) {
156 SDKVideoUnitMgr.getInstance().switchToLevel(level, x, y);
157 }
158}
Zoom Video SDK video canvas view.
boolean translucent
Uses translucent for video rendering.
void init(Context context, boolean isRenderTextureView)
void setZOrderMediaOverlay(boolean isMediaOverlay)
Controls whether the surface view's surface is placed on top of another regular surface view in the w...
ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView, boolean translucent)
Constructor.
void switchToLevel(float level, float x, float y)
Zooms in or out for share.
ZoomVideoSDKVideoView(Context context, AttributeSet attrs)
ZoomVideoSDKVideoView(Context context, AttributeSet attrs, int defStyle)
void setZOrderOnTop(boolean onTop)
Controls whether the surface view's surface is placed on top of its window. Normally it is placed beh...
void initAttr(Context context, AttributeSet attrs)
ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView)
Constructor.
boolean renderTextureView
Uses SurfaceView for performance, or TextureView for UI animation.