create method

Future<void> create(
  1. VideoCreateInputOptions? options
)

Implementation

Future<void> create(VideoCreateInputOptions? options) async {
  bool audio = options?.audio ?? true;
  bool video = options?.video ?? true;
  MediaStream? stream = options?.stream;

  try {
    final MediaStream localStream = stream ??
        await navigator.mediaDevices.getUserMedia({
          // for frontend
          'video': video,
          'audio': audio,
        });
    setData((oldData) {
      final String address = oldData.local?.address ?? getCachedUser()!.did!;
      final newLocal = Local(
        stream: localStream,
        audio: audio,
        video: video,
        address: address,
      );
      return VideoCallData(
        meta: oldData.meta,
        local: newLocal,
        incoming: oldData.incoming,
      );
    });
  } catch (err) {
    print('error in create: $err');
  }
}