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
51 public ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView) {
52 super(context);
53 this.renderTextureView = isRenderTextureView;
54 init(context, isRenderTextureView);
55 }
56
62 public ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView, boolean translucent) {
63 super(context);
64 this.renderTextureView = isRenderTextureView;
65 this.translucent = translucent;
66 init(context, isRenderTextureView);
67 }
68
69 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs) {
70 super(context, attrs);
71 initAttr(context, attrs);
72 init(context, renderTextureView);
73 }
74
75 private void initAttr(Context context, AttributeSet attrs) {
76 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ZoomVideoSDKVideoView);
77 renderTextureView = typedArray.getBoolean(R.styleable.ZoomVideoSDKVideoView_render_textureView, false);
78 translucent = typedArray.getBoolean(R.styleable.ZoomVideoSDKVideoView_render_translucent, true);
79 typedArray.recycle();
80 }
81
82 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs, int defStyle) {
83 super(context, attrs, defStyle);
84 initAttr(context, attrs);
85 init(context, renderTextureView);
86 }
87
88
89 private void init(Context context, boolean isRenderTextureView) {
90 if (isRenderTextureView) {
91 mVideoView = new SDKVideoTextureView(context, translucent, 0, 0);
92 } else {
93 mVideoView = new SDKVideoSurfaceView(context, translucent, 0, 0);
94 }
96 this.addView((View) mVideoView);
97 }
98
99 private void initVideoView() {
100 mVideoRender = new SDKVideoRender(mVideoView, mVideoView.hashCode(), this);
101 setTag(SDKVideoRender.KEY_TAG, mVideoRender);
102
103 if (mVideoView instanceof ZPGLSurfaceView) {
104 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
105 videoSurfaceView.setVideoRender(mVideoRender);
106 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
107 videoSurfaceView.setLayoutParams(lp);
108 } else if (mVideoView instanceof ZPGLTextureView) {
109 SDKVideoTextureView videoSurfaceView = (SDKVideoTextureView) mVideoView;
110 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
111 videoSurfaceView.setPreserveEGLContextOnPause(true);
112 videoSurfaceView.setVideoRender(mVideoRender);
113 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
114 videoSurfaceView.setLayoutParams(lp);
115 }
116 }
117
133 public void setZOrderMediaOverlay(boolean isMediaOverlay) {
134 if (!renderTextureView) {
135 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
136 videoSurfaceView.setZOrderMediaOverlay(isMediaOverlay);
137 }
138 }
139
157 public void setZOrderOnTop(boolean onTop) {
158 if (!renderTextureView) {
159 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
160 videoSurfaceView.setZOrderOnTop(onTop);
161 }
162 }
163
171 public void switchToLevel(float level, float x, float y) {
172 SDKVideoUnitMgr.getInstance().switchToLevel(level, x, y);
173 }
174}
Zoom Video SDK video canvas view.
boolean translucent
use translucent for video rendering
void init(Context context, boolean isRenderTextureView)
void setZOrderMediaOverlay(boolean isMediaOverlay)
See https://developer.android.com/reference/android/view/SurfaceView
ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView, boolean translucent)
void switchToLevel(float level, float x, float y)
Zoom In/out for share.
ZoomVideoSDKVideoView(Context context, AttributeSet attrs)
ZoomVideoSDKVideoView(Context context, AttributeSet attrs, int defStyle)
void setZOrderOnTop(boolean onTop)
See https://developer.android.com/reference/android/view/SurfaceView
void initAttr(Context context, AttributeSet attrs)
ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView)
boolean renderTextureView
use SurfaceView for performance ,use TextureView for ui animation.