From 50560956d7c1d43dfab4e1433c7f37e7e39d8d14 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 25 Aug 2020 14:47:07 +0200 Subject: [PATCH] Create VideoCallTutorial project --- swift/VideoCallTutorial/Podfile | 24 + .../project.pbxproj | 434 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../VideoCallTutorial/AppDelegate.swift | 37 ++ .../AppIcon.appiconset/Contents.json | 98 ++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../VideoCallTutorial/ContentView.swift | 139 ++++++ .../VideoCallTutorial/Info.plist | 70 +++ .../Preview Assets.xcassets/Contents.json | 6 + .../VideoCallTutorial/SceneDelegate.swift | 63 +++ .../VideoCallTutorial/VideoCallExample.swift | 201 ++++++++ 15 files changed, 1136 insertions(+) create mode 100644 swift/VideoCallTutorial/Podfile create mode 100644 swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.pbxproj create mode 100644 swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/contents.xcworkspacedata create mode 100644 swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/AppDelegate.swift create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/Contents.json create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/Base.lproj/LaunchScreen.storyboard create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/ContentView.swift create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/Info.plist create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/SceneDelegate.swift create mode 100644 swift/VideoCallTutorial/VideoCallTutorial/VideoCallExample.swift diff --git a/swift/VideoCallTutorial/Podfile b/swift/VideoCallTutorial/Podfile new file mode 100644 index 0000000..234435a --- /dev/null +++ b/swift/VideoCallTutorial/Podfile @@ -0,0 +1,24 @@ +# Uncomment the next line to define a global platform for your project +platform :ios, '11.0' +source "https://gitlab.linphone.org/BC/public/podspec.git" +#source "https://github.com/CocoaPods/Specs.git" + +def basic_pods + if ENV['PODFILE_PATH'].nil? + pod 'linphone-sdk', '~> 4.5.0-alpha' + else + pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk + end + +end + + + +target 'VideoCallTutorial' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for VideoCallTutorial + basic_pods + +end diff --git a/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.pbxproj b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4c946e0 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.pbxproj @@ -0,0 +1,434 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 35D8905DB6DB64DBA378DD77 /* Pods_VideoCallTutorial.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 986707DD3A02A9DA3AC8E695 /* Pods_VideoCallTutorial.framework */; }; + 66E0882724F3EFCB00399387 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E0882624F3EFCB00399387 /* AppDelegate.swift */; }; + 66E0882924F3EFCB00399387 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E0882824F3EFCB00399387 /* SceneDelegate.swift */; }; + 66E0882B24F3EFCB00399387 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E0882A24F3EFCB00399387 /* ContentView.swift */; }; + 66E0882D24F3EFCE00399387 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66E0882C24F3EFCE00399387 /* Assets.xcassets */; }; + 66E0883024F3EFCE00399387 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66E0882F24F3EFCE00399387 /* Preview Assets.xcassets */; }; + 66E0883324F3EFCE00399387 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66E0883124F3EFCE00399387 /* LaunchScreen.storyboard */; }; + 66E0883D24F3F18F00399387 /* VideoCallExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E0883C24F3F18F00399387 /* VideoCallExample.swift */; }; + 66E0884024F3F3C400399387 /* commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E0883F24F3F3C400399387 /* commons.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 66E0882324F3EFCB00399387 /* VideoCallTutorial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VideoCallTutorial.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 66E0882624F3EFCB00399387 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 66E0882824F3EFCB00399387 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 66E0882A24F3EFCB00399387 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 66E0882C24F3EFCE00399387 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 66E0882F24F3EFCE00399387 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 66E0883224F3EFCE00399387 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 66E0883424F3EFCE00399387 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 66E0883C24F3F18F00399387 /* VideoCallExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCallExample.swift; sourceTree = ""; }; + 66E0883F24F3F3C400399387 /* commons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = commons.swift; sourceTree = ""; }; + 7B891FD7EB1A18BB9FE7D933 /* Pods-VideoCallTutorial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoCallTutorial.debug.xcconfig"; path = "Target Support Files/Pods-VideoCallTutorial/Pods-VideoCallTutorial.debug.xcconfig"; sourceTree = ""; }; + 986707DD3A02A9DA3AC8E695 /* Pods_VideoCallTutorial.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VideoCallTutorial.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + ABFD2848490334789E9D66B7 /* Pods-VideoCallTutorial.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoCallTutorial.release.xcconfig"; path = "Target Support Files/Pods-VideoCallTutorial/Pods-VideoCallTutorial.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 66E0882024F3EFCB00399387 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 35D8905DB6DB64DBA378DD77 /* Pods_VideoCallTutorial.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 66E0881A24F3EFCB00399387 = { + isa = PBXGroup; + children = ( + 66E0883E24F3F23600399387 /* TutorialCommons */, + 66E0882524F3EFCB00399387 /* VideoCallTutorial */, + 66E0882424F3EFCB00399387 /* Products */, + FC1AF6D6728F5CAC7EF852C9 /* Pods */, + A43103E3A55E682542483B41 /* Frameworks */, + ); + sourceTree = ""; + }; + 66E0882424F3EFCB00399387 /* Products */ = { + isa = PBXGroup; + children = ( + 66E0882324F3EFCB00399387 /* VideoCallTutorial.app */, + ); + name = Products; + sourceTree = ""; + }; + 66E0882524F3EFCB00399387 /* VideoCallTutorial */ = { + isa = PBXGroup; + children = ( + 66E0882624F3EFCB00399387 /* AppDelegate.swift */, + 66E0882824F3EFCB00399387 /* SceneDelegate.swift */, + 66E0883C24F3F18F00399387 /* VideoCallExample.swift */, + 66E0882A24F3EFCB00399387 /* ContentView.swift */, + 66E0882C24F3EFCE00399387 /* Assets.xcassets */, + 66E0883124F3EFCE00399387 /* LaunchScreen.storyboard */, + 66E0883424F3EFCE00399387 /* Info.plist */, + 66E0882E24F3EFCE00399387 /* Preview Content */, + ); + path = VideoCallTutorial; + sourceTree = ""; + }; + 66E0882E24F3EFCE00399387 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 66E0882F24F3EFCE00399387 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 66E0883E24F3F23600399387 /* TutorialCommons */ = { + isa = PBXGroup; + children = ( + 66E0883F24F3F3C400399387 /* commons.swift */, + ); + name = TutorialCommons; + path = ../TutorialCommons; + sourceTree = ""; + }; + A43103E3A55E682542483B41 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 986707DD3A02A9DA3AC8E695 /* Pods_VideoCallTutorial.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FC1AF6D6728F5CAC7EF852C9 /* Pods */ = { + isa = PBXGroup; + children = ( + 7B891FD7EB1A18BB9FE7D933 /* Pods-VideoCallTutorial.debug.xcconfig */, + ABFD2848490334789E9D66B7 /* Pods-VideoCallTutorial.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 66E0882224F3EFCB00399387 /* VideoCallTutorial */ = { + isa = PBXNativeTarget; + buildConfigurationList = 66E0883724F3EFCE00399387 /* Build configuration list for PBXNativeTarget "VideoCallTutorial" */; + buildPhases = ( + CEDC5E46FCFDF6F9646CEC10 /* [CP] Check Pods Manifest.lock */, + 66E0881F24F3EFCB00399387 /* Sources */, + 66E0882024F3EFCB00399387 /* Frameworks */, + 66E0882124F3EFCB00399387 /* Resources */, + E38AAD2F893E01DA32122400 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = VideoCallTutorial; + productName = VideoCallTutorial; + productReference = 66E0882324F3EFCB00399387 /* VideoCallTutorial.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 66E0881B24F3EFCB00399387 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1160; + LastUpgradeCheck = 1160; + ORGANIZATIONNAME = BelledonneCommunications; + TargetAttributes = { + 66E0882224F3EFCB00399387 = { + CreatedOnToolsVersion = 11.6; + }; + }; + }; + buildConfigurationList = 66E0881E24F3EFCB00399387 /* Build configuration list for PBXProject "VideoCallTutorial" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 66E0881A24F3EFCB00399387; + productRefGroup = 66E0882424F3EFCB00399387 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 66E0882224F3EFCB00399387 /* VideoCallTutorial */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 66E0882124F3EFCB00399387 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 66E0883324F3EFCE00399387 /* LaunchScreen.storyboard in Resources */, + 66E0883024F3EFCE00399387 /* Preview Assets.xcassets in Resources */, + 66E0882D24F3EFCE00399387 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + CEDC5E46FCFDF6F9646CEC10 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-VideoCallTutorial-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E38AAD2F893E01DA32122400 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-VideoCallTutorial/Pods-VideoCallTutorial-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-VideoCallTutorial/Pods-VideoCallTutorial-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-VideoCallTutorial/Pods-VideoCallTutorial-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 66E0881F24F3EFCB00399387 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 66E0883D24F3F18F00399387 /* VideoCallExample.swift in Sources */, + 66E0882724F3EFCB00399387 /* AppDelegate.swift in Sources */, + 66E0882924F3EFCB00399387 /* SceneDelegate.swift in Sources */, + 66E0884024F3F3C400399387 /* commons.swift in Sources */, + 66E0882B24F3EFCB00399387 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 66E0883124F3EFCE00399387 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 66E0883224F3EFCE00399387 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 66E0883524F3EFCE00399387 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 66E0883624F3EFCE00399387 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 66E0883824F3EFCE00399387 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B891FD7EB1A18BB9FE7D933 /* Pods-VideoCallTutorial.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"VideoCallTutorial/Preview Content\""; + DEVELOPMENT_TEAM = Z2V957B3D6; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = VideoCallTutorial/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = BC.VideoCallTutorial; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 66E0883924F3EFCE00399387 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ABFD2848490334789E9D66B7 /* Pods-VideoCallTutorial.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"VideoCallTutorial/Preview Content\""; + DEVELOPMENT_TEAM = Z2V957B3D6; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = VideoCallTutorial/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = BC.VideoCallTutorial; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 66E0881E24F3EFCB00399387 /* Build configuration list for PBXProject "VideoCallTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 66E0883524F3EFCE00399387 /* Debug */, + 66E0883624F3EFCE00399387 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 66E0883724F3EFCE00399387 /* Build configuration list for PBXNativeTarget "VideoCallTutorial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 66E0883824F3EFCE00399387 /* Debug */, + 66E0883924F3EFCE00399387 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 66E0881B24F3EFCB00399387 /* Project object */; +} diff --git a/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ff2e644 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/contents.xcworkspacedata b/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..c879417 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial/AppDelegate.swift b/swift/VideoCallTutorial/VideoCallTutorial/AppDelegate.swift new file mode 100644 index 0000000..be08edc --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// VideoCallTutorial +// +// Created by QuentinArguillere on 24/08/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import UIKit +import SwiftUI + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + @ObservedObject var tutorialContext = VideoCallExample() + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json b/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/Contents.json b/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/VideoCallTutorial/VideoCallTutorial/Base.lproj/LaunchScreen.storyboard b/swift/VideoCallTutorial/VideoCallTutorial/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial/ContentView.swift b/swift/VideoCallTutorial/VideoCallTutorial/ContentView.swift new file mode 100644 index 0000000..470a3e2 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/ContentView.swift @@ -0,0 +1,139 @@ +// +// ContentView.swift +// VideoCallTutorial +// +// Created by QuentinArguillere on 24/08/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import SwiftUI + +struct ContentView: View { + + @ObservedObject var tutorialContext = VideoCallExample() + + func getCallButtonText() -> String + { + if (tutorialContext.callRunning) { + return "Update Call" + } + else if (tutorialContext.isCallIncoming) { + return "Answer" + } + else { + return "Call" + } + } + + func callStateString() -> String + { + if (tutorialContext.callRunning) { + return "Call running" + } + else if (tutorialContext.isCallIncoming) { + return "Incoming call" + } + else { + return "No Call" + } + } + + var body: some View { + VStack(alignment: .leading) { + Group { + HStack { + Text("Identity:") + .font(.subheadline) + TextField("", text : $tutorialContext.id) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + HStack { + Text("Password:") + .font(.subheadline) + TextField("", text : $tutorialContext.passwd) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + HStack { + Button(action: tutorialContext.registrationExample) + { + Text("Login") + .font(.largeTitle) + .foregroundColor(Color.white) + .frame(width: 90.0, height: 42.0) + .background(Color.gray) + }.font(.footnote) + Text(tutorialContext.loggedIn ? "Logged in" : "Unregistered") + .font(.footnote) + .foregroundColor(tutorialContext.loggedIn ? Color.green : Color.black) + } + } + HStack { + Text("Call dest:") + TextField("", text : $tutorialContext.dest) + .textFieldStyle(RoundedBorderTextFieldStyle()) + } + HStack { + Toggle(isOn: $tutorialContext.videoEnabled) { + Text("Video") + }.frame(width : 110.0) + Button(action: tutorialContext.changeVideoDevice) + { + Text(" Change camera ") + .font(.title) + .foregroundColor(Color.white) + .background(Color.gray) + }.padding(.leading) + } + VStack { + HStack { + Button(action: { + if (self.tutorialContext.isCallIncoming) { + self.tutorialContext.acceptCall() + } + else { + self.tutorialContext.outgoingCallExample() + } + }) + { + Text(getCallButtonText()) + .font(.largeTitle) + .foregroundColor(Color.white) + .frame(width: 180.0, height: 42.0) + .background(Color.green) + } + Button(action: tutorialContext.stopCall) { + Text(tutorialContext.isCallIncoming ? "Decline" : "Stop Call") + .font(.largeTitle) + .foregroundColor(Color.white) + .frame(width: 180.0, height: 42.0) + .background(Color.red) + } + } + HStack { + Text(callStateString()) + .font(.footnote) + .foregroundColor(tutorialContext.callRunning || tutorialContext.isCallIncoming ? Color.green : Color.black) + } + .padding(.top) + } + tutorialContext.videoView + Spacer() + Group { + Toggle(isOn: $tutorialContext.loggingUnit.logsEnabled.value) { + Text("Logs collection") + .multilineTextAlignment(.trailing) + } + Text("Core Version is \(tutorialContext.coreVersion)") + .font(.footnote) + } + EmptyView() + } + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView(tutorialContext: VideoCallExample()) + } +} diff --git a/swift/VideoCallTutorial/VideoCallTutorial/Info.plist b/swift/VideoCallTutorial/VideoCallTutorial/Info.plist new file mode 100644 index 0000000..84b1af3 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/Info.plist @@ -0,0 +1,70 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSApplicationCategoryType + + LSRequiresIPhoneOS + + NSCameraUsageDescription + Camera access + NSMicrophoneUsageDescription + Microphone access + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UIBackgroundModes + + voip + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/swift/VideoCallTutorial/VideoCallTutorial/Preview Content/Preview Assets.xcassets/Contents.json b/swift/VideoCallTutorial/VideoCallTutorial/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/VideoCallTutorial/VideoCallTutorial/SceneDelegate.swift b/swift/VideoCallTutorial/VideoCallTutorial/SceneDelegate.swift new file mode 100644 index 0000000..9fe5572 --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/SceneDelegate.swift @@ -0,0 +1,63 @@ +// +// SceneDelegate.swift +// VideoCallTutorial +// +// Created by QuentinArguillere on 24/08/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import UIKit +import SwiftUI + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + + let contentView = ContentView() + + // Use a UIHostingController as window root view controller. + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/swift/VideoCallTutorial/VideoCallTutorial/VideoCallExample.swift b/swift/VideoCallTutorial/VideoCallTutorial/VideoCallExample.swift new file mode 100644 index 0000000..b26d3ec --- /dev/null +++ b/swift/VideoCallTutorial/VideoCallTutorial/VideoCallExample.swift @@ -0,0 +1,201 @@ +// +// VideoCallExample.swift +// VideoCallTutorial +// +// Created by QuentinArguillere on 24/08/2020. +// Copyright © 2020 BelledonneCommunications. All rights reserved. +// + +import linphonesw +import SwiftUI + +class VideoCallExample : ObservableObject +{ + var mCore: Core! // We need a Core for... anything, basically + @Published var coreVersion: String = Core.getVersion + + /*------------ Logs related variables ------------------------*/ + var loggingUnit = LoggingUnit() + + /*------------ Call tutorial related variables ---------------*/ + let mCallStateTracer = CallStateDelegate() + var mCall: Call! + var proxy_cfg : ProxyConfig! + var mVideoDevices : [String] = [] + var mUsedVideoDeviceId : Int = 0 + var callAlreadyStopped = false; + + @Published var audioEnabled : Bool = true + @Published var videoEnabled : Bool = false + @Published var speakerEnabled : Bool = false + @Published var callRunning : Bool = false + @Published var isCallIncoming : Bool = false + @Published var dest : String = "sip:arguillq@sip.linphone.org" + + let mRegistrationDelegate = LinphoneRegistrationDelegate() + @Published var id : String = "sip:quentindev@sip.linphone.org" + @Published var passwd : String = "dev" + @Published var loggedIn: Bool = false + + /*--- Wrapper to incorporate the video chat view into a SwiftUI gui ---*/ + struct VideoView: UIViewRepresentable { + let videoAsUIView = UIView() + + func makeUIView(context: Context) -> UIView { + videoAsUIView.backgroundColor = .black + return videoAsUIView + } + + func updateUIView(_ uiView: UIView, context: Context) {} + } + let videoView = VideoView() + + + init() + { + mCallStateTracer.tutorialContext = self + mRegistrationDelegate.tutorialContext = self + // linphone_call_params_get_used_video_codec + // Initialize Linphone Core + try? mCore = Factory.Instance.createCore(configPath: "", factoryConfigPath: "", systemContext: nil) + + // main loop for receiving notifications and doing background linphonecore work: + mCore.autoIterateEnabled = true + + // Give the UIView in which the video will be rendered to the Linphone Core + mCore.nativeVideoWindowId = UnsafeMutableRawPointer(Unmanaged.passRetained(videoView.videoAsUIView).toOpaque()) + try? mCore.start() + + mVideoDevices = mCore.videoDevicesList + + mCore.addDelegate(delegate: mCallStateTracer) + mCore.addDelegate(delegate: mRegistrationDelegate) + } + + func registrationExample() + { + if (!loggedIn) { + do { + proxy_cfg = try createAndInitializeProxyConfig(core : mCore, identity: id, password: passwd) + try mCore.addProxyConfig(config: proxy_cfg!) + if ( mCore.defaultProxyConfig == nil) { + // IMPORTANT : default proxy config setting MUST be done AFTER adding the config to the core ! + mCore.defaultProxyConfig = proxy_cfg + } + } catch { + print(error) + } + } + } + + func createCallParams() throws -> CallParams + { + let callParams = try mCore.createCallParams(call: nil) + callParams.videoEnabled = videoEnabled; + callParams.audioEnabled = audioEnabled; + + return callParams + } + + // Initiate a call + func outgoingCallExample() + { + mCore.videoActivationPolicy!.automaticallyAccept = videoEnabled + mCore.videoActivationPolicy!.automaticallyInitiate = videoEnabled + do { + if (!callRunning) + { + let callDest = try Factory.Instance.createAddress(addr: dest) + // Place an outgoing call + mCall = mCore.inviteAddressWithParams(addr: callDest, params: try createCallParams()) + + if (mCall == nil) { + print("Could not place call to \(dest)\n") + } else { + print("Call to \(dest) is in progress...") + } + } + else + { + try mCall.update(params: createCallParams()) + } + } catch { + print(error) + } + + } + + // Terminate a call + func stopCall() + { + if ((callRunning || isCallIncoming) && mCall.state != Call.State.End) { + callAlreadyStopped = true; + // terminate the call + print("Terminating the call...\n") + do { + try mCall.terminate() + } catch + { + print(error) + } + } + } + + func changeVideoDevice() + { + mUsedVideoDeviceId = (mUsedVideoDeviceId + 1) % mVideoDevices.count + do { + try mCore.setVideodevice(newValue: mVideoDevices[mUsedVideoDeviceId]) + } catch { + print(error) + } + } + + func acceptCall() + { + do { + try mCall.accept() + } catch { + print(error) + } + } +} + +// Callback for actions when a change in the Registration State happens +class LinphoneRegistrationDelegate: CoreDelegate { + + var tutorialContext : VideoCallExample! + + override func onRegistrationStateChanged(core lc: Core, proxyConfig cfg: ProxyConfig, state cstate: RegistrationState, message: String?) { + print("New registration state \(cstate) for user id \( String(describing: cfg.identityAddress?.asString()))\n") + if (cstate == .Ok) { + tutorialContext.loggedIn = true + } + } +} + + +// Callback for actions when a change in the Call State happens +class CallStateDelegate: CoreDelegate { + + var tutorialContext : VideoCallExample! + + override func onCallStateChanged(core lc: Core, call: Call, state cstate: Call.State, message: String) { + print("CallTrace - \(cstate)") + if (cstate == .IncomingReceived) { + // We're being called by someone + tutorialContext.mCall = call + tutorialContext.isCallIncoming = true + } else if (cstate == .OutgoingRinging) { + // We're calling someone + tutorialContext.callRunning = true + } else if (cstate == .End) { + // Call has been terminated by any side + tutorialContext.callRunning = false + tutorialContext.isCallIncoming = false + } else if (cstate == .StreamsRunning) { + // Call has successfully began + tutorialContext.callRunning = true + } + } +}