use of com.herewhite.sdk.domain.SDKError in project whiteboard-android by netless-io.
the class CameraMoveImageActivity method joinRoom.
private void joinRoom() {
WhiteSdkConfiguration configuration = new WhiteSdkConfiguration(demoAPI.getAppId(), true);
whiteSdk = new WhiteSdk(whiteboardView, this, configuration);
RoomParams roomParams = new RoomParams(demoAPI.getRoomUUID(), demoAPI.getRoomToken(), DemoAPI.DEFAULT_UID);
whiteSdk.joinRoom(roomParams, new EmptyRoomListener(), new Promise<Room>() {
@Override
public void then(Room room) {
CameraMoveImageActivity.this.room = room;
loadImageInfo(TEST_IMAGE_URL);
}
@Override
public void catchEx(SDKError t) {
showToast(t.getMessage());
}
});
}
use of com.herewhite.sdk.domain.SDKError in project whiteboard-android by netless-io.
the class RoomActivityTest method setScenePath_should_start_with_slash_CDL.
@Test
public void setScenePath_should_start_with_slash_CDL() {
onIdle();
CountDownLatch countDownLatch = new CountDownLatch(1);
onView(isRoot()).perform(new SimpleViewAction() {
@Override
public void perform(UiController uiController, View view) {
errorMessage = null;
mActivity.mRoom.setScenePath("invalid/path", new Promise<Boolean>() {
@Override
public void then(Boolean aBoolean) {
countDownLatch.countDown();
}
@Override
public void catchEx(SDKError t) {
errorMessage = t.getMessage();
countDownLatch.countDown();
}
});
}
});
try {
countDownLatch.await();
assertEquals("path \"invalid/path\" should start with \"/\"", errorMessage);
} catch (InterruptedException e) {
fail();
}
}
use of com.herewhite.sdk.domain.SDKError in project whiteboard-android by netless-io.
the class SdkJsInterfaceImpl method setupFail.
@JavascriptInterface
public void setupFail(Object args) {
JSONObject jsonObject = convertToJsonOrNull(args);
if (commonCallback != null && jsonObject != null) {
SDKError sdkError = SDKError.parseError(jsonObject);
commonCallback.sdkSetupFail(sdkError);
}
}
use of com.herewhite.sdk.domain.SDKError in project whiteboard-android by netless-io.
the class PlayerTest method getPlayerState.
@Test
public void getPlayerState() {
PlayerState playerPhase = mPlayer.getPlayerState();
assertNull(playerPhase);
mPlayer.getPlayerState(new Promise<PlayerState>() {
@Override
public void then(PlayerState playerState) {
}
@Override
public void catchEx(SDKError t) {
}
});
verify(mockJsBridgeInterface).callHandler(eq("player.state.playerState"), any(), any());
}
use of com.herewhite.sdk.domain.SDKError in project whiteboard-android by netless-io.
the class Room method getRoomMembers.
/**
* 获取房间的用户列表。
*
* @note
* - 该方法为异步调用。
* - 房间的用户列表仅包含互动模式(具有读写权限)的用户,不包含订阅模式(只读权限)的用户。
*
* @param promise `Promise<RoomMember[]>` 接口实例,详见 {@link com.herewhite.sdk.domain.Promise Promise}。你可以通过该接口获取 `getRoomMembers` 的调用结果:
* - 如果方法调用成功,则返回用户列表,详见 {@link com.herewhite.sdk.domain.RoomMember RoomMember}。
* - 如果方法调用失败,则返回错误信息。
*/
public void getRoomMembers(final Promise<RoomMember[]> promise) {
bridge.callHandler("room.getRoomMembers", new Object[] {}, new OnReturnValue<Object>() {
@Override
public void onValue(Object o) {
try {
promise.then(gson.fromJson(String.valueOf(o), RoomMember[].class));
} catch (AssertionError a) {
throw a;
} catch (JsonSyntaxException e) {
Logger.error("An JsonSyntaxException occurred while parse json from getRoomMembers", e);
promise.catchEx(new SDKError(e.getMessage()));
} catch (Throwable e) {
Logger.error("An exception occurred in getRoomMembers promise then method", e);
promise.catchEx(new SDKError(e.getMessage()));
}
}
});
}
Aggregations