4
2
Fork 0

feat: implementing RTCWrapper

pull/43/head
Sudharshan S. 2019-03-26 19:10:34 +08:00
parent 70867dc53c
commit 668908f5eb
Signed by: sudharshan
GPG Key ID: C861C97AAF3D9559
7 changed files with 61 additions and 6 deletions

View File

@ -40,6 +40,10 @@ target 'Runner' do
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Custom Pods
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleWebRTC'
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?

View File

@ -12,6 +12,7 @@
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4A87800125259F21EA397584 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6FE3C699402F0E32606816A /* Pods_Runner.framework */; };
59A38837224A3BEA00697DC5 /* RTCWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59A38836224A3BEA00697DC5 /* RTCWrapper.swift */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -40,6 +41,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
59A38836224A3BEA00697DC5 /* RTCWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCWrapper.swift; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@ -119,6 +121,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
59A38836224A3BEA00697DC5 /* RTCWrapper.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
@ -184,6 +187,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
@ -267,6 +271,7 @@
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${PODS_ROOT}/GoogleWebRTC/Frameworks/frameworks/WebRTC.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
);
@ -274,6 +279,7 @@
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
);
@ -291,6 +297,7 @@
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
59A38837224A3BEA00697DC5 /* RTCWrapper.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -16,13 +16,15 @@ import Flutter
switch call.method {
case "join":
print("Join executed")
result(String(""))
return
case "exit":
print("exit executed")
result(String(""))
return
case "get":
print("exit executed")
return result(String(""))
print("get executed")
result(String("c-d73b6afa2fe3685faad28eba36d8cd0a"))
default:
result(FlutterMethodNotImplemented)
return

View File

@ -0,0 +1,41 @@
//
// RTCWrapper.swift
// Runner
//
// Created by Sudharshan on 3/26/19.
// Copyright © 2019 The Chromium Authors. All rights reserved.
//
import Foundation
import WebRTC
class RTCWrapper{
var connectionFactory: RTCPeerConnectionFactory;
var peerConnection: RTCPeerConnection;
init() {
RTCPeerConnectionFactory.initialize()
self.connectionFactory = RTCPeerConnectionFactory()
}
func initialisePeerConnection () {
let configuration = RTCConfiguration()
configuration.iceServers = self.iceServers
self.peerConnection = self.connectionFactory.peerConnection(with: configuration, constraints: self.defaultConnectionConstraint, delegate: self)
}
func startConnection () {
guard let peerConnection = self.peerConnection else {
return
}
self.state = .connecting
let localStream = self.localStream()
peerConnection.add(localStream)
if let localVideoTrack = localStream.videoTracks.first {
self.delegate?.rtcClient(client: self, didReceiveLocalVideoTrack: localVideoTrack)
}
}
}

View File

@ -17,7 +17,7 @@ class Routes {
title: "Beep",
theme: theme,
routes: routes,
home: Home(),
home: Welcome(),
));
}
}

View File

@ -29,7 +29,7 @@ class ConversationManager {
Future<String> get() async {
try {
final String conversationId = await channel.invokeMethod('get');
return conversationId;
return "";
} on PlatformException catch (e) {
print(e);
return "";

View File

@ -44,9 +44,10 @@ class _ConversationItemState extends State<ConversationItem> {
return ListTile(
isThreeLine: true,
onTap: () async {
await conversationManager.join(conversation.id);
await bus.publish({"state": "connection", "title": conversation.title});
print("Press on ${conversation.id} triggered");
await conversationManager.join(conversation.id);
print("Gotten past the join");
await bus.publish({"state": "connection", "title": conversation.title});
},
contentPadding:
EdgeInsets.only(top: 0.0, left: 20.0, right: 20.0, bottom: 0.0),