diff --git a/lib/src/voip.dart b/lib/src/voip.dart index bae91bb8..6d82ba5a 100644 --- a/lib/src/voip.dart +++ b/lib/src/voip.dart @@ -1,17 +1,11 @@ import 'dart:async'; import 'dart:core'; -import 'dart:io'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/widgets.dart'; - -import 'package:flutter_webrtc/flutter_webrtc.dart'; +import 'voip_abstract.dart'; import 'package:sdp_transform/sdp_transform.dart' as sdp_transform; import '../matrix.dart'; -bool get kIsMobile => !kIsWeb && (Platform.isAndroid || Platform.isIOS); - /// The default life time for call events, in millisecond. const lifetimeMs = 10 * 1000; diff --git a/lib/src/voip_abstract.dart b/lib/src/voip_abstract.dart new file mode 100644 index 00000000..392e5d36 --- /dev/null +++ b/lib/src/voip_abstract.dart @@ -0,0 +1,116 @@ +import 'dart:io'; + +class MediaStreamTrack { + bool get enabled => false; + set enabled(bool value) {} + String get kind => throw UnimplementedError(); + Future stop() async {} + Future enableSpeakerphone(bool enable) async {} +} + +class MediaStream { + String get id => throw UnimplementedError(); + List getAudioTracks() => throw UnimplementedError(); + List getVideoTracks() => throw UnimplementedError(); + List getTracks() => throw UnimplementedError(); + Future dispose() async {} +} + +class RTCPeerConnection { + Function(RTCTrackEvent event)? onTrack; + Function()? onRenegotiationNeeded; + Function(RTCIceCandidate)? onIceCandidate; + Function(dynamic state)? onIceGatheringState; + Function(dynamic state)? onIceConnectionState; + + Future createOffer(Map constraints) { + throw UnimplementedError(); + } + + Future createAnswer(Map constraints) { + throw UnimplementedError(); + } + + Future setRemoteDescription(RTCSessionDescription description) async {} + Future setLocalDescription(RTCSessionDescription description) async {} + + Future addTrack( + MediaStreamTrack track, MediaStream stream) async { + return RTCRtpSender(); + } + + Future removeTrack(RTCRtpSender sender) async {} + + Future close() async {} + + Future dispose() async {} + + Future addIceCandidate(RTCIceCandidate candidate) async {} + + Future addStream(MediaStream stream) async {} + + Future removeStream(MediaStream stream) async {} + + Future> getTransceivers() async { + throw UnimplementedError(); + } + + Future> getSenders() async { + throw UnimplementedError(); + } + + Future addCandidate(RTCIceCandidate candidate) async {} + + dynamic get signalingState => throw UnimplementedError(); +} + +class RTCIceCandidate { + String get candidate => throw UnimplementedError(); + String get sdpMid => throw UnimplementedError(); + int get sdpMLineIndex => throw UnimplementedError(); + Map toMap() => throw UnimplementedError(); + RTCIceCandidate(String candidate, String sdpMid, int sdpMLineIndex); +} + +class RTCRtpSender { + MediaStreamTrack? get track => throw UnimplementedError(); + DtmfSender get dtmfSender => throw UnimplementedError(); +} + +class RTCSessionDescription { + late String type; + late String sdp; + RTCSessionDescription(this.sdp, this.type); +} + +class RTCTrackEvent { + late List streams; +} + +enum TransceiverDirection { + SendRecv, + SendOnly, + RecvOnly, + Inactive, +} + +enum RTCSignalingState { RTCSignalingStateStable } + +class RTCVideoRenderer {} + +const kIsWeb = false; + +bool get kIsMobile => !kIsWeb && (Platform.isAndroid || Platform.isIOS); + +class Helper { + static Future switchCamera(MediaStreamTrack track) async {} +} + +class DtmfSender { + Future insertDTMF(String tones) async {} +} + +Future createPeerConnection( + Map constraints) async { + throw UnimplementedError(); +} diff --git a/pubspec.yaml b/pubspec.yaml index 9ac08b2f..4d236c92 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,7 +24,6 @@ dependencies: html: ^0.15.0 collection: ^1.15.0 sdp_transform: ^0.3.2 - flutter_webrtc: ^0.7.1 dev_dependencies: dart_code_metrics: ^4.4.0