Example: Translation room
This page shows how to use subgroups to provide translation services on a group call (conference).
Requirements
The requirements for this example are as follows:
- Translators join the group call for the translation service.
- All participants speak together.
- The volume of the original speaker's audio must be decreased when a translator is translating.
Application design
The application design for this example is as follows:
-
Create subgroups for languages to translate, Jp for Japanese and En for English.
-
Translators subscribe to a corresponding language subgroup for translation.
- T-JP: Translates English to Japanese. Subscribes to Jp.
- T-EN: Translates Japanese to English. Subscribes to En.
-
Single-language users choose a language subgroup to listen to by their language.
- J1, J2: Japanese users. Subscribe to Jp.
- E1, E2: English users. Subscribe to En.
-
Set "peerUpdate" to NONE.
- The subgroup language to be translated is already defined.
-
Set "videoUpdate" to FALSE.
- Subgroup video flow is not used.
-
Audios must be sent and received as shown in the following table and figure.
Participant type Send audios to Receive audios from Translators Subscribed subgroup Main room Single-language users Main room Subscribed subgroup and main room
Audio flow
The flow and sequence for audio that requires translation are as follows.
- A Japanese user speaks in Japanese.
- All participants (including translators) listen to it.
- The translator T-EN translates it in English and the translated English audio is routed to the En subgroup.
- Only English users (E1 and E2) listen to the audio.
PlanetKit API flow
The following figure shows a proper subgroup API flow and how to subscribe to each subgroup in order to implement a translation service, with the following prerequisites:
- All participants have joined the translation room.
- English speakers (E1, E2) and English translator (T-EN) are ready to use the service.
The following describes how the participant J2 receives a translation service:
- J2 subscribes to the Jp subgroup because J2 uses Japanese.
- There is no one sending audio to the Jp subgroup yet, so there is no audio routed to J2.
- J2 tags one's own audio stream sent to the main room by calling
setTagMyAudioOfMainRoom()
with"Jp"
.- This means that the audio stream belongs to the Jp subgroup although it is not changed to be sent to the Jp subgroup.
- T-JP changes one's own audio stream to be sent to the Jp subgroup by calling
changeMyAudioDestination()
with"Jp"
.- T-JP sends audio to the Jp subgroup.
- T-JP's audio is routed to the Jp subgroup members including J2.
- J2 calls
setPeersAudioAutoVolumeControl()
with"Jp"
to listen to Japanese audio when T-JP translates.- E1 and E2's audios are sent to the main room.
- T-JP listens to E1 and E2's audios although they subscribed to a different subgroup.
- J2 also listens to E1 and E2's audio.
- T-JP translates E1 and E2's audio into Japanese.
- T-JP's audio is routed to J2.
- J2 listens to audio translated by T-JP, along with E1 and E2's audio with decreased volume.