startSubtitle method

Future<int?> startSubtitle(
  1. SubtitleConfig subtitleConfig
)

@hidden currently not available @detail api @author qiaoxingwang @brief Recognizes or translates the speech of all speakers in the room and converts the results into captions.
When calling this method, you can choose the subtitle mode in SubtitleMode{@link #SubtitleMode}. If you choose the recognition mode, you will receive the onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} callback which contains the transcribed text.
If you choose the translation mode, you will receive two onSubtitleMessageReceived{@link #IRTCRoomEventHandler#onSubtitleMessageReceived} callbacks simultaneously, one contains the transcribed text and the other contains the translated text.
After calling this method, you will receive the onSubtitleStateChanged{@link #IRTCRoomEventHandler#onSubtitleStateChanged} to inform you of whether subtitles are on. @param subtitleConfig Subtitle configurations. Refer to SubtitleConfig{@link #SubtitleConfig} for details. @return - 0: Success. - < 0: Failure. See ReturnStatus{@link #ReturnStatus} for more details. @note - Call this method after joining the room. - You can set your source language to Chinese by calling joinRoom and importing a json formatted string "source_language": "zh" through the parameter of extraInfo, to English by importing "source_language": "en" , and to Japanese by importing "source_language": "ja" . If you don't set the source language, SDK will set the language of your system as the source language. If the language of your system is not Chinese, English or Japanese, SDK will set Chinese as the source language.

Implementation

Future<int?> startSubtitle(SubtitleConfig subtitleConfig) async {
  $a() => ($instance as $p_a.RTCRoom)
      .startSubtitle(unpackObject<$p_a.SubtitleConfig>(subtitleConfig));
  $i() => ($instance as $p_i.ByteRTCRoom).startSubtitle(
      unpackObject<$p_i.ByteRTCSubtitleConfig>(subtitleConfig));

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}