tencent cloud

Game Multimedia Engine

Release Notes
Product Introduction
Overview
Strengths
Features
Scenarios
Compliance
User Tutorial
Billing
Free Plan
Purchase Guide
SDK Download Guide
Product Feature Demo
Basic Feature Demo
Scenario-Specific Demo
Console Guide
Usage Querying
Activating Services
Getting Started
Quick Integration of SDK
Quick Integration of Sample Project
Basic Feature Development Guide
Authentication Key
Voice Chat Role Configuration
Sound Quality
Advanced Feature Development Guide
Server-Side Recording
Range Voice
3D Sound Effect
Sound Effect and Accompaniment
Network Audio Stream Forwarding Routing
Custom Message Channel
How to deal with the restrictions of corporate firewall
Language Parameter Reference List
Integrating GME Chat Room Management
Client API
SDK for Unity
SDK for Unreal Engine
Cocos2D SDK
SDK for Windows
SDK for iOS
SDK for Android
SDK for macOS
H5 SDK
Electron SDK
SDK for Flutter
SDK Version Upgrade Guide
Error Codes
Toolchain
Server APIs
History
Introduction
API Category
Usage APIs
Recording APIs
Making API Requests
Voice Chat APIs
Application APIs
Data Types
Error Codes
FAQ
Product Features
Troubleshooting Guide
Billing
Sample Project Usage
General
Authentication
Voice Chat Room Entry Failure
Sound and Audio
Network
Speech-to-text Conversion
Program Export
Service Agreement
Service Level Agreement
Contact Us
Glossary
GME Policy
Data Privacy and Security Agreement
Privacy Policy

Voice Chat Role Configuration

PDF
Focus Mode
Font Size
Last updated: 2023-05-19 15:13:57
Note: Currently, GME 3.x does not support voice chat role configuration.
This document describes how to access and debug GME APIs for the commanding voice mode.

Use Cases

In commanding game scenarios, GME provides the host and listener roles. If a user sets the role to host before room entry, the user can enable the mic to speak and enable the speaker to hear others talking in the room after room entry. If the user enters the room as a listener, the user cannot speak in the room after room entry even the mic is enabled.

Prerequisites

You have created a GME application and obtained the AppID and Key of the SDK as instructed in Activating Services.
You have activated the voice chat service of GME as instructed in Activating Services.
You have integrated the GME SDK as instructed in Quick Integration of Native SDK.

Integration directions

Below is the process of connecting to the commanding voice mode:
1. Use GME
2. Set the role
6. Exit the room

Step 1. Use GME

For more information on how to call and integrate the GME SDK, see Quick Integration of Native SDK, Quick Integration of SDK for Unity, and Quick Integration of SDK for Unreal Engine.

Step 2. Setting the role

Before calling the EnterRoom API, you need to call the SetAudioRole API to set the role of the current user in voice chat.

Function prototype

public abstract int SetAudioRole(ITMG_AUDIO_MEMBER_ROLE role);
Parameter
Type
Description
role
ITMG_AUDIO_MEMBER_ROLE
ITMG_AUDIO_MEMBER_ROLE_ANCHOR: Host, who can enable the mic and speaker in the room.
ITMG_AUDIO_MEMBER_ROLE_AUDIENCE: Listener, who can enable only the speaker in the room to listen to others.

Sample code

ITMGContext.GetInstance().SetAudioRole(ITMG_AUDIO_MEMBER_ROLE.ITMG_AUDIO_MEMBER_ROLE_AUDIENCE);

Step 3. Use the real-time voice service

Call the EnterRoom API to enter a voice chat room.

Step 4. Enable the mic

If your role is host, you can normally call the EnableMic and EnableSpeaker APIs to enable the mic and speaker respectively.
If your role is listener, you can normally use the EnableSpeaker API to enable the speaker, but the AV_ERR_INVALID_ARGUMENT error code (1004) will be returned to remind that you are in listener mode and the mic cannot be enabled when you call the EnableMic API.

Step 5. Change the role

In the room, you can call SetAudioRole to change the role.
If the role is not set, the new role will be used.
If the role is set, the new role will be used.
If no role is set or the role is host and you are speaking with the mic enabled, but the mic is still enabled after the role is changed to listener, we recommend that you call the EnableMic API at the business layer to change the mic status and the mic UI status.

Step 6. Exit the room

After the ExitRoom API is called to exit the voice chat room, the role status becomes invalid, and the role needs to be set again.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback