Line data Source code
1 : import 'dart:async';
2 :
3 : import 'package:matrix/matrix.dart';
4 : import 'package:matrix/src/voip/models/call_membership.dart';
5 :
6 : abstract class CallBackend {
7 : String type;
8 :
9 2 : CallBackend({
10 : required this.type,
11 : });
12 :
13 2 : factory CallBackend.fromJson(Map<String, Object?> json) {
14 2 : final String type = json['type'] as String;
15 2 : if (type == 'mesh') {
16 2 : return MeshBackend(
17 : type: type,
18 : );
19 0 : } else if (type == 'livekit') {
20 0 : return LiveKitBackend(
21 0 : livekitAlias: json['livekit_alias'] as String,
22 0 : livekitServiceUrl: json['livekit_service_url'] as String,
23 : type: type,
24 : );
25 : } else {
26 0 : throw ArgumentError('Invalid type: $type');
27 : }
28 : }
29 :
30 : Map<String, Object?> toJson();
31 :
32 : bool get e2eeEnabled;
33 :
34 : CallParticipant? get activeSpeaker;
35 :
36 : WrappedMediaStream? get localUserMediaStream;
37 :
38 : WrappedMediaStream? get localScreenshareStream;
39 :
40 : List<WrappedMediaStream> get userMediaStreams;
41 :
42 : List<WrappedMediaStream> get screenShareStreams;
43 :
44 : bool get isLocalVideoMuted;
45 :
46 : bool get isMicrophoneMuted;
47 :
48 : Future<WrappedMediaStream?> initLocalStream(
49 : GroupCallSession groupCall, {
50 : WrappedMediaStream? stream,
51 : });
52 :
53 : Future<void> updateMediaDeviceForCalls();
54 :
55 : Future<void> setupP2PCallsWithExistingMembers(GroupCallSession groupCall);
56 :
57 : Future<void> setupP2PCallWithNewMember(
58 : GroupCallSession groupCall,
59 : CallParticipant rp,
60 : CallMembership mem,
61 : );
62 :
63 : Future<void> dispose(GroupCallSession groupCall);
64 :
65 : Future<void> onNewParticipant(
66 : GroupCallSession groupCall,
67 : List<CallParticipant> anyJoined,
68 : );
69 :
70 : Future<void> onLeftParticipant(
71 : GroupCallSession groupCall,
72 : List<CallParticipant> anyLeft,
73 : );
74 :
75 : Future<void> requestEncrytionKey(
76 : GroupCallSession groupCall,
77 : List<CallParticipant> remoteParticipants,
78 : );
79 :
80 : Future<void> onCallEncryption(
81 : GroupCallSession groupCall,
82 : String userId,
83 : String deviceId,
84 : Map<String, dynamic> content,
85 : );
86 :
87 : Future<void> onCallEncryptionKeyRequest(
88 : GroupCallSession groupCall,
89 : String userId,
90 : String deviceId,
91 : Map<String, dynamic> content,
92 : );
93 :
94 : Future<void> setDeviceMuted(
95 : GroupCallSession groupCall,
96 : bool muted,
97 : MediaInputKind kind,
98 : );
99 :
100 : Future<void> setScreensharingEnabled(
101 : GroupCallSession groupCall,
102 : bool enabled,
103 : String desktopCapturerSourceId,
104 : );
105 :
106 : List<Map<String, String>>? getCurrentFeeds();
107 :
108 : @override
109 : bool operator ==(Object other);
110 : @override
111 : int get hashCode;
112 : }
|