-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathrtc_peerconnection.dart
132 lines (90 loc) · 3.76 KB
/
rtc_peerconnection.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import 'dart:async';
import 'enums.dart';
import 'media_stream.dart';
import 'media_stream_track.dart';
import 'rtc_data_channel.dart';
import 'rtc_dtmf_sender.dart';
import 'rtc_ice_candidate.dart';
import 'rtc_rtp_receiver.dart';
import 'rtc_rtp_sender.dart';
import 'rtc_rtp_transceiver.dart';
import 'rtc_session_description.dart';
import 'rtc_stats_report.dart';
import 'rtc_track_event.dart';
abstract class RTCPeerConnection {
RTCPeerConnection();
// public: delegate
Function(RTCSignalingState state)? onSignalingState;
Function(RTCPeerConnectionState state)? onConnectionState;
Function(RTCIceGatheringState state)? onIceGatheringState;
Function(RTCIceConnectionState state)? onIceConnectionState;
Function(RTCIceCandidate candidate)? onIceCandidate;
@Deprecated('Deprecated API')
Function(MediaStream stream)? onAddStream;
@Deprecated('Deprecated API')
Function(MediaStream stream)? onRemoveStream;
@Deprecated('Deprecated API')
Function(MediaStream stream, MediaStreamTrack track)? onAddTrack;
@Deprecated('Deprecated API')
Function(MediaStream stream, MediaStreamTrack track)? onRemoveTrack;
Function(RTCDataChannel channel)? onDataChannel;
Function()? onRenegotiationNeeded;
/// Unified-Plan
Function(RTCTrackEvent event)? onTrack;
RTCSignalingState? get signalingState;
Future<RTCSignalingState?> getSignalingState() async {
return signalingState;
}
RTCIceGatheringState? get iceGatheringState;
Future<RTCIceGatheringState?> getIceGatheringState() async {
return iceGatheringState;
}
RTCIceConnectionState? get iceConnectionState;
Future<RTCIceConnectionState?> getIceConnectionState() async {
return iceConnectionState;
}
RTCPeerConnectionState? get connectionState;
Future<RTCPeerConnectionState?> getConnectionState() async {
return connectionState;
}
Future<void> dispose();
Map<String, dynamic> get getConfiguration;
Future<void> setConfiguration(Map<String, dynamic> configuration);
Future<RTCSessionDescription> createOffer([Map<String, dynamic> constraints]);
Future<RTCSessionDescription> createAnswer(
[Map<String, dynamic> constraints]);
@Deprecated('Deprecated API')
Future<void> addStream(MediaStream stream);
@Deprecated('Deprecated API')
Future<void> removeStream(MediaStream stream);
Future<RTCSessionDescription?> getLocalDescription();
Future<void> setLocalDescription(RTCSessionDescription description);
Future<RTCSessionDescription?> getRemoteDescription();
Future<void> setRemoteDescription(RTCSessionDescription description);
Future<void> addCandidate(RTCIceCandidate candidate);
Future<List<StatsReport>> getStats([MediaStreamTrack? track]);
@Deprecated('Deprecated API')
List<MediaStream?> getLocalStreams();
@Deprecated('Deprecated API')
List<MediaStream?> getRemoteStreams();
Future<RTCDataChannel> createDataChannel(
String label, RTCDataChannelInit dataChannelDict);
Future<void> restartIce();
Future<void> close();
@Deprecated('Deprecated API, use RTCRtpSender.dtmf instead')
RTCDTMFSender createDtmfSender(MediaStreamTrack track);
/// Unified-Plan.
Future<List<RTCRtpSender>> getSenders();
Future<List<RTCRtpSender>> get senders => getSenders();
Future<List<RTCRtpReceiver>> getReceivers();
Future<List<RTCRtpReceiver>> get receivers => getReceivers();
Future<List<RTCRtpTransceiver>> getTransceivers();
Future<List<RTCRtpTransceiver>> get transceivers => getTransceivers();
Future<RTCRtpSender> addTrack(MediaStreamTrack track, [MediaStream stream]);
Future<bool> removeTrack(RTCRtpSender sender);
/// 'audio|video', { 'direction': 'recvonly|sendonly|sendrecv' }
Future<RTCRtpTransceiver> addTransceiver(
{MediaStreamTrack track,
RTCRtpMediaType kind,
RTCRtpTransceiverInit init});
}