Updated on 2024-01-19 GMT+08:00

Pushing Live Captions

Description

Anyone in a meeting can use this API to enable live captions of the meeting for the first time. When live captions are enabled, everyone in the meeting can subscribe to the message frame for pushing live captions.

Live captions stop only when the meeting ends.

Table 1 Request text

Parameter

Type

Description

action

String

Message type. The value must be ConfControl.

sequence

String

Message sequence, which uniquely identifies a message frame.

type

String

Meeting control type. The value must be REALTIMESUBTITLE.

data

String

For details about the request JSON character string, see Table 2.

Table 2 Data structure of data

Parameter

Mandatory

Type

Description

conferenceID

Yes

String

Meeting ID.

confToken

Yes

String

Meeting control token.

isSubtitle

No

Integer

0: Disable live captions.

1: Enable live captions.

subtitleType

No

Integer

Caption display mode.

0: captions of two loudest speakers.

sisProperty

No

String

Model used.

chinese_16k_general: Mandarin Chinese (default).

chinese_16k_trial: trial mode.

id

No

Array of strings

This parameter is mandatory when captions of specific speakers are displayed. List of speaker IDs (pid in Pushing Online Participant Information). Up to four speakers are supported.

Table 3 Message frame for pushing live captions

Parameter

Type

Description

action

String

"RealTimeSubtitleNotify"

version

String

For a full message, the value is the timestamp (in milliseconds) when the message is generated.

For an incremental message, the value is a sequence number in ascending order.

createTime

String

Timestamp when a message is generated, in milliseconds.

msgID

String

Unique message ID.

msgMode

Integer

Message mode.

0: full message.

1: incremental message.

confID

String

ID of the subscribed-to meeting.

data

SubtitleData object

Live caption information. The content is negotiated between the live caption service and terminal. For details, see the SubtitleData data structure.

Table 4 SubtitleData data structure

Parameter

Type

Description

msgs

Msgs<0..*>

Caption content. For details, see Table 5.

isFinal

Boolean

Whether to break a sentence.

timestamp

Integer

Timestamp.

beginTime

Integer

Caption start time.

endTime

Integer

Caption end time.

participantID

String

Participant ID.

Table 5 Msgs data structure

Parameter

Type

Description

subtitleLang

String

Language.

Mandarin

English

translateText

String

Caption text.

id

String

Caption message ID.

Example of Enabling Live Captions

var confToken = Obtaining a Meeting Control Token;
var openRealTimeSubtitle = JSON.stringify({
    sequence: "000000000000000002611382273463",
    action: "ConfControl",
    type: "REALTIMESUBTITLE",
    data: JSON.stringify({
        conferenceID: "986812232",
        confToken: confToken,
        isSubtitle: "1",
        subtitleType: "0"
    }),
 });

Example of Pushing Live Captions

{
	"action": "RealTimeSubtitleNotify",
	"version": "1614936396556",
	"createTime": "1614936396556",
	"msgID": "e20544e37d9411ebbae3fd5b302953d3",
	"msgMode": 0,
	"confID": "981112355",
	"data": {
		"msgs ": [{
			"subtitleLang": "Mandarin",
			"translateText": "Live captions.",
			"id ": "c0196fb9-c9c3-47ba-a685-05223552de2f"
		}],
		"isFinal ": false,
		"timestamp ": 1614936396553,
		"beginTime": 1528680,
		"endTime": 1530900,
		"participantID": "984r8z9f4p6p6pry97yfan6z76681f09"
	}
}