setLayoutOrientation method
Implementation
Future<void> setLayoutOrientation(LayoutOrientation orientation) async {
TCICLog.info(
'setLayoutOrientation ${orientation.name}',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.setLayoutOrientation.name,
);
final selfMemberInfo = _membersInfoObs.getMemberInfoByUserId(
getConfig().userId,
);
final currentMicStatus = selfMemberInfo?.micState;
final currentCameraStatus = selfMemberInfo?.cameraState;
if (orientation != LayoutOrientation.auto) {
if (currentMicStatus == StateStatusValueEnum.on) {
_trtcStreamInfoObs.updateNeedOpenMicAfterStartLocalPreview(true);
}
if (currentCameraStatus == StateStatusValueEnum.on) {
_trtcStreamInfoObs.updateNeedOpenCameraAfterStartLocalPreview(true);
}
}
if (orientation == LayoutOrientation.portrait) {
await DevicePlatform.setPortrait();
await DevicePlatform.setPortraitNative();
_classInfoObs.setAppOrientation(orientation);
} else if (orientation == LayoutOrientation.landscape) {
await DevicePlatform.setLandscape();
await DevicePlatform.setLandscapeNative();
_classInfoObs.setAppOrientation(orientation);
} else {
TCICLog.error(
'setLayoutOrientation failed: orientation is $orientation',
actionModule: ActionModule.tcicController.name,
actionName: ActionName.setLayoutOrientation.name,
);
}
}