decord/source/modules/rpc/server/commands/setOrientationLockState.tsx

64 lines
3.6 KiB
TypeScript
Raw Normal View History

// Module ID: 14548
// Function ID: 14549
// Name: setOrientationLockState
// Dependencies: [9603, 4512, 1920, 1085, 9650, 9647, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 14548 (setOrientationLockState)
import DispatcherDefault from "Dispatcher" /* 573 */;
import RPCErrorDefault from "RPCError" /* 9647 */;
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 9650 */;
import FramesStore from "FramesStore" /* 9603 */;
2026-07-23 10:11:24 +00:00
const TransportTypes = fn(4512).TransportTypes;
const OrientationLockState = fn(1920).OrientationLockState;
const Constants = fn(1085);
const RPCErrors = Constants.RPCErrors;
const size = fn(2);
const result = size.fileFinishedImporting("modules/rpc/server/commands/setOrientationLockState.tsx");
2026-07-20 16:05:17 +00:00
export default {
[Constants.RPCCommands.SET_ORIENTATION_LOCK_STATE]: {
2026-07-20 16:05:17 +00:00
validation(number) {
const obj = createRpcJoiSchemaObjectDefault(number);
const obj2 = { lock_state: null, picture_in_picture_lock_state: null, grid_lock_state: null };
const requiredResult = createRpcJoiSchemaObjectDefault(number).required();
2026-07-20 16:05:17 +00:00
const numberResult = number.number();
obj2.lock_state = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE).required();
const validResult = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE);
2026-07-20 16:05:17 +00:00
const numberResult1 = number.number();
const validResult3 = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE);
obj2.picture_in_picture_lock_state = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE).allow(null).optional();
const allowResult = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE).allow(null);
2026-07-20 16:05:17 +00:00
const numberResult2 = number.number();
const validResult4 = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE);
obj2.grid_lock_state = number.number().valid(OrientationLockState.UNLOCKED, OrientationLockState.PORTRAIT, OrientationLockState.LANDSCAPE).allow(null).optional();
return requiredResult.keys(obj2);
2026-07-20 16:05:17 +00:00
},
2026-08-06 08:05:19 +00:00
handler(arg0) {
({ socket, args } = arg0);
({ lock_state, picture_in_picture_lock_state } = args);
if (socket.source.type !== TransportTypes.POST_MESSAGE) {
const obj2 = { errorCode: RPCErrors.INVALID_COMMAND };
2026-08-06 08:05:19 +00:00
const _HermesInternal = HermesInternal;
const tmp182 = new RPCErrorDefault(obj2, "command not available from \"" + socket.source.type + "\" transport");
throw tmp182;
2026-07-20 16:05:17 +00:00
} else {
2026-08-06 08:05:19 +00:00
const id = socket.application.id;
if (null == id) {
const obj4 = { errorCode: RPCErrors.INVALID_COMMAND };
const tmp14 = new RPCErrorDefault(obj4, "No application.");
2026-08-06 08:05:19 +00:00
throw tmp14;
} else {
const frameByIframeId = FramesStore.getFrameByIframeId(socket.source.iframeId);
2026-08-06 08:05:19 +00:00
if (null != frameByIframeId) {
const obj5 = { type: "FRAME_SET_ORIENTATION_LOCK_STATE", frameId: frameByIframeId.id, lockState: lock_state, pictureInPictureLockState: picture_in_picture_lock_state };
DispatcherDefault.dispatch(obj5);
2026-08-06 08:05:19 +00:00
}
const obj6 = { type: "EMBEDDED_ACTIVITY_SET_ORIENTATION_LOCK_STATE", applicationId: id, lockState: lock_state, pictureInPictureLockState: picture_in_picture_lock_state, gridLockState: tmp };
DispatcherDefault.dispatch(obj6);
2026-08-06 08:05:19 +00:00
}
2026-07-20 16:05:17 +00:00
}
}
}
};