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
29 private final static String TAG = ZoomVideoSDKVideoView.class.getSimpleName();
30
31 private BaseSDKVideoView mVideoView;
32
33 private SDKVideoRender mVideoRender;
34
35 private boolean isShareView = false;
36
37 public ZoomVideoSDKVideoView(Context context) {
38 super(context);
39 init(context, renderTextureView);
40 }
41
46 public ZoomVideoSDKVideoView(Context context, boolean isRenderTextureView) {
47 super(context);
48 this.renderTextureView = isRenderTextureView;
49 init(context, isRenderTextureView);
50 }
51
52 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs) {
53 super(context, attrs);
54 initAttr(context, attrs);
55 init(context, renderTextureView);
56 }
57
58 private void initAttr(Context context, AttributeSet attrs) {
59 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ZoomVideoSDKVideoView);
60 renderTextureView = typedArray.getBoolean(R.styleable.ZoomVideoSDKVideoView_render_textureView, false);
61 typedArray.recycle();
62 }
63
64 public ZoomVideoSDKVideoView(Context context, AttributeSet attrs, int defStyle) {
65 super(context, attrs, defStyle);
66 initAttr(context, attrs);
67 init(context, renderTextureView);
68 }
69
70
71 private void init(Context context, boolean isRenderTextureView) {
72 if (isRenderTextureView) {
73 mVideoView = new SDKVideoTextureView(context);
74 } else {
75 mVideoView = new SDKVideoSurfaceView(context);
76 }
78 this.addView((View) mVideoView);
79 }
80
81 private void initVideoView() {
82 mVideoRender = new SDKVideoRender(mVideoView, mVideoView.hashCode(), this);
83 setTag(SDKVideoRender.KEY_TAG, mVideoRender);
84
85 if (mVideoView instanceof ZPGLSurfaceView) {
86 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
87 videoSurfaceView.setVideoRender(mVideoRender);
88 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
89 videoSurfaceView.setLayoutParams(lp);
90 } else if (mVideoView instanceof ZPGLTextureView) {
91 SDKVideoTextureView videoSurfaceView = (SDKVideoTextureView) mVideoView;
92 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
93 videoSurfaceView.setPreserveEGLContextOnPause(true);
94 videoSurfaceView.setVideoRender(mVideoRender);
95 FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
96 videoSurfaceView.setLayoutParams(lp);
97 }
98 }
99
115 public void setZOrderMediaOverlay(boolean isMediaOverlay) {
116 if (!renderTextureView) {
117 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
118 videoSurfaceView.setZOrderMediaOverlay(isMediaOverlay);
119 }
120 }
121
139 public void setZOrderOnTop(boolean onTop) {
140 if (!renderTextureView) {
141 SDKVideoSurfaceView videoSurfaceView = (SDKVideoSurfaceView) mVideoView;
142 videoSurfaceView.setZOrderOnTop(onTop);
143 }
144 }
145
153 public void switchToLevel(float level, float x, float y) {
154 SDKVideoUnitMgr.getInstance().switchToLevel(level, x, y);
155 }
156}
Zoom Video SDK video canvas view.
void init(Context context, boolean isRenderTextureView)
void setZOrderMediaOverlay(boolean isMediaOverlay)
See https://developer.android.com/reference/android/view/SurfaceView
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.