Meeting SDK for Android API Reference
Loading...
Searching...
No Matches
ZoomSDKRenderer.java
Go to the documentation of this file.
1package us.zoom.sdk;
2
3import com.zipow.videobox.confapp.enums.CONF_CMD;
4import com.zipow.videobox.confapp.CmmUser;
5import com.zipow.videobox.confapp.VideoSessionMgr;
6import com.zipow.videobox.conference.jni.confinst.IConfInst;
7import com.zipow.videobox.conference.module.confinst.ZmConfInstMgr;
8
9import java.nio.ByteBuffer;
10
11import us.zoom.internal.ErrorCodeMapping;
12import us.zoom.internal.RTCConference;
13import us.zoom.internal.event.RTCVideoRawDataDelegate;
14import us.zoom.internal.event.SDKConfUIEventHandler;
15import us.zoom.internal.helper.SDKMeetingInterfaceHelper;
16
17
21public class ZoomSDKRenderer implements IZoomSDKRenderer {
22
23 private final static String TAG = ZoomSDKRenderer.class.getSimpleName();
24
25 private RTCVideoRawDataDelegate rtcVideoRawDataDelegate;
26
28
30
32
33 private int mSubscribeId = -1;
34
35 private boolean isSubscribed = false;
36
37
38 SDKConfUIEventHandler.ISDKConfUIListener simpleConfUIListener = new SDKConfUIEventHandler.SimpleSDKConfUIListener() {
39 @Override
40 public boolean onConfStatusChanged2(int cmd, long ret) {
41 if (cmd == CONF_CMD.CMD_CONF_LEAVE_COMPLETE) {
43 } else if (cmd == CONF_CMD.CMD_CONF_SILENTMODE_CHANGED) {
44 if (SDKMeetingInterfaceHelper.isInSlientMode()) {
46 }
47 }
48 return true;
49 }
50 };
51
52 private void onConfLeave() {
54 if (null != rtcVideoRawDataDelegate) {
57 }
58 SDKConfUIEventHandler.getInstance().removeListener(simpleConfUIListener);
59 }
60
61
62 private RTCVideoRawDataDelegate.RTCVideoRawDataListener listener = new RTCVideoRawDataDelegate.SimpleRTCVideoRawDataListener() {
63
64
65 @Override
66 public void onSubscribedVideoUserDataOn() {
67 if (null != delegate) {
69 }
70 }
71
72 @Override
73 public void onSubscribedVideoUserDataOff() {
74 if (null != delegate) {
76 }
77 }
78
79 @Override
80 public void onSubscribedShareUserDataOff() {
81 if (null != delegate) {
83 }
84 }
85
86 @Override
87 public void onSubscribedShareUserDataOn() {
88 if (null != delegate) {
90 }
91 }
92
93
94 @Override
95 public void onVideoRawDataReceived(ByteBuffer yBuffer, ByteBuffer uBuffer, ByteBuffer vBuffer, ByteBuffer aBuffer, boolean isLimited, int streamWidth, int streamHeight, int rotation,long timeStamp, long nativeHandle, long nativeYHandle, long nativeUHandle, long nativeVHandle, long nativeAHandle) {
97 ZoomSDKVideoRawData rawData = new ZoomSDKVideoRawData(yBuffer, uBuffer, vBuffer, aBuffer, isLimited, streamWidth, streamHeight, rotation,timeStamp, ZoomSDKVideoRawData.FORMAT_TYPE_I420, nativeHandle, nativeYHandle, nativeUHandle, nativeVHandle, nativeAHandle);
98 delegate.onVideoRawDataFrame(rawData);
99 }
100 }
101
102 @Override
103 public void onShareRawDataReceived(ByteBuffer yBuffer, ByteBuffer uBuffer, ByteBuffer vBuffer, boolean isLimited, int streamWidth, int streamHeight, int rotation,long timeStamp, long nativeHandle, long nativeYHandle, long nativeUHandle, long nativeVHandle) {
105 ZoomSDKVideoRawData rawData = new ZoomSDKVideoRawData(yBuffer, uBuffer, vBuffer, isLimited, streamWidth, streamHeight, rotation,timeStamp, ZoomSDKVideoRawData.FORMAT_TYPE_I420, nativeHandle, nativeYHandle, nativeUHandle, nativeVHandle);
106 delegate.onVideoRawDataFrame(rawData);
107 }
108 }
109 };
110
117 this.delegate = dataDelegate;
118 SDKConfUIEventHandler.getInstance().addListener(simpleConfUIListener);
119 rtcVideoRawDataDelegate = new RTCVideoRawDataDelegate(listener);
120 }
121
128 if (null == resolution) {
129 return;
130 }
131 if (resolution != this.mResolution) {
132 this.mResolution = resolution;
133 if (isSubscribed) {
135 }
136 }
137 }
138
139
140 public MobileRTCRawDataError subscribe(long subscribeId, ZoomSDKRawDataType type) {
141
142 if (SDKMeetingInterfaceHelper.isInSlientMode()) {
144 }
145
146 int id = (int) subscribeId;
147
148 RTCConference conference = RTCConference.getInstance();
149
150 if (null == conference) {
152 }
153 if (null == rtcVideoRawDataDelegate) {
155 }
156
157
158 //resubscribe
159 if ((mSubscribeId >= 0 && mSubscribeId != id) || (null != mRawDataType && mRawDataType != type)) {
160 unSubscribe();
161 }
162
163 //start preview
164 if (id == 0 && type == ZoomSDKRawDataType.RAW_DATA_TYPE_VIDEO) {
166 VideoSessionMgr videoMgr = ZmConfInstMgr.getInstance().getCurrentConfInst().getVideoObj();
167 if (null != videoMgr) {
168 CmmUser user = ZmConfInstMgr.getInstance().getCurrentConfInst().getMyself();
169 if (null != user) {
170 id = (int) ZmConfInstMgr.getInstance().getCurrentConfInst().getMyself().getNodeId();
171 }
172 }
173 }
174 }
175
176 int result = MobileRTCRawDataError.MobileRTCRawData_Success.ordinal();
177 int size = mResolution.getValue();
178
180 result = conference.getVideoRawDataHelper().subscribe(id, size, rtcVideoRawDataDelegate.getRecevHandle());
181 } else if (type == ZoomSDKRawDataType.RAW_DATA_TYPE_SHARE) {
182 result = conference.getShareRawDataHelper().subscribe(id, size, rtcVideoRawDataDelegate.getRecevHandle());
183 }
184
185 if (result == MobileRTCRawDataError.MobileRTCRawData_Success.ordinal()) {
186 this.mSubscribeId = id;
187 mRawDataType = type;
188 isSubscribed = true;
189 }
190 return ErrorCodeMapping.mapping(result);
191 }
192
193
200 RTCConference conference = RTCConference.getInstance();
201 if (null == conference || null == mRawDataType) {
203 }
204
205 if (!isSubscribed) {
207 }
208
209 if (null == rtcVideoRawDataDelegate) {
211 }
212
213 int result = MobileRTCSDKError.SDKERR_SUCCESS.ordinal();
214
215 if (mSubscribeId == 0) {
216 IConfInst confMgr = ZmConfInstMgr.getInstance().getCurrentConfInst();
217 if (null != confMgr) {
218 CmmUser mySelf = confMgr.getMyself();
219 if (null != mySelf) {
220 mSubscribeId = (int) mySelf.getNodeId();
221 }
222 }
223 }
225 result = conference.getVideoRawDataHelper().unSubscribe(mSubscribeId, rtcVideoRawDataDelegate.getRecevHandle());
227 result = conference.getShareRawDataHelper().unSubscribe(mSubscribeId, rtcVideoRawDataDelegate.getRecevHandle());
228 }
229
230 if (result == MobileRTCSDKError.SDKERR_SUCCESS.ordinal()) {
231 isSubscribed = false;
232 mSubscribeId = -1;
233 mRawDataType = null;
235 }
236
237 return ErrorCodeMapping.mapping(result);
238 }
239
248
254 @Override
256 return mRawDataType;
257 }
258
264 public long getSubscribeId() {
265 return mSubscribeId;
266 }
267}
Zoom SDK global manager.
Definition ZoomSDK.java:12
static ZoomSDK getInstance()
Gets a shared instance of Zoom SDK. Must call from the main thread.
Definition ZoomSDK.java:25
MeetingService getMeetingService()
Gets the instance of meeting service.
Definition ZoomSDK.java:266
RTCVideoRawDataDelegate.RTCVideoRawDataListener listener
ZoomSDKRawDataType mRawDataType
long getSubscribeId()
Gets the subscribe ID.
ZoomSDKRawDataType getRawDataType()
Gets the raw data type.
void setRawDataResolution(ZoomSDKVideoResolution resolution)
Sets the raw data video resolution.
ZoomSDKVideoResolution getResolution()
Gets the raw data video resolution.
ZoomSDKVideoResolution mResolution
ZoomSDKRenderer(IZoomSDKVideoRawDataDelegate dataDelegate)
Constructs a ZoomSDKRenderer instance.
IZoomSDKVideoRawDataDelegate delegate
MobileRTCRawDataError unSubscribe()
Unsubscribes raw data. User should call when leaving the room or removing the render view.
SDKConfUIEventHandler.ISDKConfUIListener simpleConfUIListener
MobileRTCRawDataError subscribe(long subscribeId, ZoomSDKRawDataType type)
Subscribes to user video by user ID and raw data type.
RTCVideoRawDataDelegate rtcVideoRawDataDelegate
Zoom SDK Video raw data bean.
Enumeration of meeting status.
Enumeration of raw data errors.
Enumeration of common SDK errors.
Enumeration of raw data types.
Enumeration of video resolution options.
Interface for video raw data renderer operations.
MeetingStatus getMeetingStatus()