feat: 增加密码连接
This commit is contained in:
@@ -21,6 +21,8 @@ class WebRtcController {
|
||||
final SignalingClient signaling;
|
||||
final String deviceId;
|
||||
final String targetDeviceId;
|
||||
final String? authType;
|
||||
final String? authValue;
|
||||
|
||||
RTCPeerConnection? _pc;
|
||||
RTCDataChannel? _dataChannel;
|
||||
@@ -42,6 +44,8 @@ class WebRtcController {
|
||||
required this.signaling,
|
||||
required this.deviceId,
|
||||
required this.targetDeviceId,
|
||||
this.authType,
|
||||
this.authValue,
|
||||
});
|
||||
|
||||
/// 初始化渲染器、PeerConnection,并创建 Offer。
|
||||
@@ -89,7 +93,7 @@ class WebRtcController {
|
||||
};
|
||||
final offer = await _pc!.createOffer(constraints);
|
||||
await _pc!.setLocalDescription(offer);
|
||||
_sendOffer(offer.sdp!);
|
||||
_sendOffer(offer.sdp!, authType: authType, authValue: authValue);
|
||||
}
|
||||
|
||||
void _onTrack(RTCTrackEvent event) {
|
||||
@@ -157,7 +161,7 @@ class WebRtcController {
|
||||
}
|
||||
}
|
||||
|
||||
void _sendOffer(String sdp) {
|
||||
void _sendOffer(String sdp, {String? authType, String? authValue}) {
|
||||
final payload = {'sdp': sdp};
|
||||
final msg = SignalMessage.withPayload(
|
||||
type: 'OFFER',
|
||||
@@ -165,6 +169,8 @@ class WebRtcController {
|
||||
toDeviceId: targetDeviceId,
|
||||
deviceType: 'CONTROLLER',
|
||||
payload: payload,
|
||||
authType: authType,
|
||||
authValue: authValue,
|
||||
);
|
||||
signaling.send(msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user