setLayoutOrientation method
Implementation
Future<void> setLayoutOrientation(LayoutOrientation orientation) async {
TCICLog.info('setLayoutOrientation ${orientation.name}', actionModule: ActionModule.tcicController.name, actionName: ActionName.setLayoutOrientation.name);
final currentMicStatus = _membersInfoObs.selfMicState.value;
final currentCameraStatus = _membersInfoObs.selfCameraState.value;
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();
DevicePlatform.setPortraitNative();
_classInfoObs.setAppOrientation(orientation);
} else if (orientation == LayoutOrientation.landscape) {
await DevicePlatform.setLandscape();
DevicePlatform.setLandscapeNative();
_classInfoObs.setAppOrientation(orientation);
} else {
TCICLog.error('setLayoutOrientation failed: orientation is $orientation', actionModule: ActionModule.tcicController.name, actionName: ActionName.setLayoutOrientation.name);
}
}