import { CallContext } from "./types";
/**
* 카메라 변경
*/
export const switchCamera = ({ context }: { context: CallContext }) => {
context.services.mediaManager.switchCamera();
};
/**
* 토글 오디오
*/
export const toggleAudio = ({ context }: { context: CallContext }) => {
context.services.mediaManager.toggleAudio();
};
/**
* 시그널링 연결
*/
export const connectSignaling = ({ context }: { context: CallContext }) => {
context.services.signalingClient.connect();
};
/**
* 시그널링 연결 해제
*/
export const disconnectSignaling = ({ context }: { context: CallContext }) => {
context.services.signalingClient.disconnect();
};
/**
* 매칭 요청
*/
export const requestMatch = ({ context }: { context: CallContext }) => {
context.services.matchingService.requestMatch(context.matchRequest!);
};
/**
* 매칭 취소
*/
export const cancelMatch = ({ context }: { context: CallContext }) => {
context.services.matchingService.abortMatch();
};
/**
* WebRTC 연결 시작
*/
export const initializeConnection = ({ context }: { context: CallContext }) => {
context.services.rtcConnectionManager.initialize();
context.services.rtcConnectionManager.addLocalStream(context.localStream!);
};
/**
* WebRTC 연결 종료
*/
export const closeConnection = ({ context }: { context: CallContext }) => {
context.services.rtcConnectionManager.close();
};
/**
* WebRTC 정리
*/
export const disposeConnection = ({ context }: { context: CallContext }) => {
context.services.rtcConnectionManager.dispose();
};