다음을 통해 공유


손 들기 상태

중요한

Azure Communication Services의 이 기능은 현재 미리 보기 상태입니다. 미리 보기의 기능은 공개적으로 사용할 수 있으며 모든 신규 및 기존 Microsoft 고객이 사용할 수 있습니다.

이 미리 보기 버전은 서비스 수준 계약 없이 제공되며, 프로덕션 워크로드에는 권장되지 않습니다. 특정 기능이 지원되지 않거나 기능이 제한될 수 있습니다.

자세한 내용은 Microsoft Azure Preview에 대한 추가 사용 약관을 참조하세요.

중요한

Azure Communication Services의 이 기능은 현재 미리 보기 상태입니다. 미리 보기의 기능은 공개적으로 사용할 수 있으며 모든 신규 및 기존 Microsoft 고객이 사용할 수 있습니다.

이 미리 보기 버전은 서비스 수준 계약 없이 제공되며, 프로덕션 워크로드에는 권장되지 않습니다. 특정 기능이 지원되지 않거나 기능이 제한될 수 있습니다.

자세한 내용은 Microsoft Azure Preview에 대한 추가 사용 약관을 참조하세요.

중요한

Azure Communication Services의 이 기능은 현재 미리 보기 상태입니다. 미리 보기의 기능은 공개적으로 사용할 수 있으며 모든 신규 및 기존 Microsoft 고객이 사용할 수 있습니다.

이 미리 보기 버전은 서비스 수준 계약 없이 제공되며, 프로덕션 워크로드에는 권장되지 않습니다. 특정 기능이 지원되지 않거나 기능이 제한될 수 있습니다.

자세한 내용은 Microsoft Azure Preview에 대한 추가 사용 약관을 참조하세요.

활성 통화 중에는 다른 참가자로부터 상태를 보내고 받는 것이 좋습니다. 방법을 알아보겠습니다.

필수 조건

SDK 설치

npm install 명령을 사용하여 다음과 같은 JavaScript용 Azure Communication Services Common 및 통화 SDK를 설치합니다.

npm install @azure/communication-common --save
npm install @azure/communication-calling --save

필수 개체 초기화

대부분의 호출 작업에는 CallClient 인스턴스가 필요합니다. 새 CallClient 인스턴스를 만들 때 Logger 인스턴스와 같은 사용자 지정 옵션을 사용하여 이 새 인스턴스를 구성할 수 있습니다.

CallClient 인스턴스를 사용하면 CallAgent를 호출하여 createCallAgent 인스턴스를 만들 수 있습니다. 이 메서드는 CallAgent 인스턴스 개체를 비동기적으로 반환됩니다.

createCallAgent 메서드는 CommunicationTokenCredential을 인수로 사용합니다. 사용자 액세스 토큰이 허용됩니다.

getDeviceManager 인스턴스에서 CallClient 메서드를 사용하여 deviceManager에 액세스할 수 있습니다.

const { CallClient } = require('@azure/communication-calling');
const { AzureCommunicationTokenCredential} = require('@azure/communication-common');
const { AzureLogger, setLogLevel } = require("@azure/logger");

// Set the logger's log level
setLogLevel('verbose');

// Redirect log output to console, file, buffer, REST API, or whatever location you want
AzureLogger.log = (...args) => {
    console.log(...args); // Redirect log output to console
};

const userToken = '<USER_TOKEN>';
callClient = new CallClient(options);
const tokenCredential = new AzureCommunicationTokenCredential(userToken);
const callAgent = await callClient.createCallAgent(tokenCredential, {displayName: 'optional Azure Communication Services user name'});
const deviceManager = await callClient.getDeviceManager()

Microsoft 인프라에 대한 SDK 연결 관리

Call Agent 인스턴스는 통화를 관리하는 데 도움이 됩니다(통화 참여 또는 시작). 작동하려면 통화 SDK가 Microsoft 인프라에 연결하여 수신 전화에 대한 알림을 가져오고 기타 호출 세부 정보를 조정해야 합니다. 사용자의 Call Agent에는 두 가지 상태가 있을 수 있습니다.

연결됨 - Call Agent connectionStatue 값이 Connected이면 클라이언트 SDK가 연결되어 있고 Microsoft 인프라로부터 알림을 받을 수 있음을 의미합니다.

연결 끊김 - Call AgentDisconnected connectionStatue 값은 SDK가 제대로 연결되지 못하게 하는 문제가 있음을 나타냅니다. Call Agent를 다시 만들어야 합니다.

  • invalidToken: 토큰이 만료되었거나 유효하지 않은 경우 Call Agent 인스턴스가 이 오류와 함께 연결 끊기됩니다.
  • connectionIssue: 클라이언트가 Microsoft 인프라에 연결하는 데 문제가 있는 경우 여러 번 다시 시도한 후 Call AgentconnectionIssue 오류를 노출합니다.

Call Agent 속성의 현재 값을 검사하여 로컬 connectionState가 Microsoft 인프라에 연결되어 있는지 확인할 수 있습니다. 활성 통화 중에 connectionStateChanged 이벤트를 수신 대기하여 Call Agent연결됨에서 연결 끊김 상태로 변경되는지 확인할 수 있습니다.

const connectionState = callAgentInstance.connectionState;
console.log(connectionState); // it may return either of 'Connected' | 'Disconnected'

const connectionStateCallback = (args) => {
    console.log(args); // it will return an object with oldState and newState, each of having a value of either of 'Connected' | 'Disconnected'
    // it will also return reason, either of 'invalidToken' | 'connectionIssue'
}
callAgentInstance.on('connectionStateChanged', connectionStateCallback);

손 올리기 기능을 사용하면 통화 참가자가 발표자 또는 다른 참가자를 방해하지 않고 질문, 의견 또는 우려가 있음을 나타낼 수 있습니다. 이 기능은 Azure Communication Service 및 Teams 통화에서 1:1 통화 및 많은 참가자와의 통화를 비롯한 모든 통화 유형에서 사용할 수 있습니다.

먼저 통화 SDK에서 통화 기능을 가져와야 합니다.

import { Features} from "@azure/communication-calling";

그런 다음 호출 인스턴스에서 기능 API 개체를 가져올 수 있습니다.

const raiseHandFeature = call.feature(Features.RaiseHand );

현재 참가자를 위한 손 올리기 및 내리기

현재 참가자의 손 들기 상태를 변경하려면 raiseHand()lowerHand() 메서드를 사용하면 됩니다.

이러한 메서드는 비동기입니다. 결과를 확인하려면 raisedHandChangedloweredHandChanged 수신기를 사용하십시오.

const raiseHandFeature = call.feature(Features.RaiseHand );
//raise
raiseHandFeature.raiseHand();
//lower
raiseHandFeature.lowerHand();

다른 참가자를 위해 손을 내립니다.

이 기능을 사용하면 이끌이 및 발표자 역할을 가진 사용자가 Teams 통화에서 다른 참가자의 모든 손을 낮출 수 있습니다. Azure Communication 호출에서는 역할을 먼저 추가하지 않는 한 다른 참가자의 상태를 변경할 수 없습니다.

이 기능을 사용하려면 다음 코드를 구현합니다.

const raiseHandFeature = call.feature(Features.RaiseHand );
//lower all hands on the call
raiseHandFeature.lowerAllHands();
//or we can provide array of CommunicationIdentifier to specify list of participants
CommunicationUserIdentifier acsUser = new CommunicationUserIdentifier(<USER_ID>);
MicrosoftTeamsUserIdentifier teamsUser = new MicrosoftTeamsUserIdentifier(<USER_ID>)
CommunicationIdentifier participants[] = new CommunicationIdentifier[]{ acsUser, teamsUser };
raiseHandFeature.lowerHands(participants);

변경된 상태 처리

손 들기 API를 사용하면 raisedHandChangedloweredHandChanged 이벤트를 구독하여 통화 시 참가자의 상태 변경을 처리할 수 있습니다. 호출 인스턴스는 이러한 이벤트를 트리거하고 상태가 변경된 참가자에 대한 정보를 제공합니다.

이러한 이벤트를 구독하려면 다음 코드를 사용합니다.

const raiseHandFeature = call.feature(Features.RaiseHand );

// event : {identifier: CommunicationIdentifier}
const raisedHandChangedHandler = (event) => {
    console.log(`Participant ${event.identifier} raised hand`);
};
const loweredHandChangedHandler = (event) => {
    console.log(`Participant ${event.identifier} lowered hand`);
};
raiseHandFeature.on('raisedHandEvent', raisedHandChangedHandler):
raiseHandFeature.on('loweredHandEvent', loweredHandChangedHandler):

raisedHandChangedloweredHandChanged 이벤트에는 참가자의 통신 식별자를 나타내는 identifier 속성이 있는 개체가 포함됩니다. 앞의 예제에서는 참가자가 손을 들어 올렸다는 메시지를 콘솔에 기록합니다.

이벤트에서 구독을 취소하려면 메서드를 off 사용합니다.

활성 상태의 모든 참가자 목록

현재 통화에서 손을 든 상태인 모든 참가자에 대한 정보를 얻으려면 getRaisedHands를 사용할 수 있습니다. 반환된 배열은 순서 필드를 기준으로 정렬됩니다.

getRaisedHands 사용 방법의 예는 다음과 같습니다.

const raiseHandFeature = call.feature(Features.RaiseHand );
let participantsWithRaisedHands = raiseHandFeature.getRaisedHands();

손 들기 순서

변수에는 participantsWithRaisedHands 각 개체에 다음 속성이 있는 참가자 개체의 배열이 포함됩니다.

  • identifier: 참가자의 통신 식별자입니다.
  • order: 참가자가 손을 들어 올린 순서입니다.

이 정보를 사용하여 '손 들기' 상태의 참가자들의 목록과 '큐'에서의 순서를 표시할 수 있습니다.

SDK 설치

프로젝트 수준의 build.gradle 파일을 찾아 mavenCentral()buildscript 아래의 리포지토리 목록에 allprojects을 추가합니다.

buildscript {
    repositories {
    ...
        mavenCentral()
    ...
    }
}
allprojects {
    repositories {
    ...
        mavenCentral()
    ...
    }
}

그런 다음, 모듈 수준 build.gradle 파일에서 dependencies 섹션에 다음 줄을 추가합니다.

dependencies {
    ...
    implementation 'com.azure.android:azure-communication-calling:1.0.0'
    ...
}

필수 개체 초기화

CallAgent 인스턴스를 만들려면 createCallAgent 인스턴스에서 CallClient 메서드를 호출해야 합니다. 이 호출은 CallAgent 인스턴스 개체를 비동기적으로 반환합니다.

createCallAgent 메서드는 CommunicationUserCredential을 인수로 사용하여 액세스 토큰을 캡슐화합니다.

DeviceManager에 액세스하려면 먼저 callAgent 인스턴스를 만들어야 합니다. 그런 다음 CallClient.getDeviceManager 메서드를 사용하여 DeviceManager를 가져올 수 있습니다.

String userToken = '<user token>';
CallClient callClient = new CallClient();
CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(userToken);
android.content.Context appContext = this.getApplicationContext(); // From within an activity, for instance
CallAgent callAgent = callClient.createCallAgent(appContext, tokenCredential).get();
DeviceManager deviceManager = callClient.getDeviceManager(appContext).get();

호출자의 표시 이름을 설정하려면 다음과 같은 대체 방법을 사용합니다.

String userToken = '<user token>';
CallClient callClient = new CallClient();
CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(userToken);
android.content.Context appContext = this.getApplicationContext(); // From within an activity, for instance
CallAgentOptions callAgentOptions = new CallAgentOptions();
callAgentOptions.setDisplayName("Alice Bob");
DeviceManager deviceManager = callClient.getDeviceManager(appContext).get();
CallAgent callAgent = callClient.createCallAgent(appContext, tokenCredential, callAgentOptions).get();

손 올리기 기능을 사용하면 통화 참가자가 발표자 또는 다른 참가자를 방해하지 않고 질문, 의견 또는 우려가 있음을 나타낼 수 있습니다. 이 기능은 Azure Communication Service 및 Teams 통화에서 1:1 통화 및 많은 참가자와의 통화를 비롯한 모든 통화 유형에서 사용할 수 있습니다.

먼저 통화 SDK에서 통화 기능을 가져와야 합니다.

import com.azure.android.communication.calling.RaiseHandFeature;

그런 다음 호출 인스턴스에서 기능 API 개체를 가져올 수 있습니다.

RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);

현재 참가자를 위한 손 올리기 및 내리기

현재 참가자의 손 들기 상태를 변경하려면 raiseHand()lowerHand() 메서드를 사용하면 됩니다.

이러한 메서드는 비동기입니다. 결과를 확인하려면 RaisedHandReceivedLoweredHandReceived 수신기를 사용하십시오.

RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
//raise
raiseHandFeature.raiseHand();
//lower
raiseHandFeature.lowerHand();

다른 참가자를 위해 손을 내립니다.

이 기능을 사용하면 이끌이 및 발표자 역할을 가진 사용자가 Teams 통화에서 다른 참가자의 모든 손을 낮출 수 있습니다. Azure Communication 호출에서는 역할을 먼저 추가하지 않는 한 다른 참가자의 상태를 변경할 수 없습니다.

이 기능을 사용하려면 다음 코드를 구현합니다.

RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
//lower all hands on the call
raiseHandFeature.lowerAllHands();
//or we can provide array of CommunicationIdentifier to specify list of participants
List<CommunicationIdentifier> identifiers = new ArrayList<>();
CommunicationUserIdentifier acsUser = new CommunicationUserIdentifier(<USER_ID>);
MicrosoftTeamsUserIdentifier teamsUser = new MicrosoftTeamsUserIdentifier(<USER_ID>);
identifiers.add(new CommunicationUserIdentifier("<USER_ID>"));
identifiers.add(new MicrosoftTeamsUserIdentifier("<USER_ID>"));
raiseHandFeature.lowerHands(identifiers);

변경된 상태 처리

손 들기 API를 사용하여 RaisedHandReceivedLoweredHandReceived 이벤트를 구독하여 통화 중 참가자의 상태 변화에 대응할 수 있습니다. 호출 인스턴스는 이러한 이벤트를 트리거하고 상태가 변경된 참가자에 대한 정보를 제공합니다.

이러한 이벤트를 구독하려면 다음 코드를 사용합니다.

RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND)

// event example : {identifier: CommunicationIdentifier, isRaised: true, order:1}
call.feature(Features.RAISE_HAND).addOnRaisedHandReceivedListener(raiseHandEvent -> {
    Log.i(TAG, String.format("Raise Hand: %s : %s", Utilities.toMRI(raiseHandEvent.getIdentifier()), raiseHandEvent.isRaised()));
});

RaisedHandReceivedLoweredHandReceived 이벤트에는 참가자의 통신 식별자를 나타내는 identifier 속성이 있는 개체가 포함됩니다. 앞의 예제에서는 참가자가 손을 들어 올렸다는 메시지를 콘솔에 기록합니다.

이벤트에서 구독을 취소하려면 off 메서드를 사용하면 됩니다.

활성 상태의 모든 참가자 목록

현재 통화에서 손을 든 상태인 모든 참가자에 대한 정보를 얻으려면 getRaisedHands를 사용할 수 있습니다. 반환된 배열은 순서 필드를 기준으로 정렬됩니다.

getRaisedHands 사용 방법의 예는 다음과 같습니다.

RaiseHandFeature raiseHandFeature = call.feature(Features.RAISE_HAND);
List<RaiseHand> participantsWithRaisedHands = raiseHandFeature.getRaisedHands();

손 들기 순서

변수에는 participantsWithRaisedHands 각 개체에 다음 속성이 있는 참가자 개체의 배열이 포함됩니다.

  • identifier: 참가자의 통신 식별자입니다.
  • order: 참가자가 손을 들어 올린 순서입니다.

이 정보를 사용하여 '손 들기' 상태의 참가자들의 목록과 '큐'에서의 순서를 표시할 수 있습니다.

시스템 설정

다음 단계에 따라 시스템을 설정합니다.

Xcode 프로젝트 만들기

Xcode에서 새 iOS 프로젝트를 만들고 단일 보기 앱 템플릿을 선택합니다. 이 문서에서는 SwiftUI 프레임워크를 사용하므로 언어를 Swift로 설정하고 인터페이스SwiftUI설정해야 합니다.

이 문서에서는 테스트를 만들지 않을 것입니다. 테스트 포함 확인란을 선택 취소합니다.

Xcode 내에서 프로젝트를 만드는 창을 보여주는 스크린샷.

CocoaPods를 사용하여 패키지 및 종속성 설치

  1. 다음 예제와 같이 애플리케이션에 대한 Podfile을 만듭니다.

    platform :ios, '13.0'
    use_frameworks!
    target 'AzureCommunicationCallingSample' do
        pod 'AzureCommunicationCalling', '~> 1.0.0'
    end
    
  2. pod install를 실행합니다.

  3. Xcode로 .xcworkspace를 엽니다.

마이크에 대한 액세스 요청

디바이스의 마이크에 액세스하려면 앱의 정보 속성 목록을 NSMicrophoneUsageDescription(으)로 업데이트해야 합니다. 연결된 값을 시스템에서 사용자의 액세스를 요청하는 데 사용하는 대화 상자에 포함된 문자열로 설정합니다.

프로젝트 트리의 Info.plist 항목을 마우스 오른쪽 단추로 클릭한 다음 Open As>Source Code를 선택합니다. 최상위 <dict> 섹션에 다음 줄을 추가한 다음, 파일을 저장합니다.

<key>NSMicrophoneUsageDescription</key>
<string>Need microphone access for VOIP calling.</string>

앱 프레임워크 설정

프로젝트의 ContentView.swift 파일을 엽니다. import 라이브러리를 가져오려면 파일 상단에 AzureCommunicationCalling 선언을 추가합니다. 추가로 AVFoundation을 가져옵니다. 코드의 오디오 권한 요청에 필요합니다.

import AzureCommunicationCalling
import AVFoundation

CallAgent 초기화

CallAgent에서 CallClient 인스턴스를 만들려면 초기화된 후 비동기적으로 callClient.createCallAgent 개체를 반환하는 CallAgent 메서드를 사용해야 합니다.

호출 클라이언트를 만들려면 CommunicationTokenCredential 개체를 전달합니다.

import AzureCommunication

let tokenString = "token_string"
var userCredential: CommunicationTokenCredential?
do {
    let options = CommunicationTokenRefreshOptions(initialToken: token, refreshProactively: true, tokenRefresher: self.fetchTokenSync)
    userCredential = try CommunicationTokenCredential(withOptions: options)
} catch {
    updates("Couldn't created Credential object", false)
    initializationDispatchGroup!.leave()
    return
}

// tokenProvider needs to be implemented by Contoso, which fetches a new token
public func fetchTokenSync(then onCompletion: TokenRefreshOnCompletion) {
    let newToken = self.tokenProvider!.fetchNewToken()
    onCompletion(newToken, nil)
}

만든 CommunicationTokenCredential 개체를 CallClient에 전달하고 표시 이름을 설정합니다.

self.callClient = CallClient()
let callAgentOptions = CallAgentOptions()
options.displayName = " iOS Azure Communication Services User"

self.callClient!.createCallAgent(userCredential: userCredential!,
    options: callAgentOptions) { (callAgent, error) in
        if error == nil {
            print("Create agent succeeded")
            self.callAgent = callAgent
        } else {
            print("Create agent failed")
        }
})

손 올리기 기능을 사용하면 통화 참가자가 발표자 또는 다른 참가자를 방해하지 않고 질문, 의견 또는 우려가 있음을 나타낼 수 있습니다. 이 기능은 Azure Communication Service 및 Teams 통화에서 1:1 통화 및 많은 참가자와의 통화를 비롯한 모든 통화 유형에서 사용할 수 있습니다.

먼저 통화 SDK에서 통화 기능을 가져와야 합니다.

import AzureCommunicationCalling

그런 다음 호출 인스턴스에서 기능 API 개체를 가져올 수 있습니다.

@State var raisehandFeature: RaiseHandCallFeature?

raiseHandFeature = self.call!.feature(Features.raiseHand)

현재 참가자를 위한 손 올리기 및 내리기

현재 참가자의 손 들기 상태를 변경하려면 raiseHand()lowerHand() 메서드를 사용하면 됩니다.

//publish raise hand state for local participant
raisehandFeature.raiseHand(completionHandler: { (error) in
    if let error = error {
        print ("Feature failed raise a hand %@", error as Error)
    }
})

//remove raise hand state for local participant
raisehandFeature.lowerHand(completionHandler: { (error) in
    if let error = error {
        print ("Feature failed lower hand %@", error as Error)
    }
})

다른 참가자를 위해 손을 내립니다.

이 기능을 사용하면 이끌이 및 발표자 역할을 가진 사용자가 Teams 통화에서 다른 참가자의 모든 손을 낮출 수 있습니다. Azure Communication 호출에서는 역할을 먼저 추가하지 않는 한 다른 참가자의 상태를 변경할 수 없습니다.

이 기능을 사용하려면 다음 코드를 구현합니다.


// remove raise hand states for all participants on the call
raisehandFeature.lowerAllHands(completionHandler: { (error) in
    if let error = error {
        print ("Feature failed lower all hands %@", error as Error)
    }
})

// remove raise hand states for all remote participants on the call
let identifiers = (call?.remoteParticipants.map {$0.identifier})!;
raisehandFeature.lowerHands(participants: identifiers, completionHandler: { (error) in
    if let error = error {
        print ("Feature failed lower hands %@", error as Error)
    }
})

// remove raise hand state of specific user
var identifiers : [CommunicationIdentifier] = []
identifiers.append(CommunicationUserIdentifier("<USER_ID>"))
raisehandFeature.lowerHands(participants: identifiers, completionHandler: { (error) in
    if let error = error {
        print ("Feature failed lower hands %@", error as Error)
    }
})

변경된 상태 처리

손 들기 API를 사용하면 RaisedHandReceivedLoweredHandReceived 이벤트를 구독하여 통화 시 참가자의 상태 변경을 처리할 수 있습니다. 호출 인스턴스는 이러한 이벤트를 트리거하고 상태가 변경된 참가자에 대한 정보를 제공합니다.

이러한 이벤트를 구독하려면 다음 코드를 사용합니다.

self.callObserver = CallObserver(view:self)

raisehandFeature = self.call!.feature(Features.raiseHand)
raisehandFeature!.delegate = self.callObserver

public class CallObserver : NSObject, RaiseHandCallFeatureDelegate
{
    // event example : {identifier: CommunicationIdentifier}
    public func raiseHandCallFeature(_ raiseHandCallFeature: RaiseHandCallFeature, didReceiveRaisedHand args: RaisedHandChangedEventArgs) {
        os_log("Raise hand feature updated: %s is raised hand", log:log, Utilities.toMri(args.identifier))
        raiseHandCallFeature.raisedHands.forEach { raiseHand in
            os_log("Raise hand active: %s", log:log, Utilities.toMri(raiseHand.identifier))
        }
    }
    public func raiseHandCallFeature(_ raiseHandCallFeature: RaiseHandCallFeature, didReceiveLoweredHand args: LoweredHandChangedEventArgs) {
        os_log("Raise hand feature updated: %s is lowered hand", log:log, Utilities.toMri(args.identifier))
        raiseHandCallFeature.raisedHands.forEach { raiseHand in
            os_log("Raise hand active: %s", log:log, Utilities.toMri(raiseHand.identifier))
        }
    }
}    

RaisedHandReceivedLoweredHandReceived 이벤트에는 참가자의 통신 식별자를 나타내는 identifier 속성이 있는 개체가 포함됩니다. 앞의 예제에서는 참가자가 손을 들어 올렸다는 메시지를 콘솔에 기록합니다.

이벤트에서 구독을 취소하려면 메서드를 off 사용합니다.

활성 상태의 모든 참가자 목록

현재 통화에서 손을 든 상태인 모든 참가자에 대한 정보를 얻으려면 getRaisedHands를 사용할 수 있습니다. 반환된 배열은 순서 필드를 기준으로 정렬됩니다.

raisedHands 사용 방법의 예는 다음과 같습니다.

raisehandFeature = self.call!.feature(Features.raiseHand)
raisehandFeature.raisedHands.forEach { raiseHand in
    os_log("Raise hand active: %s", log:log, Utilities.toMri(raiseHand.identifier))
}

손 들기 순서

변수에는 raisedHands 각 개체에 다음 속성이 있는 참가자 개체의 배열이 포함됩니다.

  • identifier: 참가자의 통신 식별자입니다.
  • order: 참가자가 손을 들어 올린 순서입니다.

이 정보를 사용하여 '손 들기' 상태의 참가자들의 목록과 '큐'에서의 순서를 표시할 수 있습니다.

시스템 설정

다음 단계에 따라 시스템을 설정합니다.

Visual Studio 프로젝트 만들기

유니버설 Windows 플랫폼 앱의 경우 Visual Studio 2022에서 새 빈 앱(유니버설 Windows) 프로젝트를 만듭니다. 프로젝트 이름을 입력한 다음 10.0.17763.0보다 버전이 높은 Windows SDK를 아무거나 선택합니다.

WinUI 3 앱의 경우, 빈 앱, 패키지형(데스크톱의 WinUI 3) 템플릿을 사용하여 새 프로젝트를 생성하여 단일 페이지의 WinUI 3 앱을 설정합니다. Windows 앱 SDK 버전 1.3 이상이 필요합니다.

NuGet 패키지 관리자를 사용하여 패키지와 종속성 설치

Calling SDK API와 라이브러리는 NuGet 패키지를 통해 공개적으로 사용할 수 있습니다.

호출 SDK NuGet 패키지를 찾고, 다운로드하고, 설치하려면 다음을 수행합니다.

  1. 도구>NuGet 패키지 관리자>솔루션용 NuGet 패키지 관리를 선택해 NuGet 패키지 관리자를 엽니다.
  2. 찾아보기를 선택한 다음, 검색 상자에 Azure.Communication.Calling.WindowsClient를 입력합니다.
  3. 시험판 포함 확인란이 선택되어 있는지 확인하십시오.
  4. Azure.Communication.Calling.WindowsClient 패키지를 선택한 다음, Azure.Communication.Calling.WindowsClient1.4.0-beta.1 이상 버전을 선택합니다.
  5. 오른쪽 창에서 Azure Communication Services 프로젝트에 해당하는 확인란을 선택합니다.
  6. 설치를 선택합니다.

손 올리기 기능을 사용하면 통화 참가자가 발표자 또는 다른 참가자를 방해하지 않고 질문, 의견 또는 우려가 있음을 나타낼 수 있습니다. 이 기능은 Azure Communication Service 및 Teams 통화에서 1:1 통화 및 많은 참가자와의 통화를 비롯한 모든 통화 유형에서 사용할 수 있습니다.

먼저 통화 SDK에서 통화 기능을 가져와야 합니다.

using Azure.Communication.Calling.WindowsClient;

그런 다음 호출 인스턴스에서 기능 API 개체를 가져올 수 있습니다.

private RaiseHandCallFeature raiseHandCallFeature;

raiseHandCallFeature = (RaiseHandCallFeature)call.GetCallFeatureExtension(CallFeatureType.RaiseHand);

현재 참가자를 위한 손 올리기 및 내리기

현재 참가자의 손 들기 상태를 변경하려면 raiseHand()lowerHand() 메서드를 사용하면 됩니다.

이러한 메서드는 비동기입니다. 결과를 확인하려면 RaisedHandReceivedLoweredhandReceived 수신기를 사용하십시오.

//publish raise hand state for local participant
raiseHandCallFeature.RaiseHandAsync();

//remove raise hand state for local participant
raiseHandCallFeature.LowerHandAsync();

다른 참가자를 위해 손을 내립니다.

다른 참가자에게 손을 내리라는 기능을 사용하면 주최자 및 발표자 역할을 가진 사용자가 Teams 통화에서 다른 참가자에게 손을 내릴 수 있습니다. Azure Communication 호출에서는 역할을 먼저 추가하지 않는 한 다른 참가자의 상태를 변경할 수 없습니다.

이 기능을 사용하려면 다음 코드를 구현합니다.


// remove raise hand states for all participants on the call
raiseHandCallFeature.LowerAllHandsAsync();

// remove raise hand states for all remote participants on the call
var participants = call.RemoteParticipants;
var identifiers = participants.Select(p => p.Identifier).ToList().AsReadOnly();
raiseHandCallFeature.LowerHandsAsync(identifiers);

// remove raise hand state of specific user
var identifiers = new List<CallIdentifier>();
identifiers.Add(new UserCallIdentifier("USER_ID"));
raiseHandCallFeature.LowerHandsAsync(identifiers);

변경된 상태 처리

손 들기 API를 사용하면 RaisedHandReceivedLoweredHandReceived 이벤트를 구독하여 통화 시 참가자의 상태 변경을 처리할 수 있습니다. 호출 인스턴스는 이러한 이벤트를 트리거하고 상태가 변경된 참가자에 대한 정보를 제공합니다.

이러한 이벤트를 구독하려면 다음 코드를 사용합니다.

raiseHandCallFeature = (RaiseHandCallFeature)call.GetCallFeatureExtension(CallFeatureType.RaiseHand);
raiseHandCallFeature.RaisedHandReceived += OnRaisedHandChange;
raiseHandCallFeature.LoweredHandReceived += OnLoweredHandChange;

private async void OnRaisedHandChange(object sender, RaisedHandChangedEventArgs args)
{
    Trace.WriteLine("RaiseHandEvent: participant " + args.Identifier + " is raised hand");
}

private async void OnLoweredHandChange(object sender, RaisedHandChangedEventArgs args)
{
    Trace.WriteLine("RaiseHandEvent: participant " + args.Identifier + " is lowered hand");
}

RaisedHandReceivedLoweredHandReceived 이벤트에는 참가자의 통신 식별자를 나타내는 identifier 속성이 있는 개체가 포함됩니다. 앞의 예제에서는 참가자가 손을 들어 올렸다는 메시지를 콘솔에 기록합니다.

이벤트에서 구독을 취소하려면 off 메서드를 사용하면 됩니다.

활성 상태의 모든 참가자 목록

현재 통화에서 손을 든 상태인 모든 참가자에 대한 정보를 얻으려면 getRaisedHands를 사용할 수 있습니다. 반환된 배열은 순서 필드를 기준으로 정렬됩니다.

RaisedHands 사용 방법의 예는 다음과 같습니다.

raiseHandCallFeature = (RaiseHandCallFeature)call.GetCallFeatureExtension(CallFeatureType.RaiseHand);
foreach (RaiseHand rh in raiseHandCallFeature.RaisedHands.ToList())
{
    Trace.WriteLine("Participant " + rh.Identifier.RawId + " has raised hand ");
}

손 들기 순서

변수에는 RaisedHands 각 개체에 다음 속성이 있는 참가자 개체의 배열이 포함됩니다.

  • identifier: 참가자의 통신 식별자입니다.
  • order: 참가자가 손을 들어 올린 순서입니다.

이 정보를 사용하여 '손 들기' 상태의 참가자들의 목록과 '큐'에서의 순서를 표시할 수 있습니다.

다음 단계

Teams 통화 및 모임에서 손 들기 기능을 사용하는 방법에 대한 자세한 내용은 Microsoft Teams 설명서를 참조하세요.