connect method

  1. @override
void connect({
  1. required String url,
  2. required PublisherProtocol mode,
})
override

set the url and mode

Implementation

@override
void connect({required String url, required PublisherProtocol mode}) {
  /** Check if url is empty */
  if (url == '') throw Exception('url is empty');
  /**  Check if url has right scheme */
  if (mode == PublisherProtocol.RTMP && !url.contains('rtmp://')) {
    throw Exception('Invalid url. Please use rtmp://');
  } else if ((mode == PublisherProtocol.RTSP_TCP ||
          mode == PublisherProtocol.RTSP_UDP) &&
      !url.contains('rtsp://')) {
    throw Exception('Invalid url. Please use rtsp://');
  }
  baseUrl = url;
  this.mode = mode;
}