stopLivestream method

Future<void> stopLivestream()

Implementation

Future<void> stopLivestream() async {
  Span? stopLivestreamSpan;
  try {
    if (videoSDKTelemetery != null) {
      stopLivestreamSpan = videoSDKTelemetery!.trace(
        spanName: 'stopLivestream() Start',
      );
    }
  } catch (error) {}

  try {
    await _webSocket!.socket.request('stopLivestream', {});

    if (stopLivestreamSpan != null) {
      videoSDKTelemetery!.completeSpan(
          span: stopLivestreamSpan,
          status: StatusCode.ok,
          message: 'stopLivestream() End');
    }
  } catch (error) {
    //
    VideoSDKLog.createLog(
        message: "Error in stopLivestream() \n ${error.toString()}",
        logLevel: "ERROR");

    //
    log("Error while stopping livestreaming $error");

    if (stopLivestreamSpan != null) {
      videoSDKTelemetery!.completeSpan(
          span: stopLivestreamSpan,
          status: StatusCode.error,
          message: 'stopLivestream() Failed \n ${error.toString()}');
    }
  }
}