From 76c09636c435c8e4b613ee73bf13ec64f0932bc6 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 12 六月 2020 17:35:23 +0800 Subject: [PATCH] 2020-06-12 1.丰林SDK集成相关资料 --- xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.m | 110 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_answer.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.m | 124 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.m | 67 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h | 54 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/Contents.json | 21 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.h | 19 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/ic_esvideo_hangup.png | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/Info.plist | 22 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/ic_esvideo_takephoto_unselect.png | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_unselect.png | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json | 98 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.h | 16 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/Contents.json | 21 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_select.png | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m | 37 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/ic_esvideo_collect_select.png | 0 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.h | 21 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm | 568 +++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/ic_esvideo_unlock_unselect.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/ic_esvideo_home.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 7 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/ESVideoPhoneSDk | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/Contents.json | 21 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/ic_esvideo_more.png | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements | 0 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.h | 23 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | 8 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | 8 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m | 955 +++++ ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.h | 23 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/Info.plist | 22 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard | 29 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard | 29 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_home.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources | 136 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESError.h | 76 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m | 37 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.m | 51 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.h | 15 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m | 41 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Info.plist | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h | 24 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m | 48 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory | 0 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 7 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_hangup.png | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_select.png | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Shared.IOS.ESVideoPhoneSDK.csproj | 75 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/Contents.json | 21 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.m | 124 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m | 48 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/Contents.json | 21 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json | 6 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.m | 42 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/ic_esvideo_collect_unselect.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/ic_esvideo_takephoto_select.png | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.h | 15 xamarin/Shared.IOS.ESVideoPhoneSDK/Properties/AssemblyInfo.cs | 34 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources | 136 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard | 143 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 83 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Info.plist | 0 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.h | 29 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.h | 28 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h | 54 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/ic_esvideo_back.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m | 168 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/Contents.json | 21 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m | 1158 ++++++ ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.h | 19 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/ic_esvideo_answer.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.h | 17 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.h | 19 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Info.plist | 73 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_unselect.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/main.m | 19 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.m | 124 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_back.png | 0 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 83 xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj | 343 + ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Info.plist | 73 README.md | 2 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESError.h | 76 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m | 1159 ++++++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.h | 28 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Structs.cs | 6 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.mm | 556 ++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h | 83 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/Info.plist | 22 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist | 8 xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a | 0 .gitignore | 321 + ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata | 7 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json | 98 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/Contents.json | 21 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/ESVideoPhoneSDk | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/Info.plist | 22 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.h | 29 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard | 181 xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs | 132 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_unselect.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m | 955 +++++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj | 692 +++ xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_more.png | 0 xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_select.png | 0 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory | 0 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/ESVideoPhoneSDk | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/Contents.json | 21 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/ic_esvideo_unlock_select.png | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h | 21 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.h | 16 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Info.plist | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/Contents.json | 21 xamarin/Shared.IOS.ESVideoPhoneSDK/Library/ESVideoPhoneSDk.a | 0 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json | 6 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m | 110 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj | 650 +++ ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/Contents.json | 21 ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESError.h | 76 xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources | 136 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/main.m | 19 ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/Contents.json | 21 ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.m | 50 133 files changed, 11,264 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index a3cd143..5b81d17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,110 @@ + +# Created by https://www.gitignore.io/api/xcode,android +# Edit at https://www.gitignore.io/?templates=xcode,android + +### Android ### +# Built application files +*.apk +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +### Android Patch ### +gen-external-apklibs +output.json + +### Xcode ### # Xcode # -build/ +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +DerivedData/ +*.moved-aside *.pbxuser !default.pbxuser *.mode1v3 @@ -9,18 +113,205 @@ !default.mode2v3 *.perspectivev3 !default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -# Pods/ +## Xcode Patch +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Xcode Patch ### +**/xcshareddata/WorkspaceSettings.xcsettings + +# End of https://www.gitignore.io/api/xcode,android + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ +.vs/ +packages/ + +# Roslyn cache directories +*.ide/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +#NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +## TODO: Comment the next line if you want to checkin your +## web deploy settings but do note that will include unencrypted +## passwords +*.pubxml + +# NuGet Packages +packages/* +*.nupkg +## TODO: If the tool you use requires repositories.config +## uncomment the next line +#!packages/repositories.config + +# Enable "build/" folder in the NuGet Packages folder since +# NuGet packages use it for MSBuild targets. +# This line needs to be after the ignore of the build folder +# (and the packages folder if the line above has been uncommented) +!packages/build/ + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ +.DS_Store \ No newline at end of file diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ecfbd50 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj @@ -0,0 +1,650 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + C3385925233DAF06006940C3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385924233DAF06006940C3 /* AppDelegate.m */; }; + C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385927233DAF06006940C3 /* SceneDelegate.m */; }; + C338592B233DAF06006940C3 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C338592A233DAF06006940C3 /* ViewController.mm */; }; + C338592E233DAF06006940C3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C338592C233DAF06006940C3 /* Main.storyboard */; }; + C3385930233DAF12006940C3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C338592F233DAF12006940C3 /* Assets.xcassets */; }; + C3385933233DAF12006940C3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3385931233DAF12006940C3 /* LaunchScreen.storyboard */; }; + C3385936233DAF12006940C3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385935233DAF12006940C3 /* main.m */; }; + C3385940233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */; }; + C338594B233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */; }; + C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = C345D08A233EEE520079C82C /* AudioSessionHelper.m */; }; + C3EBF9E823A72BCE00B62DDD /* ESVideoPhoneSDk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */; }; + C3F59377233E0717009F09E5 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F59376233E0717009F09E5 /* libbz2.tbd */; }; + C3F59379233E0723009F09E5 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F59378233E0723009F09E5 /* libz.tbd */; }; + C3F5937B233E0745009F09E5 /* libiconv.2.4.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C338593C233DAF12006940C3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3385918233DAF06006940C3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C338591F233DAF06006940C3; + remoteInfo = ESVideoPhoneSDKDemo; + }; + C3385947233DAF13006940C3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3385918233DAF06006940C3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C338591F233DAF06006940C3; + remoteInfo = ESVideoPhoneSDKDemo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + B924480E24934E5500F118F1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + C3385920233DAF06006940C3 /* ESVideoPhoneSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ESVideoPhoneSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C3385923233DAF06006940C3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; + C3385924233DAF06006940C3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; + C3385926233DAF06006940C3 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; }; + C3385927233DAF06006940C3 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; }; + C3385929233DAF06006940C3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; + C338592A233DAF06006940C3 /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = "<group>"; }; + C338592D233DAF06006940C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + C338592F233DAF12006940C3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + C3385932233DAF12006940C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + C3385934233DAF12006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C3385935233DAF12006940C3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESVideoPhoneSDKDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoPhoneSDKDemoTests.m; sourceTree = "<group>"; }; + C3385941233DAF12006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESVideoPhoneSDKDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoPhoneSDKDemoUITests.m; sourceTree = "<group>"; }; + C338594C233DAF13006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C345D089233EEE510079C82C /* AudioSessionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSessionHelper.h; sourceTree = "<group>"; }; + C345D08A233EEE520079C82C /* AudioSessionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioSessionHelper.m; sourceTree = "<group>"; }; + C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ESVideoPhoneSDk.framework; sourceTree = "<group>"; }; + C3F59376233E0717009F09E5 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; + C3F59378233E0723009F09E5 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.4.0.tbd; path = usr/lib/libiconv.2.4.0.tbd; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C338591D233DAF06006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3EBF9E823A72BCE00B62DDD /* ESVideoPhoneSDk.framework in Frameworks */, + C3F5937B233E0745009F09E5 /* libiconv.2.4.0.tbd in Frameworks */, + C3F59379233E0723009F09E5 /* libz.tbd in Frameworks */, + C3F59377233E0717009F09E5 /* libbz2.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385938233DAF12006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385943233DAF13006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C3385917233DAF06006940C3 = { + isa = PBXGroup; + children = ( + C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */, + C338593E233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */, + C3385949233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */, + C3385921233DAF06006940C3 /* Products */, + C3E915CA233DFE4C00F77354 /* Frameworks */, + ); + sourceTree = "<group>"; + }; + C3385921233DAF06006940C3 /* Products */ = { + isa = PBXGroup; + children = ( + C3385920233DAF06006940C3 /* ESVideoPhoneSDKDemo.app */, + C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */, + C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */, + ); + name = Products; + sourceTree = "<group>"; + }; + C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { + isa = PBXGroup; + children = ( + C3385923233DAF06006940C3 /* AppDelegate.h */, + C3385924233DAF06006940C3 /* AppDelegate.m */, + C3385926233DAF06006940C3 /* SceneDelegate.h */, + C3385927233DAF06006940C3 /* SceneDelegate.m */, + C3385929233DAF06006940C3 /* ViewController.h */, + C338592A233DAF06006940C3 /* ViewController.mm */, + C345D089233EEE510079C82C /* AudioSessionHelper.h */, + C345D08A233EEE520079C82C /* AudioSessionHelper.m */, + C338592C233DAF06006940C3 /* Main.storyboard */, + C338592F233DAF12006940C3 /* Assets.xcassets */, + C3385931233DAF12006940C3 /* LaunchScreen.storyboard */, + C3385934233DAF12006940C3 /* Info.plist */, + C3385935233DAF12006940C3 /* main.m */, + ); + path = ESVideoPhoneSDKDemo; + sourceTree = "<group>"; + }; + C338593E233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */ = { + isa = PBXGroup; + children = ( + C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */, + C3385941233DAF12006940C3 /* Info.plist */, + ); + path = ESVideoPhoneSDKDemoTests; + sourceTree = "<group>"; + }; + C3385949233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */ = { + isa = PBXGroup; + children = ( + C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */, + C338594C233DAF13006940C3 /* Info.plist */, + ); + path = ESVideoPhoneSDKDemoUITests; + sourceTree = "<group>"; + }; + C3E915CA233DFE4C00F77354 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B924480E24934E5500F118F1 /* AudioToolbox.framework */, + C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */, + C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */, + C3F59378233E0723009F09E5 /* libz.tbd */, + C3F59376233E0717009F09E5 /* libbz2.tbd */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = C338594F233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemo" */; + buildPhases = ( + C338591C233DAF06006940C3 /* Sources */, + C338591D233DAF06006940C3 /* Frameworks */, + C338591E233DAF06006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ESVideoPhoneSDKDemo; + productName = ESVideoPhoneSDKDemo; + productReference = C3385920233DAF06006940C3 /* ESVideoPhoneSDKDemo.app */; + productType = "com.apple.product-type.application"; + }; + C338593A233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3385952233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoTests" */; + buildPhases = ( + C3385937233DAF12006940C3 /* Sources */, + C3385938233DAF12006940C3 /* Frameworks */, + C3385939233DAF12006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C338593D233DAF12006940C3 /* PBXTargetDependency */, + ); + name = ESVideoPhoneSDKDemoTests; + productName = ESVideoPhoneSDKDemoTests; + productReference = C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + C3385945233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3385955233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoUITests" */; + buildPhases = ( + C3385942233DAF13006940C3 /* Sources */, + C3385943233DAF13006940C3 /* Frameworks */, + C3385944233DAF13006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C3385948233DAF13006940C3 /* PBXTargetDependency */, + ); + name = ESVideoPhoneSDKDemoUITests; + productName = ESVideoPhoneSDKDemoUITests; + productReference = C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C3385918233DAF06006940C3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = eTouchSky; + TargetAttributes = { + C338591F233DAF06006940C3 = { + CreatedOnToolsVersion = 11.0; + }; + C338593A233DAF12006940C3 = { + CreatedOnToolsVersion = 11.0; + TestTargetID = C338591F233DAF06006940C3; + }; + C3385945233DAF13006940C3 = { + CreatedOnToolsVersion = 11.0; + TestTargetID = C338591F233DAF06006940C3; + }; + }; + }; + buildConfigurationList = C338591B233DAF06006940C3 /* Build configuration list for PBXProject "ESVideoPhoneSDKDemo" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C3385917233DAF06006940C3; + productRefGroup = C3385921233DAF06006940C3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */, + C338593A233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */, + C3385945233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C338591E233DAF06006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3385933233DAF12006940C3 /* LaunchScreen.storyboard in Resources */, + C3385930233DAF12006940C3 /* Assets.xcassets in Resources */, + C338592E233DAF06006940C3 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385939233DAF12006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385944233DAF13006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C338591C233DAF06006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C338592B233DAF06006940C3 /* ViewController.mm in Sources */, + C3385925233DAF06006940C3 /* AppDelegate.m in Sources */, + C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */, + C3385936233DAF12006940C3 /* main.m in Sources */, + C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385937233DAF12006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3385940233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385942233DAF13006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C338594B233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + C338593D233DAF12006940C3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */; + targetProxy = C338593C233DAF12006940C3 /* PBXContainerItemProxy */; + }; + C3385948233DAF13006940C3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */; + targetProxy = C3385947233DAF13006940C3 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + C338592C233DAF06006940C3 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C338592D233DAF06006940C3 /* Base */, + ); + name = Main.storyboard; + sourceTree = "<group>"; + }; + C3385931233DAF12006940C3 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3385932233DAF12006940C3 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C338594D233DAF13006940C3 /* 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_BITCODE = NO; + 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.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-Wl,-all_load"; + SDKROOT = iphoneos; + VALID_ARCHS = "arm64 arm64e"; + }; + name = Debug; + }; + C338594E233DAF13006940C3 /* 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_BITCODE = NO; + 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.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = "-Wl,-all_load"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "arm64 arm64e"; + }; + name = Release; + }; + C3385950233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = BVTA78PRYA; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ESVideoPhoneSDKDemo", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = ESVideoPhoneSDKDemo/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MARKETING_VERSION = 1.2; + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_BUNDLE_IDENTIFIER = com.hdl.ESVideoPhoneSDKDemo2; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = Test; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + C3385951233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = BVTA78PRYA; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ESVideoPhoneSDKDemo", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = ESVideoPhoneSDKDemo/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MARKETING_VERSION = 1.2; + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_BUNDLE_IDENTIFIER = com.hdl.ESVideoPhoneSDKDemo2; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = Test; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + C3385953233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESVideoPhoneSDKDemo.app/ESVideoPhoneSDKDemo"; + }; + name = Debug; + }; + C3385954233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESVideoPhoneSDKDemo.app/ESVideoPhoneSDKDemo"; + }; + name = Release; + }; + C3385956233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = ESVideoPhoneSDKDemo; + }; + name = Debug; + }; + C3385957233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = ESVideoPhoneSDKDemo; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C338591B233DAF06006940C3 /* Build configuration list for PBXProject "ESVideoPhoneSDKDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C338594D233DAF13006940C3 /* Debug */, + C338594E233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C338594F233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385950233DAF13006940C3 /* Debug */, + C3385951233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C3385952233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385953233DAF13006940C3 /* Debug */, + C3385954233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C3385955233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385956233DAF13006940C3 /* Debug */, + C3385957233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C3385918233DAF06006940C3 /* Project object */; +} diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..77c97cf --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:ESVideoPhoneSDKDemo.xcodeproj"> + </FileRef> +</Workspace> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.h new file mode 100644 index 0000000..4ed4dc0 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface AppDelegate : UIResponder <UIApplicationDelegate> +@property (strong, nonatomic) UIWindow *window; + +@end + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.m new file mode 100644 index 0000000..411f78c --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AppDelegate.m @@ -0,0 +1,42 @@ +// +// AppDelegate.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions { + // 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. +} + + +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.h new file mode 100644 index 0000000..39ed2c9 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.h @@ -0,0 +1,19 @@ +// +// AudioSessionHelper.h +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> + + + +@interface AudioSessionHelper : NSObject + +- (void)setAudioSession; +-(NSString *)speaker:(BOOL)isSpeaking; +@end + + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.m new file mode 100644 index 0000000..c4039cc --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/AudioSessionHelper.m @@ -0,0 +1,124 @@ +// +// AudioSessionHelper.m +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import "AudioSessionHelper.h" +#import <AVFoundation/AVFoundation.h> + +@interface AudioSessionHelper() + +@property (nonatomic,assign) BOOL speaking; + +@end + +@implementation AudioSessionHelper + +#pragma mark -- AVAudioSession鐨勮缃� +-(void)setAudioSession{ + NSError *error = nil; + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + }else{ + NSLog(@"鍚瓛鎾斁"); + } + + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + + [[AVAudioSession sharedInstance] setPreferredIOBufferDuration:0.05 error:&error]; + if (error) { + NSLog(@"AVAudioSessionSetPreferredIOBufferDuration error:%@", error); + } + + /**< 鐮佺巼璁剧疆涓嶆纭細瀵艰嚧鎾斁鍑烘潵鐨勫0闊冲彉灏栨垨鍙樺钩锛屾湁涓�鐐规嫋闊虫垨鑰呮渶鍚庝竴鐐归煶灏戜簡,8000鐨勯噰鏍风巼璁剧疆16000鐨勭爜鐜囧緢濂�>*/ + [[AVAudioSession sharedInstance] setPreferredSampleRate:16000 error:&error]; + if (error) { + NSLog(@"setPreferredSampleRate error:%@", error); + } +} + + +//蹇呴』鍏坰etActive:NO 鍐嶈缃畂ption 鍐峴etActive:YES锛� 鍚﹀垯鏈変簺绯荤粺锛屾湁浜涚暩褰紝鍦ㄥ惉绛掓ā寮忎笅涓嶈兘閲囬泦 +//杩欓噷鎵撴柇鐐规祴璇曞彲鑳戒細鎶ラ敊锛歱2p缁堢锛岃В鐮佸櫒缁堢銆� +-(NSString *)speaker:(BOOL)isSpeaking{ + + NSError *error = nil; + + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"setActive:NO error:%@", error); + } + if (isSpeaking == NO) { + //鍚瓛鎾斁 鏁堟灉寰堝ソ + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + return nil; + }else{ + NSLog(@"鍚瓛鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + [self LogAudioSessionInfo]; + + return @"鍏嶆彁"; + } + }else{ + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryOptionDefaultToSpeaker error:%@", error); + return nil; + }else{ + NSLog(@"鍏嶆彁鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + //[self LogAudioSessionInfo]; + + return @"鍚瓛"; + } + } +} + +-(void)LogAudioSessionInfo{ + AVAudioSessionCategory category = [[AVAudioSession sharedInstance] category]; + AVAudioSessionCategoryOptions option = [[AVAudioSession sharedInstance] categoryOptions]; + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + NSArray* outputArray = [AVAudioSession sharedInstance].currentRoute.outputs; + NSLog(@"%@", category); + NSLog(@"%lu", (unsigned long)option); + NSLog(@"%@", inputArray); + NSLog(@"%@", outputArray); +} + +/* +-(void)changeMicToHeadset{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortHeadsetMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +-(void)changeMicToBuiltIn{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortBuiltInMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +*/ +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..035cbad --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina4_7" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="oCk-sZ-pj6"/> + <viewControllerLayoutGuide type="bottom" id="850-qB-SUI"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Ze5-6b-2t3"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> +</document> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..3037ac2 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Otu-wo-FUs"> + <device id="retina6_1" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Wzv-3T-9rg"/> + <viewControllerLayoutGuide type="bottom" id="COG-Nv-9Ga"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="414" height="842"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vJi-oZ-LSc"> + <rect key="frame" x="40" y="738" width="60" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="2Pc-3k-dUO"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="cuo-Ky-5Dv"/> + </constraints> + <state key="normal" title="鍚瓛"/> + <connections> + <action selector="speaker:" destination="BYZ-38-t0r" eventType="touchUpInside" id="W7q-iX-a2t"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jPl-Vg-g3C"> + <rect key="frame" x="120" y="738" width="60" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="3O0-xV-2Xd"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="XJm-Mv-gZS"/> + </constraints> + <state key="normal" title="寮�闂�"/> + <connections> + <action selector="openDoor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="QiK-iu-wu4"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mdf-GC-mIQ"> + <rect key="frame" x="200" y="738" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="Sm2-me-6Rj"/> + <constraint firstAttribute="height" constant="30" id="ln6-ba-aYV"/> + </constraints> + <state key="normal" title="鎴浘"/> + <connections> + <action selector="onSnap:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dvX-n1-L3W"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="koH-BL-KZA"> + <rect key="frame" x="40" y="688" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="JB7-ql-xzA"/> + </constraints> + <state key="normal" title="鍙嶅懠"/> + <connections> + <action selector="onReverseCall:" destination="BYZ-38-t0r" eventType="touchUpInside" id="R22-bQ-kpF"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WJI-4Z-VeA"> + <rect key="frame" x="120" y="688" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="csc-sy-eEr"/> + <constraint firstAttribute="height" constant="30" id="vza-fv-qdl"/> + </constraints> + <state key="normal" title="鎸傛柇"/> + <connections> + <action selector="onHangup:" destination="BYZ-38-t0r" eventType="touchUpInside" id="mUK-dK-0eT"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LcR-MR-y9c"> + <rect key="frame" x="200" y="688" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="7N3-EE-cFS"/> + <constraint firstAttribute="height" constant="30" id="go1-vo-L2j"/> + </constraints> + <state key="normal" title="鐩戞帶"/> + <connections> + <action selector="onMonitor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="RcS-6u-LBX"/> + </connections> + </button> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Vfn-FR-1Ub"> + <rect key="frame" x="102" y="0.0" width="282" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="JFw-sW-vcm"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" returnKeyType="done"/> + </textField> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="闂ㄥ彛鏈�" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E2O-cv-ota"> + <rect key="frame" x="40" y="0.0" width="52" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="VRD-h4-kIL"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uhq-CJ-D5N"> + <rect key="frame" x="288" y="738" width="31" height="30"/> + <state key="normal" title="杩斿洖"/> + <connections> + <action selector="back:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Cky-im-DhB"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="leading" secondItem="E2O-cv-ota" secondAttribute="trailing" constant="10" id="0RX-sz-eS9"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="17C-bm-Akt"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="1qo-7b-cDh"/> + <constraint firstAttribute="trailing" secondItem="LcR-MR-y9c" secondAttribute="trailing" constant="154" id="Ac2-pr-p5A"/> + <constraint firstItem="vJi-oZ-LSc" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="AeG-dA-Pth"/> + <constraint firstItem="Uhq-CJ-D5N" firstAttribute="leading" secondItem="mdf-GC-mIQ" secondAttribute="trailing" constant="28" id="BCG-1O-c7I"/> + <constraint firstItem="vJi-oZ-LSc" firstAttribute="top" secondItem="koH-BL-KZA" secondAttribute="bottom" constant="20" id="Bgv-gv-AxZ"/> + <constraint firstItem="jPl-Vg-g3C" firstAttribute="leading" secondItem="vJi-oZ-LSc" secondAttribute="trailing" constant="20" id="F7k-hc-PjM"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="GCM-h5-uZT"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="HUm-Q4-lcX"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="Ifi-g7-5KM"/> + <constraint firstItem="WJI-4Z-VeA" firstAttribute="leading" secondItem="koH-BL-KZA" secondAttribute="trailing" constant="20" id="MZc-33-aQU"/> + <constraint firstAttribute="trailing" secondItem="mdf-GC-mIQ" secondAttribute="trailing" constant="154" id="Q2A-hp-SjO"/> + <constraint firstAttribute="trailingMargin" secondItem="Uhq-CJ-D5N" secondAttribute="trailing" constant="75" id="Taz-RX-FBH"/> + <constraint firstItem="LcR-MR-y9c" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="WJI-4Z-VeA" secondAttribute="trailing" symbolic="YES" id="Uor-VU-t3a"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="Wua-9B-iLw"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="baseline" secondItem="WJI-4Z-VeA" secondAttribute="baseline" id="hB6-19-6BO"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="leading" secondItem="E2O-cv-ota" secondAttribute="trailing" constant="10" id="hY9-F7-oE8"/> + <constraint firstItem="mdf-GC-mIQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="jPl-Vg-g3C" secondAttribute="trailing" symbolic="YES" id="hiz-Om-gmC"/> + <constraint firstAttribute="trailingMargin" secondItem="Vfn-FR-1Ub" secondAttribute="trailing" constant="10" id="nnC-yz-Mbc"/> + <constraint firstItem="mdf-GC-mIQ" firstAttribute="top" secondItem="LcR-MR-y9c" secondAttribute="bottom" constant="20" id="nyj-zh-x4K"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="baseline" secondItem="LcR-MR-y9c" secondAttribute="baseline" id="uhc-hz-Lg4"/> + <constraint firstItem="COG-Nv-9Ga" firstAttribute="top" secondItem="vJi-oZ-LSc" secondAttribute="bottom" constant="40" id="w71-ij-wzw"/> + <constraint firstItem="COG-Nv-9Ga" firstAttribute="top" secondItem="Uhq-CJ-D5N" secondAttribute="bottom" constant="40" id="y0A-Wx-QLV"/> + <constraint firstItem="COG-Nv-9Ga" firstAttribute="top" secondItem="jPl-Vg-g3C" secondAttribute="bottom" constant="40" id="zXK-Mn-zfv"/> + </constraints> + </view> + <connections> + <outlet property="mCallOrAccept" destination="koH-BL-KZA" id="Ryl-wC-8vS"/> + <outlet property="monitorBtn" destination="LcR-MR-y9c" id="quQ-29-c3m"/> + <outlet property="speakerBtn" destination="vJi-oZ-LSc" id="gAu-k3-y1u"/> + <outlet property="uIDTextField" destination="Vfn-FR-1Ub" id="En1-hG-ZxX"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="131.8840579710145" y="103.79464285714285"/> + </scene> + <!--View Controller--> + <scene sceneID="dmc-0p-Aa4"> + <objects> + <viewController id="Otu-wo-FUs" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="dsY-RY-Zva"/> + <viewControllerLayoutGuide type="bottom" id="wHq-fg-3bZ"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="5aY-oG-FVH"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dnn-Zd-Y1M"> + <rect key="frame" x="192" y="246" width="31" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="璺宠浆"/> + <connections> + <segue destination="BYZ-38-t0r" kind="modal" id="Ipt-A0-EwF"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="aje-Ad-KL1" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-620.28985507246387" y="111.83035714285714"/> + </scene> + </scenes> +</document> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Info.plist b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Info.plist new file mode 100644 index 0000000..fd4e93e --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/Info.plist @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>$(MARKETING_VERSION)</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSCameraUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄧ浉鏈�"</string> + <key>NSMicrophoneUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄩ害鍏嬮"</string> + <key>NSPhotoLibraryUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄧ浉鍐�"</string> + <key>UIApplicationSceneManifest</key> + <dict> + <key>UIApplicationSupportsMultipleScenes</key> + <false/> + <key>UISceneConfigurations</key> + <dict> + <key>UIWindowSceneSessionRoleApplication</key> + <array> + <dict> + <key>UISceneConfigurationName</key> + <string>Default Configuration</string> + <key>UISceneDelegateClassName</key> + <string>SceneDelegate</string> + <key>UISceneStoryboardFile</key> + <string>Main</string> + </dict> + </array> + </dict> + </dict> + <key>UILaunchStoryboardName</key> + <string>Main</string> + <key>UIMainStoryboardFile</key> + <string>Main</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>armv7</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.h new file mode 100644 index 0000000..41b4557 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.h @@ -0,0 +1,16 @@ +// +// SceneDelegate.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface SceneDelegate : UIResponder <UIWindowSceneDelegate> + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.m new file mode 100644 index 0000000..d6698dd --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/SceneDelegate.m @@ -0,0 +1,50 @@ +#import "SceneDelegate.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)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). +} + + +- (void)sceneDidDisconnect:(UIScene *)scene { + // 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). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // 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. +} + + +- (void)sceneWillResignActive:(UIScene *)scene { + // 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). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // 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. +} + + +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.h new file mode 100755 index 0000000..15a25d4 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.h @@ -0,0 +1,23 @@ +// +// ViewController.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface ViewController : UIViewController + + +@end + +/* +[2019.12.12 15:56:16.217#40455][SendCustomData](/Users/maygion/corelooper/projects.oem/libvideophone/src/phone/phoneconnect.cpp:942) +###Warning[2019.12.12 15:56:16.217#40455][recv custom data=[{"command":"open","room_id":1234,"devType":7,"status":1}]](/Users/maygion/corelooper/projects.oem/libvideophone/src/phone/phoneconnect.cpp:1121) +2019-12-12 15:56:16.218004+0800 ESVideoPhoneSDKDemo[1724:882637] -[ESVideoPhone onPhoneEvent_UI:],msg=event=EVT_RECV_CUSTOM_DATA + +data=eyJjb21tYW5kIjoib3BlbiIsInJvb21faWQiOjEyMzQsImRldlR5cGUiOjcsInN0YXR1cyI6MX0= +2019-12-12 15:56:16.218201+0800 ESVideoPhoneSDKDemo[1724:882637] 浜嬩欢EVT_RECV_CUSTOM_DATA +*/ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm new file mode 100644 index 0000000..8a46522 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/ViewController.mm @@ -0,0 +1,568 @@ +// +// ViewController.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +/* + 鈿狅笍 + 1銆佺紪璇戣缃�, + BuildSettings璁剧疆 锛� + Enable Bitcode 璁剧疆涓篘O锛� + Other Linker Flags 璁剧疆涓�-Wl,-all_load銆� + 2銆乫ramework + 娣诲姞绯荤粺搴� libiconv2.4.0.tbd,libz.tbd,libbz2.tbd. + 3銆乨emo浠呭仛鍙傝�冿紝鍏蜂綋璇锋牴鎹瓵pp鐨勬儏鍐甸�傛椂璋冪敤 + */ +#import <AVFoundation/AVFoundation.h> +#import "ViewController.h" +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "AudioSessionHelper.h" + +@interface ViewController ()<ESVideoPhoneDelegate,UITextFieldDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 +@property (weak, nonatomic) IBOutlet UIButton *speakerBtn; +@property (weak, nonatomic) IBOutlet UITextField *uIDTextField; +@property (weak, nonatomic) IBOutlet UIButton *mCallOrAccept; +@property (weak, nonatomic) IBOutlet UIButton *monitorBtn; + +@end + +@implementation ViewController +{ + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; + + +} +- (void)viewDidLoad { + [super viewDidLoad]; + + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + _es.isInterrupt = NO; + isBackGround = NO; + [_speakerBtn setTitle:@"鍚瓛" forState:UIControlStateNormal]; +// _mCallOrAccept.enabled = NO; +// _monitorBtn.enabled = NO; +// _uIDTextField.text = @"JJY000016YWECG";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID + _uIDTextField.text = @"JJY000017XLUXX";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID +// _uIDTextField.text = @"JJY000016YWECG";//@"JJY000016YWECG" 榛樿闂ㄥ彛鏈虹殑ID + + _uIDTextField.delegate = self; //鈿狅笍杩欓噷蹇呴』瑕佹鏌ユ槸鍚﹀凡缁忔巿鏉冨惁鍒欎細澶辫触锛屽垵濮嬪寲瑙嗛闊抽閲囬泦 + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImage:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(10, 100, self.view.frame.size.width-20, (self.view.frame.size.width-20)/4*3) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + [self.view addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; +} + +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert +//娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + [_es onStopCapture]; + [_es stopTalk]; +} +-(void)dealloc{ + NSLog(@"==============dealloc1"); + [[NSNotificationCenter defaultCenter] removeObserver:self]; + NSLog(@"==============dealloc2"); + [_es freeSubClass]; + NSLog(@"==============dealloc3"); +} + +#pragma mark ButtonAction +- (IBAction)back:(id)sender { + [self dismissViewControllerAnimated:YES completion:NULL]; + +} +//鍙嶅懠锛氭ā鎷熼棬鍙f満鍛煎彨鎵嬫満锛岄渶瑕侀棬鍙f満鍏堢偣鍛煎彨锛岀瓑1-2S鍚庯紝鎵嬫満鐐瑰弽鍛笺�� +//params鏍锋湰 address=192.168.1.3:8554,tag=mobile://123, +- (IBAction)onReverseCall:(id)sender { + NSString *title = [sender titleForState:UIControlStateNormal]; + if ([title isEqualToString:@"鍙嶅懠"]) { + NSString *normalStr = _uIDTextField.text; + NSString *param = [NSString stringWithFormat:@"address=%@,tag=mobile://123,",normalStr]; + NSLog(@"============鐐瑰弽鍛�%@", param); + [_es onReverseCall:param]; + }else if([title isEqualToString:@"鎺ュ惉"]){ + [_es onAccept]; + } + +} +- (IBAction)onHangup:(id)sender { + [_es onHangup]; +} +- (IBAction)onMonitor:(id)sender { + [_es onMonitor:_uIDTextField.text]; +} +- (IBAction)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + if (sender == nil) { + result = [_sessionHelper speaker:NO]; + }else{ + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + } + if (result) { + [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } + +} + +- (IBAction)openDoor:(id)sender { + [_es openTheDoorWithRoomid: 1234]; +} +- (IBAction)onSnap:(id)sender { + [_es onSnap]; +} +//鈿狅笍 鏂囨湰杈撳叆妗� + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ +// NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + + + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + if([[_speakerBtn titleForState:UIControlStateNormal] isEqualToString:@"鍏嶆彁"]){ + [self speaker:nil]; + }else{ + [self speaker:_speakerBtn]; + } + + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + +#pragma mark --privita 杈呭姪 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ + [self.view endEditing:YES]; +} +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + if(textField.returnKeyType == UIReturnKeyDone){ + [textField resignFirstResponder];//閿洏鏀惰捣 + return NO; + } + return YES; +} +- (void)keyboardWillChangeFrame:(NSNotification *)notification { + NSValue *notiValue =notification.userInfo[@"UIKeyboardFrameEndUserInfoKey"]; + if(notiValue){ + CGRect rect = [notiValue CGRectValue]; + [UIView animateWithDuration:0.5 animations:^{ + + if (self.view.frame.origin.y < 0) { + //宸茬粡涓婄Щ鍔ㄤ竴娆′簡锛屽氨涓嶇敤绉诲姩浜� + if (self.view.frame.origin.y == 0){ + CGFloat yFloat = self.view.frame.origin.y; + self.view.frame = CGRectMake(self.view.frame.origin.x, yFloat+50, self.view.frame.size.width, self.view.frame.size.height); + } + } + if (rect.origin.y == [UIScreen mainScreen].bounds.size.height) { //閿洏灏嗚鏀惰捣 + self.view.frame = CGRectMake(self.view.frame.origin.x, 0, self.view.frame.size.width, self.view.frame.size.height); + } + } completion:nil]; + } +} + +- (void)saveImage:(UIImage *)image { + NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); + + + NSString *filePath = [[paths objectAtIndex:0]stringByAppendingPathComponent: + [NSString stringWithFormat:@"demo.png"]]; // 淇濆瓨鏂囦欢鐨勫悕绉� + + BOOL result =[UIImagePNGRepresentation(image)writeToFile:filePath atomically:YES]; // 淇濆瓨鎴愬姛浼氳繑鍥瀁ES + if (result == YES) { + NSLog(@"淇濆瓨鎴愬姛"); + } + +} + +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/main.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/main.m new file mode 100644 index 0000000..c4763ae --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemo/main.m @@ -0,0 +1,19 @@ +// +// main.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m new file mode 100644 index 0000000..97a51c7 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m @@ -0,0 +1,37 @@ +// +// ESVideoPhoneSDKDemoTests.m +// ESVideoPhoneSDKDemoTests +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <XCTest/XCTest.h> + +@interface ESVideoPhoneSDKDemoTests : XCTestCase + +@end + +@implementation ESVideoPhoneSDKDemoTests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/Info.plist b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoTests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m new file mode 100644 index 0000000..baa643c --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m @@ -0,0 +1,48 @@ +// +// ESVideoPhoneSDKDemoUITests.m +// ESVideoPhoneSDKDemoUITests +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <XCTest/XCTest.h> + +@interface ESVideoPhoneSDKDemoUITests : XCTestCase + +@end + +@implementation ESVideoPhoneSDKDemoUITests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + self.continueAfterFailure = NO; + + // In UI tests it鈥檚 important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // UI tests must launch the application that they test. + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testLaunchPerformance { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + // This measures how long it takes to launch your application. + [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{ + [[[XCUIApplication alloc] init] launch]; + }]; + } +} + +@end diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/Info.plist b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDKDemoUITests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/ESVideoPhoneSDk b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/ESVideoPhoneSDk new file mode 100644 index 0000000..b4e6dac --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/ESVideoPhoneSDk Binary files differ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESError.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESError.h new file mode 100644 index 0000000..1cda4f1 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESError.h @@ -0,0 +1,76 @@ +// +// ESError.h +// ESVideoPhoneSDk +// +// Created by eTouchSky on 2019/12/14. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// +// ESVideoPhone鐨凟SVideoPhoneDelegate鏂规硶鈥�- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype鈥� 涓璭rrortype鐨勭被鍨� + + +#import <Foundation/Foundation.h> +//瑙嗛閲囬泦锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +//App闇�瑕佸鐞� LMPVideoCaptureErrorGetDevice涓嶭MPVideoCaptureErrorNotAuthorized 绫诲瀷鐨勯敊璇� +typedef NS_ENUM (NSUInteger, LMPVideoCaptureError){ + LMPVideoCaptureErrorGetDevice = 0,//鑾峰彇鎽勫儚澶村け璐� + LMPVideoCaptureErrorGetInput = 1,//鑾峰彇瑙嗛杈撳叆閿欒,浠巈rror涓幏鍙栧叿浣撲俊鎭� + LMPVideoCaptureErrorAddInput = 2,//AddInputVideo閿欒 + LMPVideoCaptureErrorAddOutput = 3,//AddOutputVideo閿欒 + LMPVideoCaptureErrorNotAuthorized = 4,//娌℃湁鎺堟潈锛屾巿鏉冨鐞嗙敱App瀹炵幇 + LMPVideoCaptureErrorSetSessionPreset = 5,//SetSessionPreset澶辫触 +}; +//openGl瑙嗛娓叉煋锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPOpenglError){ + LMPOpenglErrorSetCurrentContext = 0,//EAGLContext涓婁笅鏂囧垱寤哄け璐� + LMPOpenglErrorRenderbuffer = 1,//OpenGL attach娓叉煋缂撳啿鍖哄け璐� + LMPOpenglErrorGenTextures = 2,//OpenGL 绾圭悊鍒涘缓澶辫触 + LMPOpenglErrorShaderConnection = 3,//OpenGL 鐫�鑹插櫒杩炴帴澶辫触 + LMPOpenglErrorLoadShader = 4,//OpenGL 鍔犺浇鐫�鑹插櫒澶辫触 + LMPOpenglErrorShaderCompilation = 5,//OpenGL 鐫�鑹插櫒缂栬瘧澶辫触 +}; +/**瑙嗛瑙g爜锛屼細瀵艰嚧App鐪嬩笉鍒伴棬鍙f満鐨勮棰� +debug妯″紡涓嬶紝鏂偣鍙兘瀵艰嚧鍑虹幇LMPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇� +鍓嶅彴鍚庡垏鎹紝鏉ョ數绛夊師鍥犵殑涓柇鍙兘浼氬嚭鐜癓MPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇紙宸茬粡淇锛屾敞鎰忔祴璇曡繃绋嬩腑鏄惁杩樹細鍑虹幇锛� +*/ +typedef NS_ENUM (NSUInteger, LMPH264HwDecoderError){ + LMPH264HwDecoderErrorInitH264HardwareDecoder = 0,//InitH264HardwareDecoderErr + LMPH264HwDecoderErrorKVTVideoDecoderMalfunction = 1,//kVTVideoDecoderMalfunctionErr + LMPH264HwDecoderErrorKVTInvalidSessionErr = 2,//kVTInvalidSessionErr + LMPH264HwDecoderErrorKVTVideoDecoderBadDataErr = 3,//kVTVideoDecoderBadDataErr + LMPH264HwDecoderErrorDecodeOtherErr = 4,//纭В鐮佸叾浠栭敊璇� + LMPH264HwDecoderErrorCVPixelBufferRefPlantErr = 5,//CVPixelBufferRef涓暟鎹负绌� + LMPH264HwDecoderErrorCVPixelBufferRefYUVErr = 6,//CVPixelBufferRef涓彇鍑篩UV澶辫触 +}; +//瑙嗛缂栫爜锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPH264EncoderError){ + LMPH264EncoderErrorVTCompressionSessionCreate = 0,//VTCompressionSessionCreateErr + LMPH264EncoderErrorVideoCompressonOutputCallback = 1,//缂栫爜鍥炶皟澶辫触 +}; +//闊抽閲囬泦锛屼細瀵艰嚧涓嶈兘閲囬泦闊抽锛屽鏂瑰惉涓嶅埌App鐨勫0闊筹紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄惉涓嶅埌App鐨勫0闊崇殑锛� +typedef NS_ENUM (NSUInteger, LMPAudioCaptureError){ + LMPAudioCaptureErrorGetNew = 0,//AudioComponentInstanceNew澶辫触 + LMPAudioCaptureErrorStreamFormat = 1,//kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioCaptureErrorEnableRecord = 2,//鎵撳紑褰曢煶澶辫触 + LMPAudioCaptureErrorEnablePlay = 3,//鍏抽棴鎾斁澶辫触 + LMPAudioCaptureErrorSetInputCallback = 4,//AudioUnitSetCallback澶辫触 + LMPAudioCaptureErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioCaptureErrorBypassVoiceProcessing = 6,//鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioCaptureErrorAudioUnitInitialize = 7,//AudioUnitInitialize澶辫触 +}; +//闊抽鎾斁锛屼細瀵艰嚧涓嶈兘鎾斁闊抽锛屽惉涓嶅埌瀵规柟鐨勫0闊� +typedef NS_ENUM (NSUInteger, LMPAudioPlayError){ + LMPAudioPlayErrorGetNew = 0,//AudioPlay_AudioComponentInstanceNew澶辫触 + LMPAudioPlayErrorStreamFormat = 1,//AudioPlay_kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioPlayErrorEnableRecord = 2,//AudioPlay_鍏抽棴褰曢煶澶辫触 + LMPAudioPlayErrorEnablePlay = 3,//AudioPlay_鎵撳紑鎾斁澶辫触 + LMPAudioPlayErrorSetRenderCallback = 4,//AudioPlay_AudioUnitSetRenderCallback澶辫触 + LMPAudioPlayErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioPlayErrorBypassVoiceProcessing = 6,//AudioPlay_鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioPlayErrorAudioUnitInitialize = 7,//AudioPlay_AudioUnitInitialize澶辫触 +}; + +@interface ESError : NSObject + +@end + + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h new file mode 100644 index 0000000..11f1d89 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -0,0 +1,83 @@ + +// ESVideoPhone.h +// VideoPhone +// +// Created by maygion on 2019/3/26. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +typedef void (^ImageCallback)(UIImage *image); + +@protocol ESVideoPhoneDelegate <NSObject> +- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype; +- (void)getPhoneEvent_UI:(NSString*)phoneEvent; +@end + +@interface ESVideoPhone : NSObject + +//閿欒淇℃伅 +@property(nonatomic,weak) id<ESVideoPhoneDelegate> delegate; +////鑾峰彇瑙嗛鎴浘鐨刡lock +//@property(nonatomic,copy) ImageCallback snapImageCallback; +//瑙嗛鏄剧ず鐨刅iew 鈿狅笍璇峰仛闈炵┖鍒ゆ柇 +@property(nonatomic,strong,readonly) UIView* showView; +//涓柇璁剧疆 +@property (nonatomic,assign,readwrite) BOOL isInterrupt; + +/** +* ESVideoPhone 鍒濆鍖栨柟娉� +* +* @param frame 鐢熸垚鏄剧ず瑙嗛鐨凜GRect +* @param delegate ESVideoPhoneDelegate浠g悊 +* @paramimagecallBack 鑾峰彇瑙嗛鎴浘鐨刡lock +* +* @return ESVideoPhone 瀹炰緥,杩斿洖nil琛ㄧず鍒濆鍖栧け璐ャ�� +*/ +- (instancetype)initESVideoPhoneWithFrame:(CGRect)frame delegate: (id<ESVideoPhoneDelegate>)del imagecallBack:(ImageCallback)callBack; +//鎺堟潈鍚庢墦寮�闊抽閲囬泦锛岃棰戞病鏈夋潈闄愪篃鍙互鍙煶棰戦�氳瘽 +-(BOOL)initAudioCaptureSession; +//鈿狅笍鎺堟潈鍚庢墦寮�瑙嗛閲囬泦锛岄煶棰戞病鏈夋潈闄愬缓璁笉瑕佸彂璧烽�氳瘽 +-(BOOL)initVideoCaptureSession; +/** +* 鐩戞帶 +* +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庡悗鍙版媺鍙栵紙涓�鑸槸涓暟缁勫叾涓寘鍚鐢ㄦ埛鏉冮檺鎷ユ湁鐨勬墍鏈夐棬鍙f満锛� +*/ +- (void)onMonitor:(NSString *)deviceId; +/** +* 鎺ュ惉 +* 杩欎釜鏂规硶浼氬湪AppDelegate鐨勯�氱煡鎺ュ彛涓皟鐢紝閲囩敤灏忕背鎺ㄩ�� +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庨�氱煡涓幏鍙栫敱璁惧ID涓庡崟娆¢�氳瘽tag鎷兼垚锛堝彲鑳戒細鏈夊彉鍔級 +*/ +- (void)onReverseCall:(NSString *)deviceId; +//鎺ュ惉 +- (void)onAccept; +//鎸傛柇 +- (void)onHangup; +//鎵撳紑闊抽閲囬泦涓庨煶棰戞挱鏀� +-(void)startTalk; +//鍏抽棴闊抽閲囬泦涓庨煶棰戞挱鏀� +- (void)stopTalk; +//鑾峰彇瑙嗛鎴浘 +- (void)onSnap; +//鎵撳紑瑙嗛閲囬泦 +- (void)onStartCapture; +//鍏抽棴瑙嗛閲囬泦 +- (void)onStopCapture; +/** +* 寮�闂紝缁撴灉鍦‥SVideoPhoneDelegate 鏂规硶涓繑鍥� +* +* @param roomId 浣忔埛鐨剅oomid锛� +*/ +-(void)openTheDoorWithRoomid: (int)roomId; +//閲婃斁璧勬簮锛坉elegate閲婃斁绛夛級 +-(void)freeSubClass; +@end + + + + + diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Info.plist b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Info.plist new file mode 100644 index 0000000..a2ebd3b --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/Info.plist Binary files differ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory new file mode 100644 index 0000000..66da18c --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory Binary files differ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements new file mode 100644 index 0000000..4a29992 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements Binary files differ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 new file mode 100644 index 0000000..6c9adc7 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 Binary files differ diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..94318a3 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>files</key> + <dict> + <key>.DS_Store</key> + <data> + Y/zzZVahlzqsXsKRy9ythZX/tmM= + </data> + <key>Headers/ESError.h</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>Headers/ESVideoPhone.h</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>Info.plist</key> + <data> + YgFQhxxTQ5/xhKsrQd4C5NGn22w= + </data> + </dict> + <key>files2</key> + <dict> + <key>Headers/ESError.h</key> + <dict> + <key>hash</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>hash2</key> + <data> + y8ReVa9YaZ6fyPjy8EeTl3jbaUadZUYVC0IdLJ/HrgM= + </data> + </dict> + <key>Headers/ESVideoPhone.h</key> + <dict> + <key>hash</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>hash2</key> + <data> + MboPVH5djlpgR//Z7UcRBMEeaakW6FWQbZxlkx4KzaM= + </data> + </dict> + </dict> + <key>rules</key> + <dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^version.plist$</key> + <true/> + </dict> + <key>rules2</key> + <dict> + <key>.*\.dSYM($|/)</key> + <dict> + <key>weight</key> + <real>11</real> + </dict> + <key>^(.*/)?\.DS_Store$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>2000</real> + </dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^Info\.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^PkgInfo$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^embedded\.provisionprofile$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + <key>^version\.plist$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + </dict> +</dict> +</plist> diff --git a/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature new file mode 100644 index 0000000..7d20839 --- /dev/null +++ b/ESVideoPhoneSDKDemo1.2/ESVideoPhoneSDKDemo/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..8a6b087 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.pbxproj @@ -0,0 +1,692 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + B919F6602490EEA1007261A9 /* ESvideoVideoIntercomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B919F6592490EEA1007261A9 /* ESvideoVideoIntercomViewController.m */; }; + B919F6612490EEA1007261A9 /* OpenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B919F65A2490EEA1007261A9 /* OpenViewController.m */; }; + B919F6622490EEA1007261A9 /* ESVideoMonitorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */; }; + B924481124934E6A00F118F1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B924481024934E6A00F118F1 /* AudioToolbox.framework */; }; + B9D0814024912E9800EBD71F /* CBToast.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D0813F24912E9800EBD71F /* CBToast.m */; }; + B9D081432491D78B00EBD71F /* ESVideoSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D081422491D78B00EBD71F /* ESVideoSDK.m */; }; + C3385925233DAF06006940C3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385924233DAF06006940C3 /* AppDelegate.m */; }; + C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385927233DAF06006940C3 /* SceneDelegate.m */; }; + C338592B233DAF06006940C3 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C338592A233DAF06006940C3 /* ViewController.mm */; }; + C338592E233DAF06006940C3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C338592C233DAF06006940C3 /* Main.storyboard */; }; + C3385930233DAF12006940C3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C338592F233DAF12006940C3 /* Assets.xcassets */; }; + C3385933233DAF12006940C3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3385931233DAF12006940C3 /* LaunchScreen.storyboard */; }; + C3385936233DAF12006940C3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3385935233DAF12006940C3 /* main.m */; }; + C3385940233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */; }; + C338594B233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */; }; + C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = C345D08A233EEE520079C82C /* AudioSessionHelper.m */; }; + C3EBF9E823A72BCE00B62DDD /* ESVideoPhoneSDk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */; }; + C3F59377233E0717009F09E5 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F59376233E0717009F09E5 /* libbz2.tbd */; }; + C3F59379233E0723009F09E5 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F59378233E0723009F09E5 /* libz.tbd */; }; + C3F5937B233E0745009F09E5 /* libiconv.2.4.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C338593C233DAF12006940C3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3385918233DAF06006940C3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C338591F233DAF06006940C3; + remoteInfo = ESVideoPhoneSDKDemo; + }; + C3385947233DAF13006940C3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3385918233DAF06006940C3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C338591F233DAF06006940C3; + remoteInfo = ESVideoPhoneSDKDemo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + B919F6592490EEA1007261A9 /* ESvideoVideoIntercomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ESvideoVideoIntercomViewController.m; path = ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m; sourceTree = SOURCE_ROOT; }; + B919F65A2490EEA1007261A9 /* OpenViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OpenViewController.m; path = ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m; sourceTree = SOURCE_ROOT; }; + B919F65B2490EEA1007261A9 /* ESVideoMonitorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESVideoMonitorViewController.h; path = ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.h; sourceTree = SOURCE_ROOT; }; + B919F65C2490EEA1007261A9 /* OpenViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenViewController.h; path = ESVideoPhoneSDKDemo/ZigBee/OpenViewController.h; sourceTree = SOURCE_ROOT; }; + B919F65D2490EEA1007261A9 /* ESvideoVideoIntercomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESvideoVideoIntercomViewController.h; path = ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.h; sourceTree = SOURCE_ROOT; }; + B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ESVideoMonitorViewController.m; path = ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m; sourceTree = SOURCE_ROOT; }; + B919F65F2490EEA1007261A9 /* GDHDLUtlis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GDHDLUtlis.h; path = ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h; sourceTree = SOURCE_ROOT; }; + B924481024934E6A00F118F1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + B9D0813E24912E9800EBD71F /* CBToast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBToast.h; sourceTree = "<group>"; }; + B9D0813F24912E9800EBD71F /* CBToast.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CBToast.m; sourceTree = "<group>"; }; + B9D081412491D78A00EBD71F /* ESVideoSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ESVideoSDK.h; sourceTree = "<group>"; }; + B9D081422491D78B00EBD71F /* ESVideoSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoSDK.m; sourceTree = "<group>"; }; + C3385920233DAF06006940C3 /* HDLZigBeeESVideoDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HDLZigBeeESVideoDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C3385923233DAF06006940C3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; + C3385924233DAF06006940C3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; + C3385926233DAF06006940C3 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; }; + C3385927233DAF06006940C3 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; }; + C3385929233DAF06006940C3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; + C338592A233DAF06006940C3 /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = "<group>"; }; + C338592D233DAF06006940C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + C338592F233DAF12006940C3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + C3385932233DAF12006940C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + C3385934233DAF12006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C3385935233DAF12006940C3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESVideoPhoneSDKDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoPhoneSDKDemoTests.m; sourceTree = "<group>"; }; + C3385941233DAF12006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ESVideoPhoneSDKDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ESVideoPhoneSDKDemoUITests.m; sourceTree = "<group>"; }; + C338594C233DAF13006940C3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C345D089233EEE510079C82C /* AudioSessionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSessionHelper.h; sourceTree = "<group>"; }; + C345D08A233EEE520079C82C /* AudioSessionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioSessionHelper.m; sourceTree = "<group>"; }; + C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ESVideoPhoneSDk.framework; sourceTree = "<group>"; }; + C3F59376233E0717009F09E5 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; }; + C3F59378233E0723009F09E5 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.4.0.tbd; path = usr/lib/libiconv.2.4.0.tbd; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C338591D233DAF06006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3EBF9E823A72BCE00B62DDD /* ESVideoPhoneSDk.framework in Frameworks */, + C3F5937B233E0745009F09E5 /* libiconv.2.4.0.tbd in Frameworks */, + B924481124934E6A00F118F1 /* AudioToolbox.framework in Frameworks */, + C3F59379233E0723009F09E5 /* libz.tbd in Frameworks */, + C3F59377233E0717009F09E5 /* libbz2.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385938233DAF12006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385943233DAF13006940C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B919F6582490EE7A007261A9 /* HDL */ = { + isa = PBXGroup; + children = ( + B919F65B2490EEA1007261A9 /* ESVideoMonitorViewController.h */, + B919F65E2490EEA1007261A9 /* ESVideoMonitorViewController.m */, + B919F65D2490EEA1007261A9 /* ESvideoVideoIntercomViewController.h */, + B919F6592490EEA1007261A9 /* ESvideoVideoIntercomViewController.m */, + B919F65F2490EEA1007261A9 /* GDHDLUtlis.h */, + B919F65C2490EEA1007261A9 /* OpenViewController.h */, + B919F65A2490EEA1007261A9 /* OpenViewController.m */, + B9D0813E24912E9800EBD71F /* CBToast.h */, + B9D0813F24912E9800EBD71F /* CBToast.m */, + B9D081412491D78A00EBD71F /* ESVideoSDK.h */, + B9D081422491D78B00EBD71F /* ESVideoSDK.m */, + ); + path = HDL; + sourceTree = "<group>"; + }; + C3385917233DAF06006940C3 = { + isa = PBXGroup; + children = ( + C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */, + C338593E233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */, + C3385949233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */, + C3385921233DAF06006940C3 /* Products */, + C3E915CA233DFE4C00F77354 /* Frameworks */, + ); + sourceTree = "<group>"; + }; + C3385921233DAF06006940C3 /* Products */ = { + isa = PBXGroup; + children = ( + C3385920233DAF06006940C3 /* HDLZigBeeESVideoDemo.app */, + C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */, + C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */, + ); + name = Products; + sourceTree = "<group>"; + }; + C3385922233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { + isa = PBXGroup; + children = ( + B919F6582490EE7A007261A9 /* HDL */, + C3385923233DAF06006940C3 /* AppDelegate.h */, + C3385924233DAF06006940C3 /* AppDelegate.m */, + C3385926233DAF06006940C3 /* SceneDelegate.h */, + C3385927233DAF06006940C3 /* SceneDelegate.m */, + C3385929233DAF06006940C3 /* ViewController.h */, + C338592A233DAF06006940C3 /* ViewController.mm */, + C345D089233EEE510079C82C /* AudioSessionHelper.h */, + C345D08A233EEE520079C82C /* AudioSessionHelper.m */, + C338592C233DAF06006940C3 /* Main.storyboard */, + C338592F233DAF12006940C3 /* Assets.xcassets */, + C3385931233DAF12006940C3 /* LaunchScreen.storyboard */, + C3385934233DAF12006940C3 /* Info.plist */, + C3385935233DAF12006940C3 /* main.m */, + ); + path = ESVideoPhoneSDKDemo; + sourceTree = "<group>"; + }; + C338593E233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */ = { + isa = PBXGroup; + children = ( + C338593F233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m */, + C3385941233DAF12006940C3 /* Info.plist */, + ); + path = ESVideoPhoneSDKDemoTests; + sourceTree = "<group>"; + }; + C3385949233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */ = { + isa = PBXGroup; + children = ( + C338594A233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m */, + C338594C233DAF13006940C3 /* Info.plist */, + ); + path = ESVideoPhoneSDKDemoUITests; + sourceTree = "<group>"; + }; + C3E915CA233DFE4C00F77354 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B924481024934E6A00F118F1 /* AudioToolbox.framework */, + C3EBF9E723A72BCD00B62DDD /* ESVideoPhoneSDk.framework */, + C3F5937A233E0744009F09E5 /* libiconv.2.4.0.tbd */, + C3F59378233E0723009F09E5 /* libz.tbd */, + C3F59376233E0717009F09E5 /* libbz2.tbd */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = C338594F233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemo" */; + buildPhases = ( + C338591C233DAF06006940C3 /* Sources */, + C338591D233DAF06006940C3 /* Frameworks */, + C338591E233DAF06006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ESVideoPhoneSDKDemo; + productName = ESVideoPhoneSDKDemo; + productReference = C3385920233DAF06006940C3 /* HDLZigBeeESVideoDemo.app */; + productType = "com.apple.product-type.application"; + }; + C338593A233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3385952233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoTests" */; + buildPhases = ( + C3385937233DAF12006940C3 /* Sources */, + C3385938233DAF12006940C3 /* Frameworks */, + C3385939233DAF12006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C338593D233DAF12006940C3 /* PBXTargetDependency */, + ); + name = ESVideoPhoneSDKDemoTests; + productName = ESVideoPhoneSDKDemoTests; + productReference = C338593B233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + C3385945233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = C3385955233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoUITests" */; + buildPhases = ( + C3385942233DAF13006940C3 /* Sources */, + C3385943233DAF13006940C3 /* Frameworks */, + C3385944233DAF13006940C3 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C3385948233DAF13006940C3 /* PBXTargetDependency */, + ); + name = ESVideoPhoneSDKDemoUITests; + productName = ESVideoPhoneSDKDemoUITests; + productReference = C3385946233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C3385918233DAF06006940C3 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = eTouchSky; + TargetAttributes = { + C338591F233DAF06006940C3 = { + CreatedOnToolsVersion = 11.0; + }; + C338593A233DAF12006940C3 = { + CreatedOnToolsVersion = 11.0; + TestTargetID = C338591F233DAF06006940C3; + }; + C3385945233DAF13006940C3 = { + CreatedOnToolsVersion = 11.0; + TestTargetID = C338591F233DAF06006940C3; + }; + }; + }; + buildConfigurationList = C338591B233DAF06006940C3 /* Build configuration list for PBXProject "ESVideoPhoneSDKDemo" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C3385917233DAF06006940C3; + productRefGroup = C3385921233DAF06006940C3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */, + C338593A233DAF12006940C3 /* ESVideoPhoneSDKDemoTests */, + C3385945233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C338591E233DAF06006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3385933233DAF12006940C3 /* LaunchScreen.storyboard in Resources */, + C3385930233DAF12006940C3 /* Assets.xcassets in Resources */, + C338592E233DAF06006940C3 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385939233DAF12006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385944233DAF13006940C3 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C338591C233DAF06006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B919F6612490EEA1007261A9 /* OpenViewController.m in Sources */, + C338592B233DAF06006940C3 /* ViewController.mm in Sources */, + B9D081432491D78B00EBD71F /* ESVideoSDK.m in Sources */, + C3385925233DAF06006940C3 /* AppDelegate.m in Sources */, + B9D0814024912E9800EBD71F /* CBToast.m in Sources */, + C345D08B233EEE520079C82C /* AudioSessionHelper.m in Sources */, + B919F6602490EEA1007261A9 /* ESvideoVideoIntercomViewController.m in Sources */, + C3385936233DAF12006940C3 /* main.m in Sources */, + C3385928233DAF06006940C3 /* SceneDelegate.m in Sources */, + B919F6622490EEA1007261A9 /* ESVideoMonitorViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385937233DAF12006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3385940233DAF12006940C3 /* ESVideoPhoneSDKDemoTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C3385942233DAF13006940C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C338594B233DAF13006940C3 /* ESVideoPhoneSDKDemoUITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + C338593D233DAF12006940C3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */; + targetProxy = C338593C233DAF12006940C3 /* PBXContainerItemProxy */; + }; + C3385948233DAF13006940C3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C338591F233DAF06006940C3 /* ESVideoPhoneSDKDemo */; + targetProxy = C3385947233DAF13006940C3 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + C338592C233DAF06006940C3 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C338592D233DAF06006940C3 /* Base */, + ); + name = Main.storyboard; + sourceTree = "<group>"; + }; + C3385931233DAF12006940C3 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3385932233DAF12006940C3 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C338594D233DAF13006940C3 /* 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_BITCODE = NO; + 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 = 12.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-Wl,-all_load"; + SDKROOT = iphoneos; + VALID_ARCHS = "arm64 arm64e"; + }; + name = Debug; + }; + C338594E233DAF13006940C3 /* 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_BITCODE = NO; + 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 = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = "-Wl,-all_load"; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "arm64 arm64e"; + }; + name = Release; + }; + C3385950233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = BVTA78PRYA; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ESVideoPhoneSDKDemo", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = ESVideoPhoneSDKDemo/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MARKETING_VERSION = 1.2; + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_BUNDLE_IDENTIFIER = com.hdl.ESVideoPhoneSDKDemo; + PRODUCT_NAME = HDLZigBeeESVideoDemo; + PROVISIONING_PROFILE_SPECIFIER = Test; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + C3385951233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = BVTA78PRYA; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/ESVideoPhoneSDKDemo", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = ESVideoPhoneSDKDemo/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + MARKETING_VERSION = 1.2; + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_BUNDLE_IDENTIFIER = com.hdl.ESVideoPhoneSDKDemo; + PRODUCT_NAME = HDLZigBeeESVideoDemo; + PROVISIONING_PROFILE_SPECIFIER = Test; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + C3385953233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESVideoPhoneSDKDemo.app/ESVideoPhoneSDKDemo"; + }; + name = Debug; + }; + C3385954233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESVideoPhoneSDKDemo.app/ESVideoPhoneSDKDemo"; + }; + name = Release; + }; + C3385956233DAF13006940C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = ESVideoPhoneSDKDemo; + }; + name = Debug; + }; + C3385957233DAF13006940C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 754E2P9CSA; + INFOPLIST_FILE = ESVideoPhoneSDKDemoUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = eTouchSky.ESVideoPhoneSDKDemoUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = ESVideoPhoneSDKDemo; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C338591B233DAF06006940C3 /* Build configuration list for PBXProject "ESVideoPhoneSDKDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C338594D233DAF13006940C3 /* Debug */, + C338594E233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C338594F233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385950233DAF13006940C3 /* Debug */, + C3385951233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C3385952233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385953233DAF13006940C3 /* Debug */, + C3385954233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C3385955233DAF13006940C3 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKDemoUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C3385956233DAF13006940C3 /* Debug */, + C3385957233DAF13006940C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C3385918233DAF06006940C3 /* Project object */; +} diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..77c97cf --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:ESVideoPhoneSDKDemo.xcodeproj"> + </FileRef> +</Workspace> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.h new file mode 100644 index 0000000..4ed4dc0 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface AppDelegate : UIResponder <UIApplicationDelegate> +@property (strong, nonatomic) UIWindow *window; + +@end + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.m new file mode 100644 index 0000000..4f61f66 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AppDelegate.m @@ -0,0 +1,51 @@ +// +// AppDelegate.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import "AppDelegate.h" +#import "OpenViewController.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + + OpenViewController *mainVC = [[OpenViewController alloc] init]; + + UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mainVC]; + + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.window.rootViewController = nav; + [self.window makeKeyAndVisible]; + + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0)) API_AVAILABLE(ios(13.0)) API_AVAILABLE(ios(13.0)){ + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions API_AVAILABLE(ios(13.0)){ + // 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. +} + + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/Contents.json new file mode 100644 index 0000000..520186a --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_answer.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/ic_esvideo_answer.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/ic_esvideo_answer.png new file mode 100644 index 0000000..0e1ed8a --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_answer.imageset/ic_esvideo_answer.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/Contents.json new file mode 100644 index 0000000..62d77bf --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_back.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/ic_esvideo_back.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/ic_esvideo_back.png new file mode 100644 index 0000000..798d1d8 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_back.imageset/ic_esvideo_back.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/Contents.json new file mode 100644 index 0000000..f757b64 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_collect_select.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/ic_esvideo_collect_select.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/ic_esvideo_collect_select.png new file mode 100644 index 0000000..d0c461a --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_select.imageset/ic_esvideo_collect_select.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/Contents.json new file mode 100644 index 0000000..0195a81 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_collect_unselect.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/ic_esvideo_collect_unselect.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/ic_esvideo_collect_unselect.png new file mode 100644 index 0000000..d882547 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_collect_unselect.imageset/ic_esvideo_collect_unselect.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/Contents.json new file mode 100644 index 0000000..e683f15 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_hangup.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/ic_esvideo_hangup.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/ic_esvideo_hangup.png new file mode 100644 index 0000000..6630e1a --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_hangup.imageset/ic_esvideo_hangup.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/Contents.json new file mode 100644 index 0000000..3422647 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_home.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/ic_esvideo_home.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/ic_esvideo_home.png new file mode 100644 index 0000000..00b8028 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_home.imageset/ic_esvideo_home.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/Contents.json new file mode 100644 index 0000000..cfdc3b0 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_more.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/ic_esvideo_more.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/ic_esvideo_more.png new file mode 100644 index 0000000..ce341f9 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_more.imageset/ic_esvideo_more.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/Contents.json new file mode 100644 index 0000000..d5b040a --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_takephoto_select.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/ic_esvideo_takephoto_select.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/ic_esvideo_takephoto_select.png new file mode 100644 index 0000000..7bd1c04 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_select.imageset/ic_esvideo_takephoto_select.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/Contents.json new file mode 100644 index 0000000..04353c5 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_takephoto_unselect.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/ic_esvideo_takephoto_unselect.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/ic_esvideo_takephoto_unselect.png new file mode 100644 index 0000000..be30904 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_takephoto_unselect.imageset/ic_esvideo_takephoto_unselect.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/Contents.json new file mode 100644 index 0000000..7a669e4 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_unlock_select.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/ic_esvideo_unlock_select.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/ic_esvideo_unlock_select.png new file mode 100644 index 0000000..03e20c5 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_select.imageset/ic_esvideo_unlock_select.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/Contents.json b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/Contents.json new file mode 100644 index 0000000..4fc8236 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ic_esvideo_unlock_unselect.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/ic_esvideo_unlock_unselect.png b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/ic_esvideo_unlock_unselect.png new file mode 100644 index 0000000..996941e --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Assets.xcassets/ic_esvideo_unlock_unselect.imageset/ic_esvideo_unlock_unselect.png Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.h new file mode 100644 index 0000000..39ed2c9 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.h @@ -0,0 +1,19 @@ +// +// AudioSessionHelper.h +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> + + + +@interface AudioSessionHelper : NSObject + +- (void)setAudioSession; +-(NSString *)speaker:(BOOL)isSpeaking; +@end + + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.m new file mode 100644 index 0000000..c4039cc --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/AudioSessionHelper.m @@ -0,0 +1,124 @@ +// +// AudioSessionHelper.m +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import "AudioSessionHelper.h" +#import <AVFoundation/AVFoundation.h> + +@interface AudioSessionHelper() + +@property (nonatomic,assign) BOOL speaking; + +@end + +@implementation AudioSessionHelper + +#pragma mark -- AVAudioSession鐨勮缃� +-(void)setAudioSession{ + NSError *error = nil; + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + }else{ + NSLog(@"鍚瓛鎾斁"); + } + + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + + [[AVAudioSession sharedInstance] setPreferredIOBufferDuration:0.05 error:&error]; + if (error) { + NSLog(@"AVAudioSessionSetPreferredIOBufferDuration error:%@", error); + } + + /**< 鐮佺巼璁剧疆涓嶆纭細瀵艰嚧鎾斁鍑烘潵鐨勫0闊冲彉灏栨垨鍙樺钩锛屾湁涓�鐐规嫋闊虫垨鑰呮渶鍚庝竴鐐归煶灏戜簡,8000鐨勯噰鏍风巼璁剧疆16000鐨勭爜鐜囧緢濂�>*/ + [[AVAudioSession sharedInstance] setPreferredSampleRate:16000 error:&error]; + if (error) { + NSLog(@"setPreferredSampleRate error:%@", error); + } +} + + +//蹇呴』鍏坰etActive:NO 鍐嶈缃畂ption 鍐峴etActive:YES锛� 鍚﹀垯鏈変簺绯荤粺锛屾湁浜涚暩褰紝鍦ㄥ惉绛掓ā寮忎笅涓嶈兘閲囬泦 +//杩欓噷鎵撴柇鐐规祴璇曞彲鑳戒細鎶ラ敊锛歱2p缁堢锛岃В鐮佸櫒缁堢銆� +-(NSString *)speaker:(BOOL)isSpeaking{ + + NSError *error = nil; + + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"setActive:NO error:%@", error); + } + if (isSpeaking == NO) { + //鍚瓛鎾斁 鏁堟灉寰堝ソ + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + return nil; + }else{ + NSLog(@"鍚瓛鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + [self LogAudioSessionInfo]; + + return @"鍏嶆彁"; + } + }else{ + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryOptionDefaultToSpeaker error:%@", error); + return nil; + }else{ + NSLog(@"鍏嶆彁鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + //[self LogAudioSessionInfo]; + + return @"鍚瓛"; + } + } +} + +-(void)LogAudioSessionInfo{ + AVAudioSessionCategory category = [[AVAudioSession sharedInstance] category]; + AVAudioSessionCategoryOptions option = [[AVAudioSession sharedInstance] categoryOptions]; + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + NSArray* outputArray = [AVAudioSession sharedInstance].currentRoute.outputs; + NSLog(@"%@", category); + NSLog(@"%lu", (unsigned long)option); + NSLog(@"%@", inputArray); + NSLog(@"%@", outputArray); +} + +/* +-(void)changeMicToHeadset{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortHeadsetMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +-(void)changeMicToBuiltIn{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortBuiltInMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +*/ +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..035cbad --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina4_7" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="oCk-sZ-pj6"/> + <viewControllerLayoutGuide type="bottom" id="850-qB-SUI"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Ze5-6b-2t3"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> +</document> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..0858421 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Base.lproj/Main.storyboard @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> + <device id="retina6_1" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Wzv-3T-9rg"/> + <viewControllerLayoutGuide type="bottom" id="COG-Nv-9Ga"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vJi-oZ-LSc"> + <rect key="frame" x="40" y="792" width="60" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="2Pc-3k-dUO"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="cuo-Ky-5Dv"/> + </constraints> + <state key="normal" title="鍚瓛"/> + <connections> + <action selector="speaker:" destination="BYZ-38-t0r" eventType="touchUpInside" id="W7q-iX-a2t"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jPl-Vg-g3C"> + <rect key="frame" x="120" y="792" width="60" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="3O0-xV-2Xd"/> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="XJm-Mv-gZS"/> + </constraints> + <state key="normal" title="寮�闂�"/> + <connections> + <action selector="openDoor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="QiK-iu-wu4"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mdf-GC-mIQ"> + <rect key="frame" x="200" y="792" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="Sm2-me-6Rj"/> + <constraint firstAttribute="height" constant="30" id="ln6-ba-aYV"/> + </constraints> + <state key="normal" title="鎴浘"/> + <connections> + <action selector="onSnap:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dvX-n1-L3W"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="koH-BL-KZA"> + <rect key="frame" x="40" y="742" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="JB7-ql-xzA"/> + </constraints> + <state key="normal" title="鍙嶅懠"/> + <connections> + <action selector="onReverseCall:" destination="BYZ-38-t0r" eventType="touchUpInside" id="R22-bQ-kpF"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WJI-4Z-VeA"> + <rect key="frame" x="120" y="742" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="csc-sy-eEr"/> + <constraint firstAttribute="height" constant="30" id="vza-fv-qdl"/> + </constraints> + <state key="normal" title="鎸傛柇"/> + <connections> + <action selector="onHangup:" destination="BYZ-38-t0r" eventType="touchUpInside" id="mUK-dK-0eT"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LcR-MR-y9c"> + <rect key="frame" x="200" y="742" width="60" height="30"/> + <constraints> + <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="60" id="7N3-EE-cFS"/> + <constraint firstAttribute="height" constant="30" id="go1-vo-L2j"/> + </constraints> + <state key="normal" title="鐩戞帶"/> + <connections> + <action selector="onMonitor:" destination="BYZ-38-t0r" eventType="touchUpInside" id="RcS-6u-LBX"/> + </connections> + </button> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Vfn-FR-1Ub"> + <rect key="frame" x="102" y="44" width="282" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="JFw-sW-vcm"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" returnKeyType="done"/> + </textField> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="闂ㄥ彛鏈�" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E2O-cv-ota"> + <rect key="frame" x="40" y="44" width="52" height="30"/> + <constraints> + <constraint firstAttribute="height" constant="30" id="VRD-h4-kIL"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="leading" secondItem="E2O-cv-ota" secondAttribute="trailing" constant="10" id="0RX-sz-eS9"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="17C-bm-Akt"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="1qo-7b-cDh"/> + <constraint firstAttribute="trailing" secondItem="LcR-MR-y9c" secondAttribute="trailing" constant="154" id="Ac2-pr-p5A"/> + <constraint firstItem="vJi-oZ-LSc" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="AeG-dA-Pth"/> + <constraint firstItem="vJi-oZ-LSc" firstAttribute="top" secondItem="koH-BL-KZA" secondAttribute="bottom" constant="20" id="Bgv-gv-AxZ"/> + <constraint firstItem="jPl-Vg-g3C" firstAttribute="leading" secondItem="vJi-oZ-LSc" secondAttribute="trailing" constant="20" id="F7k-hc-PjM"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="20" id="GCM-h5-uZT"/> + <constraint firstItem="E2O-cv-ota" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="HUm-Q4-lcX"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="Ifi-g7-5KM"/> + <constraint firstItem="WJI-4Z-VeA" firstAttribute="leading" secondItem="koH-BL-KZA" secondAttribute="trailing" constant="20" id="MZc-33-aQU"/> + <constraint firstAttribute="trailing" secondItem="mdf-GC-mIQ" secondAttribute="trailing" constant="154" id="Q2A-hp-SjO"/> + <constraint firstItem="LcR-MR-y9c" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="WJI-4Z-VeA" secondAttribute="trailing" symbolic="YES" id="Uor-VU-t3a"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="top" secondItem="Wzv-3T-9rg" secondAttribute="bottom" id="Wua-9B-iLw"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="baseline" secondItem="WJI-4Z-VeA" secondAttribute="baseline" id="hB6-19-6BO"/> + <constraint firstItem="Vfn-FR-1Ub" firstAttribute="leading" secondItem="E2O-cv-ota" secondAttribute="trailing" constant="10" id="hY9-F7-oE8"/> + <constraint firstItem="mdf-GC-mIQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="jPl-Vg-g3C" secondAttribute="trailing" symbolic="YES" id="hiz-Om-gmC"/> + <constraint firstAttribute="trailingMargin" secondItem="Vfn-FR-1Ub" secondAttribute="trailing" constant="10" id="nnC-yz-Mbc"/> + <constraint firstItem="mdf-GC-mIQ" firstAttribute="top" secondItem="LcR-MR-y9c" secondAttribute="bottom" constant="20" id="nyj-zh-x4K"/> + <constraint firstItem="koH-BL-KZA" firstAttribute="baseline" secondItem="LcR-MR-y9c" secondAttribute="baseline" id="uhc-hz-Lg4"/> + <constraint firstItem="COG-Nv-9Ga" firstAttribute="top" secondItem="vJi-oZ-LSc" secondAttribute="bottom" constant="40" id="w71-ij-wzw"/> + <constraint firstItem="COG-Nv-9Ga" firstAttribute="top" secondItem="jPl-Vg-g3C" secondAttribute="bottom" constant="40" id="zXK-Mn-zfv"/> + </constraints> + </view> + <connections> + <outlet property="mCallOrAccept" destination="koH-BL-KZA" id="Ryl-wC-8vS"/> + <outlet property="monitorBtn" destination="LcR-MR-y9c" id="quQ-29-c3m"/> + <outlet property="speakerBtn" destination="vJi-oZ-LSc" id="gAu-k3-y1u"/> + <outlet property="uIDTextField" destination="Vfn-FR-1Ub" id="En1-hG-ZxX"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="132" y="104"/> + </scene> + </scenes> +</document> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h new file mode 100644 index 0000000..78c2c19 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.h @@ -0,0 +1,21 @@ +// +// CBToast.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/10. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface CBToast : NSObject + +//鏄剧ず娑堟伅-->default center ++ (void)showToastAction:(NSString *)message; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m new file mode 100644 index 0000000..9767a71 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/CBToast.m @@ -0,0 +1,110 @@ +// +// CBToast.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/10. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "CBToast.h" + +@implementation CBToast + +static UILabel *toastLabel = nil; ++ (UILabel *)currentToastLabel { + @synchronized(self) { + if (toastLabel == nil) { + toastLabel = [[UILabel alloc] init]; + toastLabel.backgroundColor = [UIColor darkGrayColor]; + toastLabel.font = [UIFont systemFontOfSize:16]; + toastLabel.textColor = [UIColor whiteColor]; + toastLabel.numberOfLines = 0; + toastLabel.textAlignment = NSTextAlignmentCenter; + toastLabel.lineBreakMode = NSLineBreakByCharWrapping; + toastLabel.layer.masksToBounds = YES; + toastLabel.layer.cornerRadius = 5.0; + toastLabel.alpha = 0; + } + return toastLabel; + } +} + +//榛樿鏄剧ず娑堟伅-->center ++ (void)showToastAction:(NSString *)message +{ + [self showToast:message location:@"center" showTime:2.0]; +} + +//鏄剧ず娑堟伅 ++ (void)showToast:(NSString *)message location:(NSString *)aLocationStr showTime:(float)aShowTime +{ + if (!message) { + message = @""; + } + if ([[NSThread currentThread] isMainThread]) { + toastLabel = [self currentToastLabel]; + [toastLabel removeFromSuperview]; + UIWindow *window = [UIApplication sharedApplication].delegate.window; + [window addSubview:toastLabel]; + + CGFloat main_width = [[UIScreen mainScreen] bounds].size.width; + CGFloat main_height = [[UIScreen mainScreen] bounds].size.height; + + CGFloat width = [self stringText:message font:16 isHeightFixed:YES fixedValue:40]; + CGFloat height = 0; + if (width > main_width - 20) { + width = main_width - 20; + height = [self stringText:message font:16 isHeightFixed:NO fixedValue:width]; + }else{ + height = 40; + } + + CGRect labFrame; + if (aLocationStr && [aLocationStr isEqualToString:@"top"]) { + labFrame = CGRectMake((main_width-width)/2, main_height*0.15, width, height); + }else if (aLocationStr && [aLocationStr isEqualToString:@"bottom"]) { + labFrame = CGRectMake((main_width-width)/2, main_height*0.85, width, height); + }else{ + //default-->center + labFrame = CGRectMake((main_width-width)/2, main_height*0.5, width, height); + } + toastLabel.frame = labFrame; + toastLabel.text = message; + toastLabel.alpha = 1; + [UIView animateWithDuration:aShowTime animations:^{ + toastLabel.alpha = 0; + } completion:^(BOOL finished) { + }]; + }else{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self showToast:message location:aLocationStr showTime:aShowTime]; + }); + return; + } +} + + +//鏍规嵁瀛楃涓查暱搴﹁幏鍙栧搴旂殑瀹藉害鎴栬�呴珮搴� ++ (CGFloat)stringText:(NSString *)aText font:(CGFloat)aFont isHeightFixed:(BOOL)isHeightFixed fixedValue:(CGFloat)fixedValue +{ + CGSize size; + if (isHeightFixed) { + size = CGSizeMake(MAXFLOAT, fixedValue); + } else { + size = CGSizeMake(fixedValue, MAXFLOAT); + } + + CGSize resultSize = CGSizeZero; + if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7.0) { + //杩斿洖璁$畻鍑虹殑size + resultSize = [aText boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:aFont]} context:nil].size; + } + + if (isHeightFixed) { + return resultSize.width + 20; //澧炲姞宸﹀彸20闂撮殧 + } else { + return resultSize.height + 20; //澧炲姞涓婁笅20闂撮殧 + } +} + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h new file mode 100644 index 0000000..46057f7 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.h @@ -0,0 +1,24 @@ +// +// ESVideoSDK.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface ESVideoSDK : NSObject + +//閿欒淇℃伅 +@property(nonatomic,weak) id<ESVideoPhoneDelegate> delegate; + ++(instancetype) shareInstance; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m new file mode 100644 index 0000000..b33db12 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/HDL/ESVideoSDK.m @@ -0,0 +1,41 @@ +// +// ESVideoSDK.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideoSDK.h" +#import "GDHDLUtlis.h" + +@interface ESVideoSDK() + +@property (nonatomic,strong) ESVideoPhone *es; + + +@end + +@implementation ESVideoSDK + +static ESVideoSDK* _instance = nil; + + + ++(instancetype) shareInstance +{ + static dispatch_once_t onceToken ; + dispatch_once(&onceToken, ^{ + _instance = [[super allocWithZone:NULL] init] ; + + }) ; + + return _instance ; +} + +-(void)initSDK +{ +// _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:d imagecallBack:snapImageCallback]; +} + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Info.plist b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Info.plist new file mode 100644 index 0000000..fd4e93e --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/Info.plist @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>$(MARKETING_VERSION)</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSCameraUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄧ浉鏈�"</string> + <key>NSMicrophoneUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄩ害鍏嬮"</string> + <key>NSPhotoLibraryUsageDescription</key> + <string>"闇�瑕佷娇鐢ㄧ浉鍐�"</string> + <key>UIApplicationSceneManifest</key> + <dict> + <key>UIApplicationSupportsMultipleScenes</key> + <false/> + <key>UISceneConfigurations</key> + <dict> + <key>UIWindowSceneSessionRoleApplication</key> + <array> + <dict> + <key>UISceneConfigurationName</key> + <string>Default Configuration</string> + <key>UISceneDelegateClassName</key> + <string>SceneDelegate</string> + <key>UISceneStoryboardFile</key> + <string>Main</string> + </dict> + </array> + </dict> + </dict> + <key>UILaunchStoryboardName</key> + <string>Main</string> + <key>UIMainStoryboardFile</key> + <string>Main</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>armv7</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.h new file mode 100644 index 0000000..41b4557 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.h @@ -0,0 +1,16 @@ +// +// SceneDelegate.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface SceneDelegate : UIResponder <UIWindowSceneDelegate> + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.m new file mode 100644 index 0000000..1645d49 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/SceneDelegate.m @@ -0,0 +1,67 @@ +#import "SceneDelegate.h" + +#import "OpenViewController.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLE(ios(13.0)){ + // 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). + OpenViewController *mainVC = [[OpenViewController alloc] init]; + if (@available(iOS 13.0, *)) { + UIWindowScene *windowScene = (UIWindowScene *)scene; + self.window = [[UIWindow alloc] initWithWindowScene:windowScene]; + self.window.frame = windowScene.coordinateSpace.bounds; + } else { + // Fallback on earlier versions + } + // self.window.rootViewController = mainVC; + + + + UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mainVC]; + self.window.rootViewController = nav; + [self.window makeKeyAndVisible]; +} + + +- (void)sceneDidDisconnect:(UIScene *)scene API_AVAILABLE(ios(13.0)){ + // 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). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ + // 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. +} + + +- (void)sceneWillResignActive:(UIScene *)scene API_AVAILABLE(ios(13.0)){ + // 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). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene API_AVAILABLE(ios(13.0)){ + // 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. +} + + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.h new file mode 100755 index 0000000..15a25d4 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.h @@ -0,0 +1,23 @@ +// +// ViewController.h +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface ViewController : UIViewController + + +@end + +/* +[2019.12.12 15:56:16.217#40455][SendCustomData](/Users/maygion/corelooper/projects.oem/libvideophone/src/phone/phoneconnect.cpp:942) +###Warning[2019.12.12 15:56:16.217#40455][recv custom data=[{"command":"open","room_id":1234,"devType":7,"status":1}]](/Users/maygion/corelooper/projects.oem/libvideophone/src/phone/phoneconnect.cpp:1121) +2019-12-12 15:56:16.218004+0800 ESVideoPhoneSDKDemo[1724:882637] -[ESVideoPhone onPhoneEvent_UI:],msg=event=EVT_RECV_CUSTOM_DATA + +data=eyJjb21tYW5kIjoib3BlbiIsInJvb21faWQiOjEyMzQsImRldlR5cGUiOjcsInN0YXR1cyI6MX0= +2019-12-12 15:56:16.218201+0800 ESVideoPhoneSDKDemo[1724:882637] 浜嬩欢EVT_RECV_CUSTOM_DATA +*/ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.mm b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.mm new file mode 100644 index 0000000..419fde4 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ViewController.mm @@ -0,0 +1,556 @@ +// +// ViewController.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +/* + 鈿狅笍 + 1銆佺紪璇戣缃�, + BuildSettings璁剧疆 锛� + Enable Bitcode 璁剧疆涓篘O锛� + Other Linker Flags 璁剧疆涓�-Wl,-all_load銆� + 2銆乫ramework + 娣诲姞绯荤粺搴� libiconv2.4.0.tbd,libz.tbd,libbz2.tbd. + 3銆乨emo浠呭仛鍙傝�冿紝鍏蜂綋璇锋牴鎹瓵pp鐨勬儏鍐甸�傛椂璋冪敤 + */ +#import <AVFoundation/AVFoundation.h> +#import "ViewController.h" +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "AudioSessionHelper.h" + +@interface ViewController ()<ESVideoPhoneDelegate,UITextFieldDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 +@property (weak, nonatomic) IBOutlet UIButton *speakerBtn; +@property (weak, nonatomic) IBOutlet UITextField *uIDTextField; +@property (weak, nonatomic) IBOutlet UIButton *mCallOrAccept; +@property (weak, nonatomic) IBOutlet UIButton *monitorBtn; + +@end + +@implementation ViewController +{ + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; +} +- (void)viewDidLoad { + [super viewDidLoad]; + + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + _es.isInterrupt = NO; + isBackGround = NO; + [_speakerBtn setTitle:@"鍚瓛" forState:UIControlStateNormal]; +// _mCallOrAccept.enabled = NO; +// _monitorBtn.enabled = NO; + _uIDTextField.text = @"JJY000017XLUXX";//@"JJY000007FSEYX" 榛樿闂ㄥ彛鏈虹殑ID + _uIDTextField.delegate = self; //鈿狅笍杩欓噷蹇呴』瑕佹鏌ユ槸鍚﹀凡缁忔巿鏉冨惁鍒欎細澶辫触锛屽垵濮嬪寲瑙嗛闊抽閲囬泦 + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImage:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(10, 100, self.view.frame.size.width-20, (self.view.frame.size.width-20)/4*3) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + [self.view addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; +} + +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert +//娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + [_es onStopCapture]; + [_es stopTalk]; +} +-(void)dealloc{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [_es freeSubClass]; +} + +#pragma mark ButtonAction +//鍙嶅懠锛氭ā鎷熼棬鍙f満鍛煎彨鎵嬫満锛岄渶瑕侀棬鍙f満鍏堢偣鍛煎彨锛岀瓑1-2S鍚庯紝鎵嬫満鐐瑰弽鍛笺�� +//params鏍锋湰 address=192.168.1.3:8554,tag=mobile://123, +- (IBAction)onReverseCall:(id)sender { + NSString *title = [sender titleForState:UIControlStateNormal]; + if ([title isEqualToString:@"鍙嶅懠"]) { + NSString *normalStr = _uIDTextField.text; + NSString *param = [NSString stringWithFormat:@"address=%@,tag=mobile://123,",normalStr]; + //NSLog(@"%@", param); + [_es onReverseCall:param]; + }else if([title isEqualToString:@"鎺ュ惉"]){ + [_es onAccept]; + } + +} +- (IBAction)onHangup:(id)sender { + [_es onHangup]; +} +- (IBAction)onMonitor:(id)sender { + [_es onMonitor:_uIDTextField.text]; +} +- (IBAction)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + if (sender == nil) { + result = [_sessionHelper speaker:NO]; + }else{ + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + } + if (result) { + [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } + +} + +- (IBAction)openDoor:(id)sender { + [_es openTheDoorWithRoomid: 1234]; +} +- (IBAction)onSnap:(id)sender { + [_es onSnap]; +} +//鈿狅笍 鏂囨湰杈撳叆妗� + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ +// NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + + + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + if([[_speakerBtn titleForState:UIControlStateNormal] isEqualToString:@"鍏嶆彁"]){ + [self speaker:nil]; + }else{ + [self speaker:_speakerBtn]; + } + + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + +#pragma mark --privita 杈呭姪 +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ + [self.view endEditing:YES]; +} +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + if(textField.returnKeyType == UIReturnKeyDone){ + [textField resignFirstResponder];//閿洏鏀惰捣 + return NO; + } + return YES; +} +- (void)keyboardWillChangeFrame:(NSNotification *)notification { + NSValue *notiValue =notification.userInfo[@"UIKeyboardFrameEndUserInfoKey"]; + if(notiValue){ + CGRect rect = [notiValue CGRectValue]; + [UIView animateWithDuration:0.5 animations:^{ + + if (self.view.frame.origin.y < 0) { + //宸茬粡涓婄Щ鍔ㄤ竴娆′簡锛屽氨涓嶇敤绉诲姩浜� + if (self.view.frame.origin.y == 0){ + CGFloat yFloat = self.view.frame.origin.y; + self.view.frame = CGRectMake(self.view.frame.origin.x, yFloat+50, self.view.frame.size.width, self.view.frame.size.height); + } + } + if (rect.origin.y == [UIScreen mainScreen].bounds.size.height) { //閿洏灏嗚鏀惰捣 + self.view.frame = CGRectMake(self.view.frame.origin.x, 0, self.view.frame.size.width, self.view.frame.size.height); + } + } completion:nil]; + } +} + +- (void)saveImage:(UIImage *)image { + NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); + + + NSString *filePath = [[paths objectAtIndex:0]stringByAppendingPathComponent: + [NSString stringWithFormat:@"demo.png"]]; // 淇濆瓨鏂囦欢鐨勫悕绉� + + BOOL result =[UIImagePNGRepresentation(image)writeToFile:filePath atomically:YES]; // 淇濆瓨鎴愬姛浼氳繑鍥瀁ES + if (result == YES) { + NSLog(@"淇濆瓨鎴愬姛"); + } + +} + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.h new file mode 100644 index 0000000..24dd5c5 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.h @@ -0,0 +1,29 @@ +// +// ESVideoMonitorViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +/* 鏀惰棌鍥炶皟浜嬩欢 */ +typedef void(^CollectButtonCallBack)(bool isCollect); + +@interface ESVideoMonitorViewController : UIViewController + + +@property (nonatomic,strong) NSString *mESVideoID; +@property (nonatomic,assign) int mESRoomID;//浣忔埛鐨勬埧闂碔D +@property (nonatomic,strong) NSString *roomName; +@property (nonatomic,strong) NSString *deviceName; +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + +@property(nonatomic,copy) CollectButtonCallBack collectButtonCallBack; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m new file mode 100644 index 0000000..fbddd12 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m @@ -0,0 +1,955 @@ +// +// ESVideoMonitorViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideoMonitorViewController.h" +#import "GDHDLUtlis.h" +#import <AVFoundation/AVFoundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "ESvideoVideoIntercomViewController.h" +#import <Photos/Photos.h> +#import "AudioSessionHelper.h" +#import "CBToast.h" + +@interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 + + +@property (nonatomic, strong) UIButton *backButton; // +@property (nonatomic, strong) UIButton *moreButton; // + +@property (nonatomic, strong) UILabel *titleUILabel; // + + + + +@property (nonatomic, strong) UIView *centerView; //鍐呭鑳屾櫙View +@property (nonatomic, strong) UILabel *topUILabel; //鏍囬 +@property (nonatomic, strong) UIButton *collectButton; // + +@property (nonatomic, strong) UIView *videoView; +@property (nonatomic, strong) UIView *homeView; +@property (nonatomic, strong) UILabel *homeUILabel; //鎴块棿鍚嶅瓧 + +@property (nonatomic, strong) UIButton *screenshotImgBtn; // +@property (nonatomic, strong) UIButton *screenshotTextBtn; // + +@property (nonatomic, strong) UIButton *unlockImgBtn; // +@property (nonatomic, strong) UIButton *unlockTextBtn; // +@property (nonatomic,strong) dispatch_source_t openDoorTimer; +@property (nonatomic, assign) int openDoorTimeout; + +@end + +@implementation ESVideoMonitorViewController +{ + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; + + NSString * tipStr; + NSString * okStr; + NSString * saveToTheAlbumsStr; + NSString * operationFailedStr; + NSString * screenshotStr; + NSString * unlockStr; + NSString * endOfMonitoringStr; + NSString * unlockSuccessfullyStr; + // int _openDoorTimeout; +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = HEXCOLORA(0xF5F6FA, 1.0); + + [self initLlanguage]; + [self initTopBarView]; + [self initCentetView]; + [self initData]; + [self initESVideo]; + [self StartMonitoring]; + // Do any additional setup after loading the view. +} + + + +-(void)initLlanguage{ + NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; + + // 绠�浣撲腑鏂� + if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { + tipStr = @"鎻愮ず"; + okStr = @"纭"; + saveToTheAlbumsStr = @"宸蹭繚瀛樿嚦鎵嬫満鐩稿唽."; + operationFailedStr = @"鎿嶄綔澶辫触"; + screenshotStr = @"鎴浘"; + unlockStr = @"寮�閿�"; + endOfMonitoringStr = @"鐩戣缁撴潫"; + unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + + }else{ + tipStr = @"Prompt"; + okStr = @"OK"; + saveToTheAlbumsStr = @"Saved to the albums."; + operationFailedStr = @"Operation failed."; + screenshotStr = @"Screenshot"; + unlockStr = @"Unlock"; + endOfMonitoringStr = @"End of monitoring"; + unlockSuccessfullyStr = @"Unlock successfully"; + } +} + + +//椤堕儴View +- (void)initTopBarView { + UIView *TopView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)]; + TopView.backgroundColor = HEXCOLORA(0xF9F9F9,1.0); + [TopView addSubview:self.backButton]; + [TopView addSubview:self.moreButton]; + [self.view addSubview:TopView]; + TopView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor; + TopView.layer.shadowOffset = CGSizeMake(0,0.5); + TopView.layer.shadowOpacity = 1; + TopView.layer.shadowRadius = 0; +} + +- (UIButton *)backButton{ + if (_backButton == nil) { + _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_backButton setImage:[UIImage imageNamed:@"ic_esvideo_back"] forState:UIControlStateNormal]; + _backButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_backButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +-(void)backAction{ + [self.navigationController popViewControllerAnimated:true]; +// [self dismissViewControllerAnimated:YES completion:NULL]; +} + +- (UIButton *)moreButton{ + if (_moreButton == nil) { + _moreButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 64, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_moreButton setImage:[UIImage imageNamed:@"ic_esvideo_more"] forState:UIControlStateNormal]; + _moreButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_moreButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_moreButton addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _moreButton; +} + +-(void)moreAction{ + // ESvideoVideoIntercomViewController *mVc = [[ESvideoVideoIntercomViewController alloc] init]; + // mVc.deviceName = @"瀹ゅ鏈�88"; + // mVc.roomName = @"10鏍�808"; + // [self presentViewController:mVc animated:YES completion:nil]; +} + + +- (void)initCentetView { + [self.view addSubview:self.centerView]; + [self.centerView addSubview:self.collectButton]; + [self.centerView addSubview:self.homeView]; + [self.centerView addSubview:self.screenshotImgBtn]; + [self.centerView addSubview:self.screenshotTextBtn]; + [self.centerView addSubview:self.unlockImgBtn]; + [self.centerView addSubview:self.unlockTextBtn]; +} + +- (UIView *)centerView{ + if (_centerView == nil) { + _centerView = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_TOP_BAR_HEIGHT + 20, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT-20)]; + _centerView.backgroundColor = UIColor.whiteColor; + [self setRadiusWithView:_centerView]; + + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; + _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); + // _topUILabel.text = @"浜屾纭鏈�"; + _topUILabel.textAlignment = NSTextAlignmentCenter; + [_centerView addSubview:self.topUILabel]; + + } + return _centerView; +} + +-(void)setRadiusWithView:(UIView *)mView{ + //椤堕儴鍦嗚 + UIRectCorner corners = UIRectCornerTopLeft | UIRectCornerTopRight; + if (@available(iOS 11.0, *)) { + mView.layer.cornerRadius = 20; + mView.layer.maskedCorners = (CACornerMask)corners; + }else{ + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:mView.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(20,20)]; + //鍒涘缓 layer + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = mView.bounds; + //璧嬪�� + maskLayer.path = maskPath.CGPath; + mView.layer.mask = maskLayer; + } +} + +- (UIButton *)collectButton{ + if (_collectButton == nil) { + _collectButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 44, 20, 24, 24)]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_select"] forState:UIControlStateSelected]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_unselect"] forState:UIControlStateNormal]; + // _collectButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_collectButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_collectButton addTarget:self action:@selector(collectAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _collectButton; +} + +-(void)collectAction{ + [_collectButton setSelected:!_collectButton.isSelected]; + _isCollect = _collectButton.isSelected; + if(self.collectButtonCallBack != NULL){ + self.collectButtonCallBack(_isCollect); + } + +} + +- (UIView *)homeView{ + if (_homeView == nil) { + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; + [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; + [_homeView addSubview:mUIImageView]; + [_homeView addSubview:self.homeUILabel]; + + } + return _homeView; +} + +- (UILabel *)homeUILabel{ + if (_homeUILabel == nil) { + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; + _homeUILabel.textColor = [UIColor whiteColor]; + // _homeUILabel.text = @"1鏍�203"; + } + return _homeUILabel; +} + + + +- (UIButton *)screenshotImgBtn{ + if (_screenshotImgBtn == nil) { + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, 404, 58, 58)]; + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; + [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotImgBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotImgBtn; +} + +-(void)screenshotDownAction{ + + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateNormal]; + [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateNormal]; +} + +-(void)screenshotAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + [_screenshotTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + + //鎴浘 + if(_es){ + [_es onSnap]; + } +} + +- (UIButton *)screenshotTextBtn{ + if (_screenshotTextBtn == nil) { + _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(59, 470, 100, 21)]; + [_screenshotTextBtn setTitle:@"鎴浘" forState:UIControlStateNormal]; + _screenshotTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _screenshotTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_screenshotTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_screenshotTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotTextBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotTextBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotTextBtn; +} + +- (UIButton *)unlockImgBtn{ + if (_unlockImgBtn == nil) { + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-138, 404, 58, 58)]; + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; + [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_unlockImgBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_unlockImgBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockImgBtn.adjustsImageWhenHighlighted = NO; + } + return _unlockImgBtn; +} + +-(void)unlockDownAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateNormal]; + [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateNormal]; +} + +-(void)unlockAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + //寮�閿� + if(_es){ + [_es openTheDoorWithRoomid:_mESRoomID]; + } + +} + +- (UIButton *)unlockTextBtn{ + if (_unlockTextBtn == nil) { + _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, 470, 100, 21)]; + [_unlockTextBtn setTitle:@"寮�閿�" forState:UIControlStateNormal]; + _unlockTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + _unlockTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + // _unlockTextBtn.titleLabel.textColor = TextColor; + [_unlockTextBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + // [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_unlockTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; + [_unlockTextBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + } + return _unlockTextBtn; +} + +#pragma 寮�閿佹垚鍔� +-(void)setOpenDoorSuccess{ + [self setUnlock:NO]; + _openDoorTimeout = 0; + [self startOpenDoorCountdown]; + [self showUIAlertView:unlockSuccessfullyStr]; +} + +-(void)setUnlock:(BOOL)ISEnable{ + [_unlockImgBtn setEnabled:ISEnable]; + [_unlockTextBtn setEnabled:ISEnable]; +} + +/** 寮�鍚�掕鏃� */ +- (void)startOpenDoorCountdown { + + if (_openDoorTimeout > 20) { + return; + } + + _openDoorTimeout = 0; + + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _openDoorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_openDoorTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_openDoorTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.openDoorTimeout >= 20 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.openDoorTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT setUnlock:YES]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.openDoorTimeout++; + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_openDoorTimer); + +} + + + +#pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 +-(void)initESVideo{ + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + isBackGround = NO; + + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImageToPhotosAlbum:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + _es.showView.backgroundColor = [UIColor whiteColor]; + [self.centerView addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; + + +} + +-(void)initData{ + _topUILabel.text = _deviceName; + _homeUILabel.text = _roomName; + [_screenshotTextBtn setTitle:screenshotStr forState:UIControlStateNormal]; + [_unlockTextBtn setTitle:unlockStr forState:UIControlStateNormal]; + [_collectButton setSelected:_isCollect]; +} + +/** + 寮�濮嬬洃鎺� + */ +-(void)StartMonitoring{ + if(_es){ + [_es onMonitor:_mESVideoID]; + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } +} + +-(NSString *)getCurrentdateInterval +{ + NSDate *datenow = [NSDate date]; + NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([datenow timeIntervalSince1970]*1000)]; + return timeSp; +} + +-(void)showUIAlertView:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alertController animated:YES completion:nil]; + +} + +-(void)showUIAlertViewWithBack:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self backAction]; + }]]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma viewDidAppear +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert + //娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} + +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} + +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + if(_es){ + [_es onHangup]; + [_es onStopCapture]; + [_es stopTalk]; + + _es.delegate = nil; + + + + } + [_es freeSubClass]; +} + +-(void)dealloc{ + NSLog(@"==============dealloc 1"); + [[NSNotificationCenter defaultCenter] removeObserver:self]; + NSLog(@"==============dealloc 2"); + // [_es freeSubClass]; + // NSLog(@"==============dealloc 3"); + + if(_openDoorTimer){ + dispatch_source_cancel(_openDoorTimer); + _openDoorTimer = nil; // OK + + } + NSLog(@"==============dealloc 3"); +} + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"==============ESVideoPhoneDelegate浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + + // [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + [self speaker:nil]; + // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + + +// [CBToast showToastAction:endOfMonitoringStr]; + [self showUIAlertViewWithBack:endOfMonitoringStr]; +// [self backAction]; + + + + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + + + [self setOpenDoorSuccess]; + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"==============ErrorForESVideo閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ + // NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + + +- (void)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + // //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + // if (sender == nil) { + // result = [_sessionHelper speaker:NO]; + // }else{ + // if(!_isSpeaking){ + // result = [_sessionHelper speaker:YES]; + // _isSpeaking = YES; + // }else{ + // result = [_sessionHelper speaker:NO]; + // _isSpeaking = NO; + // } + // } + // if (result) { + // [sender setTitle:result forState:UIControlStateNormal]; + // [_es startTalk]; + // } + + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + if (result) { + // [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } +} + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + [self speaker:nil]; + + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma 淇濆瓨鍥剧墖鍒扮浉鍐� +- (void)saveImageToPhotosAlbum:(UIImage *)savedImage +{ + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; + if (status == PHAuthorizationStatusNotDetermined) + { + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + if(status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + }]; + } + else + { + if (status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + } +} + +// 鎸囧畾鍥炶皟鏂规硶 +- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo +{ + NSString *message = nil; + if (!error) { + message = saveToTheAlbumsStr; + } + else + { + message = operationFailedStr; + } + + [self showUIAlertView:message]; +} + + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.h new file mode 100644 index 0000000..386a473 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.h @@ -0,0 +1,28 @@ +// +// ESvideoVideoIntercomViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN +/* 鏀惰棌鍥炶皟浜嬩欢 */ +typedef void(^CollectButtonCallBack)(bool isCollect); + +@interface ESvideoVideoIntercomViewController : UIViewController + +@property (nonatomic,strong) NSString *mESVideoID; +@property (nonatomic,assign) int mESRoomID;//浣忔埛鐨勬埧闂碔D +@property (nonatomic,strong) NSString *roomName; +@property (nonatomic,strong) NSString *deviceName; +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + +@property(nonatomic,copy) CollectButtonCallBack collectButtonCallBack; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m new file mode 100644 index 0000000..d9e7ae3 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESvideoVideoIntercomViewController.m @@ -0,0 +1,1159 @@ +// +// ESvideoVideoIntercomViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESvideoVideoIntercomViewController.h" +#import "GDHDLUtlis.h" +#import <AVFoundation/AVFoundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "AudioSessionHelper.h" +#import <Photos/Photos.h> +#import <AudioToolbox/AudioToolbox.h> + + + + +@interface ESvideoVideoIntercomViewController ()<ESVideoPhoneDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 + +@property (nonatomic, strong) UIButton *backButton; // +@property (nonatomic, strong) UIButton *moreButton; // + +@property (nonatomic, strong) UILabel *titleUILabel; // + + + + +@property (nonatomic, strong) UIView *centerView; //鍐呭鑳屾櫙View +@property (nonatomic, strong) UILabel *topUILabel; //鏍囬 +@property (nonatomic, strong) UIButton *collectButton; //鏀惰棌 +@property (nonatomic, strong) UIView *videoView; +@property (nonatomic, strong) UIView *homeView; +@property (nonatomic, strong) UILabel *homeUILabel; //鎴块棿鍚嶅瓧 + +@property (nonatomic, strong) UIView *unlockView; + +@property (nonatomic, strong) UIButton *screenshotImgBtn; //鎴浘 +@property (nonatomic, strong) UIButton *unlockImgBtn; //寮�閿� + + +@property (nonatomic, strong) UIButton *hangUpImgBtn;//鎸傛柇鎸夐挳 +@property (nonatomic, strong) UIButton *hangUpTextBtn; + +@property (nonatomic, strong) UIButton *answerImgBtn;//鎺ュ惉鎸夐挳 +@property (nonatomic, strong) UIButton *answerTextBtn; + +@property (nonatomic, strong) UIButton *calltimeBtn; //閫氳瘽鏃堕棿鎸夐挳 + +//瀹氭椂鍣� +@property (nonatomic,strong) dispatch_source_t countdownTimer; +@property (nonatomic,strong) dispatch_source_t openDoorTimer; +@property (nonatomic, assign) int openDoorTimeout; +@property (nonatomic, assign) int callTimeout; + + +@end + +@implementation ESvideoVideoIntercomViewController{ + + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; + + NSString * tipStr; + NSString * okStr; + NSString * saveToTheAlbumsStr; + NSString * operationFailedStr; + NSString * refuseStr; + NSString * answerStr; + NSString * unlockSuccessfullyStr; + // int openDoorTimeout; + //鍏ㄥ眬鍙橀噺 + SystemSoundID sound; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = HEXCOLORA(0xF5F6FA, 1.0); + [self initLlanguage]; + [self initTopBarView]; + [self initCentetView]; + [self initData]; + [self setAnswerBtnEnable:NO]; + [self initESVideo]; + //寮�濮嬪弽鍛� + [self StartReverseCall]; + // Do any additional setup after loading the view. +} + + +-(void)initLlanguage{ + NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; + + // 绠�浣撲腑鏂� + if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { + tipStr = @"鎻愮ず"; + okStr = @"纭"; + saveToTheAlbumsStr = @"宸蹭繚瀛樿嚦鎵嬫満鐩稿唽."; + operationFailedStr = @"鎿嶄綔澶辫触"; + refuseStr = @"鎷掔粷"; + answerStr = @"鎺ュ惉"; + unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + }else{ + tipStr = @"Prompt"; + okStr = @"OK"; + saveToTheAlbumsStr = @"Saved to the albums."; + operationFailedStr = @"Operation failed."; + refuseStr = @"Refuse"; + answerStr = @"Answer"; + unlockSuccessfullyStr = @"Unlock successfully"; + } +} + + + +- (void)initTopBarView { + UIView *TopView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)]; + TopView.backgroundColor = HEXCOLORA(0xF9F9F9,1.0); + // [TopView addSubview:self.backButton]; + [TopView addSubview:self.moreButton]; + [self.view addSubview:TopView]; + TopView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor; + TopView.layer.shadowOffset = CGSizeMake(0,0.5); + TopView.layer.shadowOpacity = 1; + TopView.layer.shadowRadius = 0; + +} + +- (UIButton *)backButton{ + if (_backButton == nil) { + _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_backButton setImage:[UIImage imageNamed:@"ic_esvideo_back"] forState:UIControlStateNormal]; + _backButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_backButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +-(void)backAction{ + [self.navigationController popViewControllerAnimated:true]; +// [self dismissViewControllerAnimated:YES completion:NULL]; + +} + +- (UIButton *)moreButton{ + if (_moreButton == nil) { + _moreButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 64, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_moreButton setImage:[UIImage imageNamed:@"ic_esvideo_more"] forState:UIControlStateNormal]; + _moreButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_moreButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_moreButton addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _moreButton; +} + +-(void)moreAction{ + +} + + +- (void)initCentetView { + [self.view addSubview:self.centerView]; + [self.centerView addSubview:self.collectButton]; + [self.centerView addSubview:self.homeView]; + [self.centerView addSubview:self.unlockView]; + [self.unlockView addSubview:self.screenshotImgBtn]; + [self.unlockView addSubview:self.unlockImgBtn]; + [self.centerView addSubview:self.hangUpImgBtn]; + [self.centerView addSubview:self.hangUpTextBtn]; + [self.centerView addSubview:self.answerImgBtn]; + [self.centerView addSubview:self.answerTextBtn]; + [self.centerView addSubview:self.calltimeBtn]; +} + +- (UIView *)centerView{ + if (_centerView == nil) { + _centerView = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_TOP_BAR_HEIGHT + 20, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT-20)]; + _centerView.backgroundColor = UIColor.whiteColor; + [self setRadiusWithView:_centerView]; + + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; + _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); + _topUILabel.text = @"浜屾纭鏈�"; + _topUILabel.textAlignment = NSTextAlignmentCenter; + [_centerView addSubview:self.topUILabel]; + } + return _centerView; +} + +-(void)setRadiusWithView:(UIView *)mView{ + //椤堕儴鍦嗚 + UIRectCorner corners = UIRectCornerTopLeft | UIRectCornerTopRight; + if (@available(iOS 11.0, *)) { + mView.layer.cornerRadius = 20; + mView.layer.maskedCorners = (CACornerMask)corners; + }else{ + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:mView.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(20,20)]; + //鍒涘缓 layer + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = mView.bounds; + //璧嬪�� + maskLayer.path = maskPath.CGPath; + mView.layer.mask = maskLayer; + } +} + +- (UIButton *)collectButton{ + if (_collectButton == nil) { + _collectButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 44, 20, 24, 24)]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_select"] forState:UIControlStateSelected]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_unselect"] forState:UIControlStateNormal]; + // _collectButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_collectButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_collectButton addTarget:self action:@selector(collectAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _collectButton; +} + +-(void)collectAction{ + [_collectButton setSelected:!_collectButton.isSelected]; + _isCollect = _collectButton.isSelected; + if(self.collectButtonCallBack != NULL){ + self.collectButtonCallBack(_isCollect); + } +} + +- (UIView *)homeView{ + if (_homeView == nil) { + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; + [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; + [_homeView addSubview:mUIImageView]; + [_homeView addSubview:self.homeUILabel]; + } + return _homeView; +} + +- (UILabel *)homeUILabel{ + if (_homeUILabel == nil) { + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; + _homeUILabel.textColor = [UIColor whiteColor]; + _homeUILabel.text = @"1鏍�203"; + } + return _homeUILabel; +} + + +- (UIView *)unlockView{ + if (_unlockView == nil) { + _unlockView = [[UIView alloc] initWithFrame:CGRectMake(0, 304, APP_SCREEN_WIDTH, 48)]; + _unlockView.backgroundColor = HEXCOLORA(0x232323, 1.0); + _unlockView.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor; + _unlockView.layer.shadowColor = [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:0.4].CGColor; + _unlockView.layer.shadowOffset = CGSizeMake(0,0.5); + _unlockView.layer.shadowOpacity = 1; + _unlockView.layer.shadowRadius = 0; + } + return _unlockView; +} + +- (UIButton *)screenshotImgBtn{ + if (_screenshotImgBtn == nil) { + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(65, 6, 36, 36)]; + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; + [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotImgBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotImgBtn; +} + +-(void)screenshotDownAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateNormal]; +} + +-(void)screenshotAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + //鎴浘 + if(_es){ + [_es onSnap]; + } +} + +- (UIButton *)unlockImgBtn{ + if (_unlockImgBtn == nil) { + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(274, 6, 36, 36)]; + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; + [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_unlockImgBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_unlockImgBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockImgBtn.adjustsImageWhenHighlighted = NO; + } + return _unlockImgBtn; +} + +-(void)unlockDownAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateNormal]; + +} + +-(void)unlockAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + //寮�閿� + if(_es){ + [_es openTheDoorWithRoomid:_mESRoomID]; + } + +} + +#pragma 鎸傛柇鍜屽紑閿� +- (UIButton *)hangUpImgBtn{ + if (_hangUpImgBtn == nil) { + _hangUpImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(54, 448, 58, 58)]; + [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_hangup"] forState:UIControlStateNormal]; + // [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_hangup"] forState:UIControlStateSelected]; + [_hangUpImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_hangUpImgBtn addTarget:self action:@selector(hangUpAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _hangUpImgBtn; +} + +//鎸傛柇鎸夐挳浜嬩欢 +-(void)hangUpAction{ + [self backAction]; +} + +- (UIButton *)hangUpTextBtn{ + if (_hangUpTextBtn == nil) { + _hangUpTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(33, 514, 100, 21)]; + [_hangUpTextBtn setTitle:@"鎷掔粷" forState:UIControlStateNormal]; + _hangUpTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _hangUpTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_hangUpTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + [_hangUpTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_hangUpTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _hangUpTextBtn; +} + +- (UIButton *)answerImgBtn{ + if (_answerImgBtn == nil) { + _answerImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(263, 448, 58, 58)]; + [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_answer"] forState:UIControlStateNormal]; + // [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_answer"] forState:UIControlStateSelected]; + [_answerImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_answerImgBtn addTarget:self action:@selector(answerIAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _answerImgBtn; +} + +-(void)answerIAction{ + [self stopPlaySystemSound]; + if(_es){ + // [self stopPlaySystemSound]; + [_es onAccept]; + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } + + _answerImgBtn.hidden = YES; + _answerTextBtn.hidden = YES; + + //鎸傛柇鎸夐挳绉诲姩涓棿 + _hangUpImgBtn.frame = CGRectMake(159, 448, 58, 58); + _hangUpTextBtn.frame = CGRectMake(138, 514, 100, 21); + + //寮�濮嬭鏃� + _callTimeout = 0; + [self startCountdown]; + +} + +-(void)setAnswerBtnEnable:(BOOL)ISEnable{ + [_answerImgBtn setEnabled:ISEnable]; + [_answerTextBtn setEnabled:ISEnable]; +} + +- (UIButton *)answerTextBtn{ + if (_answerTextBtn == nil) { + _answerTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(242, 514, 100, 21)]; + [_answerTextBtn setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + _answerTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + _answerTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + // _unlockTextBtn.titleLabel.textColor = TextColor; + [_answerTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + [_answerTextBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + [_answerTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_answerTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _answerTextBtn; +} + +- (UIButton *)calltimeBtn{ + if (_calltimeBtn == nil) { + _calltimeBtn = [[UIButton alloc] initWithFrame:CGRectMake(242, 382, 100, 30)]; + _calltimeBtn.backgroundColor = HEXCOLORA(0x000000, 0.4); + [_calltimeBtn setTitle:@"00:00" forState:UIControlStateNormal]; + _calltimeBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:14.0]; + _calltimeBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + [_calltimeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); + _calltimeBtn.hidden = YES; + _calltimeBtn.layer.cornerRadius = 15; + } + return _calltimeBtn; +} + +-(void)ShowTime:(int)nowTime { + if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; + NSString *timeStr = [self timeFormatted:nowTime]; + [self setCalltimeButtonText:timeStr]; +} + +/* + 鏍规嵁鏂囧瓧璋冩暣鎸夐挳瀹� + */ +-(void)setCalltimeButtonText:(NSString*) mesStr { + [_calltimeBtn setTitle:mesStr forState:UIControlStateNormal]; + _calltimeBtn.frame = CGRectMake(0, 0, 100, 30); + _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); +} + + +- (NSString *)timeFormatted:(int)totalSeconds +{ + int seconds = totalSeconds % 60; + int minutes = (totalSeconds / 60); + return [NSString stringWithFormat:@"%02d:%02d", minutes, seconds]; + +} + +- (int *)getTextWidth:(UIButton*) btn +{ + int textWidth = 0; + // 聽 CGSize size = [btn.titleLabel.textsizeWithFont:[UIFontboldSystemFontOfSize:15]constrainedToSize:contentMaxSizes lineBreakMode:UILineBreakModeCharacterWrap]; + // textWidth = (int)fontSize.Width; + return textWidth; +} + + + +/** 寮�鍚�掕鏃� */ +- (void)startCountdown { + + if (_callTimeout > 100) { + return; + } + _callTimeout = 0; + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _countdownTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_countdownTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_countdownTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.callTimeout >= 100 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.countdownTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + NSLog(@"瓒呮椂"); + [weakSelf_AT backAction]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.callTimeout++; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT ShowTime:weakSelf_AT.callTimeout]; + }); + + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_countdownTimer); + +} + +#pragma 寮�閿佹垚鍔� +-(void)setOpenDoorSuccess{ + [self setUnlock:NO]; + _openDoorTimeout = 0; + [self startOpenDoorCountdown]; + [self showUIAlertView:unlockSuccessfullyStr]; + + +} + +-(void)setUnlock:(BOOL)ISEnable{ + [_unlockImgBtn setEnabled:ISEnable]; +} + + + +/** 寮�鍚�掕鏃� */ +- (void)startOpenDoorCountdown { + + if (_openDoorTimeout > 20) { + return; + } + + _openDoorTimeout = 0; + + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _openDoorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_openDoorTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_openDoorTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.openDoorTimeout >= 20 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.openDoorTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT setUnlock:YES]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.openDoorTimeout++; + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_openDoorTimer); + +} + + + +#pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 +-(void)initESVideo{ + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + isBackGround = NO; + + + + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImageToPhotosAlbum:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + _es.showView.backgroundColor = [UIColor whiteColor]; + [self.centerView addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; + + +} + +-(void)initData{ + _topUILabel.text = _deviceName; + _homeUILabel.text = _roomName; + [_hangUpTextBtn setTitle:refuseStr forState:UIControlStateNormal]; + [_answerTextBtn setTitle:answerStr forState:UIControlStateNormal]; + + [_collectButton setSelected:_isCollect]; +} + +/** + 寮�濮嬪弽鍛� + */ +-(void)StartReverseCall{ + [self startPlaySystemSound]; + if(_es){ + NSString *param = [NSString stringWithFormat:@"address=%@,tag=mobile://123,",_mESVideoID]; + //NSLog(@"%@", param); + [_es onReverseCall:param]; + + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } + + +} + +////鎺ュ惉 +//-(void)onAccept{ +// if(_es){ +// [_es onAccept]; +// }else{ +// NSLog(@"ES鍒濆鍖栧け璐�"); +// } +// +//} + + +-(NSString *)getCurrentdateInterval +{ + NSDate *datenow = [NSDate date]; + NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([datenow timeIntervalSince1970]*1000)]; + return timeSp; +} + + +-(void)showUIAlertView:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alertController animated:YES completion:nil]; + +// UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil]; +// [alertView1 show]; + +} + + +#pragma viewDidAppear +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert + //娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + [self stopPlaySystemSound]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + if(_es){ + [_es onHangup]; + [_es onStopCapture]; + [_es stopTalk]; + + _es.delegate = nil; + + + + } + [_es freeSubClass]; +} +-(void)dealloc{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + // [_es freeSubClass]; + + if(_openDoorTimer){ + dispatch_source_cancel(_openDoorTimer); + _openDoorTimer = nil; // OK + } + if(_countdownTimer){ + dispatch_source_cancel(_countdownTimer); + _countdownTimer = nil; // OK + + } + NSLog(@"==============dealloc"); + + +} + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + //鍙嶅懠鎴愬姛 鍏佽鎺ュ惉 鐪嬮渶姹傛槸鍚﹂渶瑕佹挱鏀鹃搩澹板拰闇囧姩 + [self setAnswerBtnEnable:YES]; + + // [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + [self setOpenDoorSuccess]; + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ + // NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + +- (void)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + if (sender == nil) { + result = [_sessionHelper speaker:NO]; + }else{ + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + } + if (result) { + [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } + +} + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + // if([[_speakerBtn titleForState:UIControlStateNormal] isEqualToString:@"鍏嶆彁"]){ + // [self speaker:nil]; + // }else{ + // [self speaker:_speakerBtn]; + // } + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma 淇濆瓨鍥剧墖鍒扮浉鍐� +- (void)saveImageToPhotosAlbum:(UIImage *)savedImage +{ + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; + if (status == PHAuthorizationStatusNotDetermined) + { + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + if(status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + }]; + } + else + { + if (status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + } +} + +// 鎸囧畾鍥炶皟鏂规硶 +- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo +{ + NSString *message = nil; + if (!error) { + message = saveToTheAlbumsStr; + } + else + { + message = operationFailedStr; + } + [self showUIAlertView:message]; +} + + + +#pragma 闇囧姩瀹炵幇璨屼技鍜孲DK鍐茬獊 涓嶈兘瀹炵幇闇囧姩 +//寮�濮嬫挱鏀剧殑鏃跺�欒皟鐢� +-(void)startPlaySystemSound{ + + return; + // //闇囧姩鐨勬彁绀烘枃浠跺悕鏀惧埌璧勬簮鐩綍涓� + // NSString *path = [[NSBundle mainBundle] pathForResource:@"ring" ofType:@"wav"]; + // AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &sound); + //鍒嗗埆娉ㄥ唽閾冨0鍜岄渿鍔ㄥ畬鍚庣殑鍥炶皟 + AudioServicesAddSystemSoundCompletion(kSystemSoundID_Vibrate, NULL, NULL, vibrationCompleteCallback, NULL); + // AudioServicesAddSystemSoundCompletion(sound, NULL, NULL, soundCompleteCallback, NULL); + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);//寮�濮嬮渿鍔� + // AudioServicesPlaySystemSound(sound);//寮�濮嬫挱鏀鹃搩澹� +} + +//鎵嬪姩鍋滄鎾斁鐨勬椂鍊欒皟鐢� +- (void)stopPlaySystemSound{ + return; + NSLog(@"stop PlaySystemSound"); + stopRingAndVibration(); +} + +//鍋滄鍝嶉搩鍜岄渿鍔紝绉婚櫎鍥炶皟骞跺鐞嗘帀閾冨0鍜岄渿鍔� +void stopRingAndVibration() { + AudioServicesRemoveSystemSoundCompletion(kSystemSoundID_Vibrate); + // AudioServicesRemoveSystemSoundCompletion(sound); + AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate); + // AudioServicesDisposeSystemSoundID(sound); +} + +//闇囧姩瀹屾垚鍥炶皟锛屽洜涓洪渿鍔ㄤ竴涓嬩究浼氳皟鐢ㄤ竴娆★紝杩欓噷寤惰繜800ms鍐嶇户缁渿鍔紝鍜屽井淇″樊涓嶅锛屾椂闂撮暱鐭彲鑷繁鎺у埗銆傚弬鏁皊ound鍗充负娉ㄥ唽鍥炶皟鏃朵紶鐨勭涓�涓弬鏁� +void vibrationCompleteCallback(SystemSoundID sound,void * clientData) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(800 * NSEC_PER_MSEC)), dispatch_get_global_queue(0, 0), ^{ + AudioServicesPlaySystemSound(sound); + }); +} + +////閾冨0鎾斁瀹屾垚鍥炶皟锛岃繖绉嶆柟娉晉鎾斁鐨勯煶棰戦檺鍒跺湪30绉掑唴锛屾挱鏀惧畬鐩存帴鍝嶉搩鍜岄渿鍔� +//void soundCompleteCallback(SystemSoundID sound,void * clientData) { +// +// stopRingAndVibration(); +//} + + +@end + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h new file mode 100644 index 0000000..92b46e7 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/GDHDLUtlis.h @@ -0,0 +1,54 @@ +// +// HDLUtlis.h +// HDL_Widget_iOS +// +// Created by HDL on 2019/8/27. +// Copyright 漏 2019 JLChen. All rights reserved. +// + +#define TP_SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) +//#define IOS6 ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) +#define IOS7 (TP_SYSTEM_VERSION >= 7.0) +#define IOS8 (TP_SYSTEM_VERSION >= 8.0) +#define IOS9 (TP_SYSTEM_VERSION >= 9.0) +#define IOS10 (TP_SYSTEM_VERSION >= 10.0) + +//鏄惁鏄疘PhoneX鐨勮澶� +#define IPhoneX ([[UIScreen mainScreen] bounds].size.height == 812) + +// Screen +#define APP_SCREEN_BOUNDS [[UIScreen mainScreen] bounds] +#define APP_SCREEN_HEIGHT (APP_SCREEN_BOUNDS.size.height) +#define APP_SCREEN_WIDTH (APP_SCREEN_BOUNDS.size.width) +#define APP_STATUS_FRAME [UIApplication sharedApplication].statusBarFrame + +#define APP_TOP_BAR_HEIGHT (IPhoneX ? 88 : (IOS7 ? 64 : 44)) +#define APP_STATUS_BAR_HEIGHT (IPhoneX ? 44: (IOS7 ? 20 : 0)) +#define APP_STATUS_BAR_HEIGHT_TURE (IPhoneX ? 44: (IOS7 ? 0 : 0)) +#define APP_TOOL_BAR_HEIGHT 49 +#define APP_TAB_BAR_HEIGHT (IPhoneX ? (49 + 34): 49) +#define APP_CONTENT_WIDTH (APP_SCREEN_BOUNDS.size.width) +#define APP_BUTTOM_HEIGHT (IPhoneX ? 34: 0) +#define APP_CONTENT_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_TAB_BAR_HEIGHT) +#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_B_HEIGHT (APP_SCREEN_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_UIFont @"PingFangSC-Regular" +#define APP_UIFont_BOLD @"PingFangSC-Semibold" + + + +#define TextColor HEXCOLORA(0x333333, 1.0) +#define TextSelectColor HEXCOLORA(0xFB744A, 1.0) +/** WEAKSELF_AT */ +#define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; +#define HEXCOLORA(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a] + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface GDHDLUtlis : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.h new file mode 100644 index 0000000..4c2e0ce --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.h @@ -0,0 +1,17 @@ +// +// OpenViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/1. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface OpenViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m new file mode 100644 index 0000000..8805112 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/OpenViewController.m @@ -0,0 +1,168 @@ +// +// OpenViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/1. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "OpenViewController.h" +#import "ESVideoMonitorViewController.h" +#import "ESvideoVideoIntercomViewController.h" + + +#import "GDHDLUtlis.h" + + + +@interface OpenViewController () +@property (nonatomic, strong) UIButton *monitorBtn; // + +@property (nonatomic, strong) UIButton *calledBtn; // + +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + + + + +@end + +@implementation OpenViewController{ + NSString * DEVICEID; + +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + // Do any additional setup after loading the view. + + [self.view addSubview:self.monitorBtn]; + [self.view addSubview:self.calledBtn]; + + DEVICEID = @"JJY000017XLUXX"; +// DEVICEID = @"JJY000016YWECG"; + +} + + +- (UIButton *)monitorBtn{ + if (_monitorBtn == nil) { + _monitorBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 200, APP_SCREEN_WIDTH-40, 50)]; + _monitorBtn.backgroundColor = TextSelectColor; + [_monitorBtn setTitle:@"鐩戞帶" forState:UIControlStateNormal]; + _monitorBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _monitorBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_monitorBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_monitorBtn addTarget:self action:@selector(monitorAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + // [_monitorBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _monitorBtn.adjustsImageWhenHighlighted = NO; + _monitorBtn.layer.cornerRadius = 25; + } + return _monitorBtn; +} + + + +-(void)monitorAction{ + + ESVideoMonitorViewController *mVc = [[ESVideoMonitorViewController alloc] init]; +// mVc.modalPresentationStyle = UIModalPresentationFullScreen; +// mVc.edgesForExtendedLayout = YES; + mVc.deviceName = @"瀹ゅ鏈�"; + mVc.roomName = @"2鏍�108"; + mVc.mESRoomID = 888; + + // mVc.mESVideoID = @"JJY000007FSEYX"; +// mVc.mESVideoID = @"JJY000016YWECG"; +// mVc.mESVideoID = @"JJY000016YWECG"; + mVc.mESVideoID = DEVICEID; + + + mVc.isCollect = self.isCollect; + + // [self.navigationController pushViewController:mVc animated:YES]; + mVc.collectButtonCallBack = ^(bool isCollect) { + self.isCollect = isCollect; + NSString *str; + if (isCollect) { + str = @"鏀惰棌"; + }else{ + str = @"鍙栨秷鏀惰棌"; + } + NSLog(@"CallBack%@",str); + }; + +// [self presentViewController:mVc animated:YES completion:nil]; + [self.navigationController pushViewController:mVc animated:YES]; + + + + +} + + + +- (UIButton *)calledBtn{ + if (_calledBtn == nil) { + _calledBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 300, APP_SCREEN_WIDTH-40, 50)]; + _calledBtn.backgroundColor = TextSelectColor; + [_calledBtn setTitle:@"琚懠鍙�" forState:UIControlStateNormal]; + _calledBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _calledBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_calledBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_calledBtn addTarget:self action:@selector(calledAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + // [_monitorBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _calledBtn.adjustsImageWhenHighlighted = NO; + _calledBtn.layer.cornerRadius = 25; + } + return _calledBtn; +} + + + + +-(void)calledAction{ + + ESvideoVideoIntercomViewController *mVc = [[ESvideoVideoIntercomViewController alloc] init]; +// mVc.modalPresentationStyle = UIModalPresentationFullScreen; +// mVc.edgesForExtendedLayout = YES; + mVc.deviceName = @"瀹ゅ鏈�2"; + mVc.roomName = @"3鏍�808"; + mVc.mESRoomID = 888; + // mVc.mESVideoID = @"JJY000007FSEYX"; +// mVc.mESVideoID = @"JJY000016YWECG"; + mVc.mESVideoID = DEVICEID; + mVc.isCollect = self.isCollect; + + // [self.navigationController pushViewController:mVc animated:YES]; + mVc.collectButtonCallBack = ^(bool isCollect) { + self.isCollect = isCollect; + NSString *str; + if (isCollect) { + str = @"鏀惰棌"; + }else{ + str = @"鍙栨秷鏀惰棌"; + } + NSLog(@"CallBack%@",str); + }; + +// [self presentViewController:mVc animated:YES completion:nil]; + [self.navigationController pushViewController:mVc animated:YES]; + +} + + +/* + #pragma mark - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. + } + */ + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/main.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/main.m new file mode 100644 index 0000000..c4763ae --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/main.m @@ -0,0 +1,19 @@ +// +// main.m +// ESVideoPhoneSDKDemo +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m new file mode 100644 index 0000000..97a51c7 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/ESVideoPhoneSDKDemoTests.m @@ -0,0 +1,37 @@ +// +// ESVideoPhoneSDKDemoTests.m +// ESVideoPhoneSDKDemoTests +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <XCTest/XCTest.h> + +@interface ESVideoPhoneSDKDemoTests : XCTestCase + +@end + +@implementation ESVideoPhoneSDKDemoTests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/Info.plist b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoTests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m new file mode 100644 index 0000000..baa643c --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/ESVideoPhoneSDKDemoUITests.m @@ -0,0 +1,48 @@ +// +// ESVideoPhoneSDKDemoUITests.m +// ESVideoPhoneSDKDemoUITests +// +// Created by eTouchSky on 2019/9/27. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <XCTest/XCTest.h> + +@interface ESVideoPhoneSDKDemoUITests : XCTestCase + +@end + +@implementation ESVideoPhoneSDKDemoUITests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + self.continueAfterFailure = NO; + + // In UI tests it鈥檚 important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // UI tests must launch the application that they test. + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. +} + +- (void)testLaunchPerformance { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + // This measures how long it takes to launch your application. + [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{ + [[[XCUIApplication alloc] init] launch]; + }]; + } +} + +@end diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/Info.plist b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemoUITests/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/ESVideoPhoneSDk b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/ESVideoPhoneSDk new file mode 100644 index 0000000..b4e6dac --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/ESVideoPhoneSDk Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESError.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESError.h new file mode 100644 index 0000000..1cda4f1 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESError.h @@ -0,0 +1,76 @@ +// +// ESError.h +// ESVideoPhoneSDk +// +// Created by eTouchSky on 2019/12/14. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// +// ESVideoPhone鐨凟SVideoPhoneDelegate鏂规硶鈥�- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype鈥� 涓璭rrortype鐨勭被鍨� + + +#import <Foundation/Foundation.h> +//瑙嗛閲囬泦锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +//App闇�瑕佸鐞� LMPVideoCaptureErrorGetDevice涓嶭MPVideoCaptureErrorNotAuthorized 绫诲瀷鐨勯敊璇� +typedef NS_ENUM (NSUInteger, LMPVideoCaptureError){ + LMPVideoCaptureErrorGetDevice = 0,//鑾峰彇鎽勫儚澶村け璐� + LMPVideoCaptureErrorGetInput = 1,//鑾峰彇瑙嗛杈撳叆閿欒,浠巈rror涓幏鍙栧叿浣撲俊鎭� + LMPVideoCaptureErrorAddInput = 2,//AddInputVideo閿欒 + LMPVideoCaptureErrorAddOutput = 3,//AddOutputVideo閿欒 + LMPVideoCaptureErrorNotAuthorized = 4,//娌℃湁鎺堟潈锛屾巿鏉冨鐞嗙敱App瀹炵幇 + LMPVideoCaptureErrorSetSessionPreset = 5,//SetSessionPreset澶辫触 +}; +//openGl瑙嗛娓叉煋锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPOpenglError){ + LMPOpenglErrorSetCurrentContext = 0,//EAGLContext涓婁笅鏂囧垱寤哄け璐� + LMPOpenglErrorRenderbuffer = 1,//OpenGL attach娓叉煋缂撳啿鍖哄け璐� + LMPOpenglErrorGenTextures = 2,//OpenGL 绾圭悊鍒涘缓澶辫触 + LMPOpenglErrorShaderConnection = 3,//OpenGL 鐫�鑹插櫒杩炴帴澶辫触 + LMPOpenglErrorLoadShader = 4,//OpenGL 鍔犺浇鐫�鑹插櫒澶辫触 + LMPOpenglErrorShaderCompilation = 5,//OpenGL 鐫�鑹插櫒缂栬瘧澶辫触 +}; +/**瑙嗛瑙g爜锛屼細瀵艰嚧App鐪嬩笉鍒伴棬鍙f満鐨勮棰� +debug妯″紡涓嬶紝鏂偣鍙兘瀵艰嚧鍑虹幇LMPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇� +鍓嶅彴鍚庡垏鎹紝鏉ョ數绛夊師鍥犵殑涓柇鍙兘浼氬嚭鐜癓MPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇紙宸茬粡淇锛屾敞鎰忔祴璇曡繃绋嬩腑鏄惁杩樹細鍑虹幇锛� +*/ +typedef NS_ENUM (NSUInteger, LMPH264HwDecoderError){ + LMPH264HwDecoderErrorInitH264HardwareDecoder = 0,//InitH264HardwareDecoderErr + LMPH264HwDecoderErrorKVTVideoDecoderMalfunction = 1,//kVTVideoDecoderMalfunctionErr + LMPH264HwDecoderErrorKVTInvalidSessionErr = 2,//kVTInvalidSessionErr + LMPH264HwDecoderErrorKVTVideoDecoderBadDataErr = 3,//kVTVideoDecoderBadDataErr + LMPH264HwDecoderErrorDecodeOtherErr = 4,//纭В鐮佸叾浠栭敊璇� + LMPH264HwDecoderErrorCVPixelBufferRefPlantErr = 5,//CVPixelBufferRef涓暟鎹负绌� + LMPH264HwDecoderErrorCVPixelBufferRefYUVErr = 6,//CVPixelBufferRef涓彇鍑篩UV澶辫触 +}; +//瑙嗛缂栫爜锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPH264EncoderError){ + LMPH264EncoderErrorVTCompressionSessionCreate = 0,//VTCompressionSessionCreateErr + LMPH264EncoderErrorVideoCompressonOutputCallback = 1,//缂栫爜鍥炶皟澶辫触 +}; +//闊抽閲囬泦锛屼細瀵艰嚧涓嶈兘閲囬泦闊抽锛屽鏂瑰惉涓嶅埌App鐨勫0闊筹紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄惉涓嶅埌App鐨勫0闊崇殑锛� +typedef NS_ENUM (NSUInteger, LMPAudioCaptureError){ + LMPAudioCaptureErrorGetNew = 0,//AudioComponentInstanceNew澶辫触 + LMPAudioCaptureErrorStreamFormat = 1,//kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioCaptureErrorEnableRecord = 2,//鎵撳紑褰曢煶澶辫触 + LMPAudioCaptureErrorEnablePlay = 3,//鍏抽棴鎾斁澶辫触 + LMPAudioCaptureErrorSetInputCallback = 4,//AudioUnitSetCallback澶辫触 + LMPAudioCaptureErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioCaptureErrorBypassVoiceProcessing = 6,//鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioCaptureErrorAudioUnitInitialize = 7,//AudioUnitInitialize澶辫触 +}; +//闊抽鎾斁锛屼細瀵艰嚧涓嶈兘鎾斁闊抽锛屽惉涓嶅埌瀵规柟鐨勫0闊� +typedef NS_ENUM (NSUInteger, LMPAudioPlayError){ + LMPAudioPlayErrorGetNew = 0,//AudioPlay_AudioComponentInstanceNew澶辫触 + LMPAudioPlayErrorStreamFormat = 1,//AudioPlay_kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioPlayErrorEnableRecord = 2,//AudioPlay_鍏抽棴褰曢煶澶辫触 + LMPAudioPlayErrorEnablePlay = 3,//AudioPlay_鎵撳紑鎾斁澶辫触 + LMPAudioPlayErrorSetRenderCallback = 4,//AudioPlay_AudioUnitSetRenderCallback澶辫触 + LMPAudioPlayErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioPlayErrorBypassVoiceProcessing = 6,//AudioPlay_鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioPlayErrorAudioUnitInitialize = 7,//AudioPlay_AudioUnitInitialize澶辫触 +}; + +@interface ESError : NSObject + +@end + + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h new file mode 100644 index 0000000..11f1d89 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -0,0 +1,83 @@ + +// ESVideoPhone.h +// VideoPhone +// +// Created by maygion on 2019/3/26. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +typedef void (^ImageCallback)(UIImage *image); + +@protocol ESVideoPhoneDelegate <NSObject> +- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype; +- (void)getPhoneEvent_UI:(NSString*)phoneEvent; +@end + +@interface ESVideoPhone : NSObject + +//閿欒淇℃伅 +@property(nonatomic,weak) id<ESVideoPhoneDelegate> delegate; +////鑾峰彇瑙嗛鎴浘鐨刡lock +//@property(nonatomic,copy) ImageCallback snapImageCallback; +//瑙嗛鏄剧ず鐨刅iew 鈿狅笍璇峰仛闈炵┖鍒ゆ柇 +@property(nonatomic,strong,readonly) UIView* showView; +//涓柇璁剧疆 +@property (nonatomic,assign,readwrite) BOOL isInterrupt; + +/** +* ESVideoPhone 鍒濆鍖栨柟娉� +* +* @param frame 鐢熸垚鏄剧ず瑙嗛鐨凜GRect +* @param delegate ESVideoPhoneDelegate浠g悊 +* @paramimagecallBack 鑾峰彇瑙嗛鎴浘鐨刡lock +* +* @return ESVideoPhone 瀹炰緥,杩斿洖nil琛ㄧず鍒濆鍖栧け璐ャ�� +*/ +- (instancetype)initESVideoPhoneWithFrame:(CGRect)frame delegate: (id<ESVideoPhoneDelegate>)del imagecallBack:(ImageCallback)callBack; +//鎺堟潈鍚庢墦寮�闊抽閲囬泦锛岃棰戞病鏈夋潈闄愪篃鍙互鍙煶棰戦�氳瘽 +-(BOOL)initAudioCaptureSession; +//鈿狅笍鎺堟潈鍚庢墦寮�瑙嗛閲囬泦锛岄煶棰戞病鏈夋潈闄愬缓璁笉瑕佸彂璧烽�氳瘽 +-(BOOL)initVideoCaptureSession; +/** +* 鐩戞帶 +* +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庡悗鍙版媺鍙栵紙涓�鑸槸涓暟缁勫叾涓寘鍚鐢ㄦ埛鏉冮檺鎷ユ湁鐨勬墍鏈夐棬鍙f満锛� +*/ +- (void)onMonitor:(NSString *)deviceId; +/** +* 鎺ュ惉 +* 杩欎釜鏂规硶浼氬湪AppDelegate鐨勯�氱煡鎺ュ彛涓皟鐢紝閲囩敤灏忕背鎺ㄩ�� +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庨�氱煡涓幏鍙栫敱璁惧ID涓庡崟娆¢�氳瘽tag鎷兼垚锛堝彲鑳戒細鏈夊彉鍔級 +*/ +- (void)onReverseCall:(NSString *)deviceId; +//鎺ュ惉 +- (void)onAccept; +//鎸傛柇 +- (void)onHangup; +//鎵撳紑闊抽閲囬泦涓庨煶棰戞挱鏀� +-(void)startTalk; +//鍏抽棴闊抽閲囬泦涓庨煶棰戞挱鏀� +- (void)stopTalk; +//鑾峰彇瑙嗛鎴浘 +- (void)onSnap; +//鎵撳紑瑙嗛閲囬泦 +- (void)onStartCapture; +//鍏抽棴瑙嗛閲囬泦 +- (void)onStopCapture; +/** +* 寮�闂紝缁撴灉鍦‥SVideoPhoneDelegate 鏂规硶涓繑鍥� +* +* @param roomId 浣忔埛鐨剅oomid锛� +*/ +-(void)openTheDoorWithRoomid: (int)roomId; +//閲婃斁璧勬簮锛坉elegate閲婃斁绛夛級 +-(void)freeSubClass; +@end + + + + + diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Info.plist b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Info.plist new file mode 100644 index 0000000..a2ebd3b --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/Info.plist Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory new file mode 100644 index 0000000..66da18c --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements new file mode 100644 index 0000000..4a29992 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 new file mode 100644 index 0000000..6c9adc7 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 Binary files differ diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..94318a3 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>files</key> + <dict> + <key>.DS_Store</key> + <data> + Y/zzZVahlzqsXsKRy9ythZX/tmM= + </data> + <key>Headers/ESError.h</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>Headers/ESVideoPhone.h</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>Info.plist</key> + <data> + YgFQhxxTQ5/xhKsrQd4C5NGn22w= + </data> + </dict> + <key>files2</key> + <dict> + <key>Headers/ESError.h</key> + <dict> + <key>hash</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>hash2</key> + <data> + y8ReVa9YaZ6fyPjy8EeTl3jbaUadZUYVC0IdLJ/HrgM= + </data> + </dict> + <key>Headers/ESVideoPhone.h</key> + <dict> + <key>hash</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>hash2</key> + <data> + MboPVH5djlpgR//Z7UcRBMEeaakW6FWQbZxlkx4KzaM= + </data> + </dict> + </dict> + <key>rules</key> + <dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^version.plist$</key> + <true/> + </dict> + <key>rules2</key> + <dict> + <key>.*\.dSYM($|/)</key> + <dict> + <key>weight</key> + <real>11</real> + </dict> + <key>^(.*/)?\.DS_Store$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>2000</real> + </dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^Info\.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^PkgInfo$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^embedded\.provisionprofile$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + <key>^version\.plist$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + </dict> +</dict> +</plist> diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature new file mode 100644 index 0000000..7d20839 --- /dev/null +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature Binary files differ diff --git a/README.md b/README.md index 6038f69..f409648 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## ESVideoPhoneSDKProject +## ESVideoPhoneSDKDemo 涓版灄鍙瀵硅SDKDemo diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj new file mode 100644 index 0000000..22316d9 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.pbxproj @@ -0,0 +1,343 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + B956B47C248D2B400093C489 /* libiconv.2.4.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47B248D2B400093C489 /* libiconv.2.4.0.tbd */; platformFilter = ios; }; + B956B47E248D2B4C0093C489 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47D248D2B4C0093C489 /* libz.tbd */; platformFilter = ios; }; + B956B480248D2B570093C489 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B47F248D2B570093C489 /* libbz2.tbd */; platformFilter = ios; }; + B956B486248D2B780093C489 /* ESvideoVideoIntercomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B956B482248D2B780093C489 /* ESvideoVideoIntercomViewController.m */; }; + B956B487248D2B780093C489 /* ESVideoMonitorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B956B484248D2B780093C489 /* ESVideoMonitorViewController.m */; }; + B956B48C248D33F00093C489 /* ESVideoPhoneSDk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B956B48B248D33F00093C489 /* ESVideoPhoneSDk.framework */; platformFilter = ios; }; + B958D92C249378B200A62567 /* AudioSessionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = B958D92B249378B200A62567 /* AudioSessionHelper.m */; }; + B958D92F249378D800A62567 /* CBToast.m in Sources */ = {isa = PBXBuildFile; fileRef = B958D92E249378D800A62567 /* CBToast.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + B956B468248D28B70093C489 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + B956B46A248D28B70093C489 /* libESVideoPhoneSDKXamarin.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libESVideoPhoneSDKXamarin.a; sourceTree = BUILT_PRODUCTS_DIR; }; + B956B47B248D2B400093C489 /* libiconv.2.4.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.4.0.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libiconv.2.4.0.tbd; sourceTree = DEVELOPER_DIR; }; + B956B47D248D2B4C0093C489 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; + B956B47F248D2B570093C489 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libbz2.tbd; sourceTree = DEVELOPER_DIR; }; + B956B481248D2B780093C489 /* ESVideoMonitorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESVideoMonitorViewController.h; sourceTree = "<group>"; }; + B956B482248D2B780093C489 /* ESvideoVideoIntercomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESvideoVideoIntercomViewController.m; sourceTree = "<group>"; }; + B956B483248D2B780093C489 /* GDHDLUtlis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GDHDLUtlis.h; sourceTree = "<group>"; }; + B956B484248D2B780093C489 /* ESVideoMonitorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ESVideoMonitorViewController.m; sourceTree = "<group>"; }; + B956B485248D2B780093C489 /* ESvideoVideoIntercomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ESvideoVideoIntercomViewController.h; sourceTree = "<group>"; }; + B956B48B248D33F00093C489 /* ESVideoPhoneSDk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ESVideoPhoneSDk.framework; path = Extern/ESVideoPhoneSDk.framework; sourceTree = "<group>"; }; + B958D92A249378B200A62567 /* AudioSessionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSessionHelper.h; sourceTree = "<group>"; }; + B958D92B249378B200A62567 /* AudioSessionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioSessionHelper.m; sourceTree = "<group>"; }; + B958D92D249378D800A62567 /* CBToast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBToast.h; sourceTree = "<group>"; }; + B958D92E249378D800A62567 /* CBToast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBToast.m; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B956B467248D28B70093C489 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B956B48C248D33F00093C489 /* ESVideoPhoneSDk.framework in Frameworks */, + B956B480248D2B570093C489 /* libbz2.tbd in Frameworks */, + B956B47E248D2B4C0093C489 /* libz.tbd in Frameworks */, + B956B47C248D2B400093C489 /* libiconv.2.4.0.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B956B461248D28B70093C489 = { + isa = PBXGroup; + children = ( + B956B46C248D28B70093C489 /* ESVideoPhoneSDKXamarin */, + B956B46B248D28B70093C489 /* Products */, + B956B47A248D2B400093C489 /* Frameworks */, + ); + sourceTree = "<group>"; + }; + B956B46B248D28B70093C489 /* Products */ = { + isa = PBXGroup; + children = ( + B956B46A248D28B70093C489 /* libESVideoPhoneSDKXamarin.a */, + ); + name = Products; + sourceTree = "<group>"; + }; + B956B46C248D28B70093C489 /* ESVideoPhoneSDKXamarin */ = { + isa = PBXGroup; + children = ( + B958D92D249378D800A62567 /* CBToast.h */, + B958D92E249378D800A62567 /* CBToast.m */, + B958D92A249378B200A62567 /* AudioSessionHelper.h */, + B958D92B249378B200A62567 /* AudioSessionHelper.m */, + B956B481248D2B780093C489 /* ESVideoMonitorViewController.h */, + B956B484248D2B780093C489 /* ESVideoMonitorViewController.m */, + B956B485248D2B780093C489 /* ESvideoVideoIntercomViewController.h */, + B956B482248D2B780093C489 /* ESvideoVideoIntercomViewController.m */, + B956B483248D2B780093C489 /* GDHDLUtlis.h */, + ); + path = ESVideoPhoneSDKXamarin; + sourceTree = "<group>"; + }; + B956B47A248D2B400093C489 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B956B48B248D33F00093C489 /* ESVideoPhoneSDk.framework */, + B956B47F248D2B570093C489 /* libbz2.tbd */, + B956B47D248D2B4C0093C489 /* libz.tbd */, + B956B47B248D2B400093C489 /* libiconv.2.4.0.tbd */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B956B469248D28B70093C489 /* ESVideoPhoneSDKXamarin */ = { + isa = PBXNativeTarget; + buildConfigurationList = B956B473248D28B70093C489 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKXamarin" */; + buildPhases = ( + B956B466248D28B70093C489 /* Sources */, + B956B467248D28B70093C489 /* Frameworks */, + B956B468248D28B70093C489 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ESVideoPhoneSDKXamarin; + productName = ESVideoPhoneSDKXamarin; + productReference = B956B46A248D28B70093C489 /* libESVideoPhoneSDKXamarin.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B956B462248D28B70093C489 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1120; + ORGANIZATIONNAME = "闄堝槈涔�"; + TargetAttributes = { + B956B469248D28B70093C489 = { + CreatedOnToolsVersion = 11.2.1; + }; + }; + }; + buildConfigurationList = B956B465248D28B70093C489 /* Build configuration list for PBXProject "ESVideoPhoneSDKXamarin" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B956B461248D28B70093C489; + productRefGroup = B956B46B248D28B70093C489 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B956B469248D28B70093C489 /* ESVideoPhoneSDKXamarin */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + B956B466248D28B70093C489 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B958D92F249378D800A62567 /* CBToast.m in Sources */, + B956B486248D2B780093C489 /* ESvideoVideoIntercomViewController.m in Sources */, + B956B487248D2B780093C489 /* ESVideoMonitorViewController.m in Sources */, + B958D92C249378B200A62567 /* AudioSessionHelper.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B956B471248D28B70093C489 /* 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 = 10.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + B956B472248D28B70093C489 /* 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 = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + B956B474248D28B70093C489 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Extern", + ); + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B956B475248D28B70093C489 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + "$(PROJECT_DIR)/Extern", + ); + OTHER_LDFLAGS = "-Wl,-all_load"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B956B465248D28B70093C489 /* Build configuration list for PBXProject "ESVideoPhoneSDKXamarin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B956B471248D28B70093C489 /* Debug */, + B956B472248D28B70093C489 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B956B473248D28B70093C489 /* Build configuration list for PBXNativeTarget "ESVideoPhoneSDKXamarin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B956B474248D28B70093C489 /* Debug */, + B956B475248D28B70093C489 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = B956B462248D28B70093C489 /* Project object */; +} diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..7f44e79 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:ESVideoPhoneSDKXamarin.xcodeproj"> + </FileRef> +</Workspace> diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist> diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.h new file mode 100644 index 0000000..39ed2c9 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.h @@ -0,0 +1,19 @@ +// +// AudioSessionHelper.h +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> + + + +@interface AudioSessionHelper : NSObject + +- (void)setAudioSession; +-(NSString *)speaker:(BOOL)isSpeaking; +@end + + diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.m new file mode 100644 index 0000000..c4039cc --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/AudioSessionHelper.m @@ -0,0 +1,124 @@ +// +// AudioSessionHelper.m +// VideoPhone +// +// Created by eTouchSky on 2019/5/30. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// + +#import "AudioSessionHelper.h" +#import <AVFoundation/AVFoundation.h> + +@interface AudioSessionHelper() + +@property (nonatomic,assign) BOOL speaking; + +@end + +@implementation AudioSessionHelper + +#pragma mark -- AVAudioSession鐨勮缃� +-(void)setAudioSession{ + NSError *error = nil; + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + }else{ + NSLog(@"鍚瓛鎾斁"); + } + + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + + [[AVAudioSession sharedInstance] setPreferredIOBufferDuration:0.05 error:&error]; + if (error) { + NSLog(@"AVAudioSessionSetPreferredIOBufferDuration error:%@", error); + } + + /**< 鐮佺巼璁剧疆涓嶆纭細瀵艰嚧鎾斁鍑烘潵鐨勫0闊冲彉灏栨垨鍙樺钩锛屾湁涓�鐐规嫋闊虫垨鑰呮渶鍚庝竴鐐归煶灏戜簡,8000鐨勯噰鏍风巼璁剧疆16000鐨勭爜鐜囧緢濂�>*/ + [[AVAudioSession sharedInstance] setPreferredSampleRate:16000 error:&error]; + if (error) { + NSLog(@"setPreferredSampleRate error:%@", error); + } +} + + +//蹇呴』鍏坰etActive:NO 鍐嶈缃畂ption 鍐峴etActive:YES锛� 鍚﹀垯鏈変簺绯荤粺锛屾湁浜涚暩褰紝鍦ㄥ惉绛掓ā寮忎笅涓嶈兘閲囬泦 +//杩欓噷鎵撴柇鐐规祴璇曞彲鑳戒細鎶ラ敊锛歱2p缁堢锛岃В鐮佸櫒缁堢銆� +-(NSString *)speaker:(BOOL)isSpeaking{ + + NSError *error = nil; + + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"setActive:NO error:%@", error); + } + if (isSpeaking == NO) { + //鍚瓛鎾斁 鏁堟灉寰堝ソ + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryPlayAndRecord error:%@", error); + return nil; + }else{ + NSLog(@"鍚瓛鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + [self LogAudioSessionInfo]; + + return @"鍏嶆彁"; + } + }else{ + //鍏嶆彁鎾斁 鏈夊洖澹帮細 缃戠粶寮曡捣鍥為煶锛堜袱涓墜鏈洪殧澶繎灏变細寰堝ぇ锛夈�� 鎵嬫満鏈韩鐨勮璁℃湁闂锛堝綍鎾級锛屽叧闂檷鍣姛鑳斤紙鍏抽棴鍚庡熀鏈病鏈変簡锛� + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:&error]; + if (error) { + NSLog(@"AVAudioSessionCategoryOptionDefaultToSpeaker error:%@", error); + return nil; + }else{ + NSLog(@"鍏嶆彁鎾斁"); + [[AVAudioSession sharedInstance] setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:&error]; + if (error) { + NSLog(@"setActive:YES error:%@", error); + } + + //[self LogAudioSessionInfo]; + + return @"鍚瓛"; + } + } +} + +-(void)LogAudioSessionInfo{ + AVAudioSessionCategory category = [[AVAudioSession sharedInstance] category]; + AVAudioSessionCategoryOptions option = [[AVAudioSession sharedInstance] categoryOptions]; + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + NSArray* outputArray = [AVAudioSession sharedInstance].currentRoute.outputs; + NSLog(@"%@", category); + NSLog(@"%lu", (unsigned long)option); + NSLog(@"%@", inputArray); + NSLog(@"%@", outputArray); +} + +/* +-(void)changeMicToHeadset{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortHeadsetMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +-(void)changeMicToBuiltIn{ + NSArray* inputArray = [[AVAudioSession sharedInstance] availableInputs]; + for (AVAudioSessionPortDescription* desc in inputArray) { + if ([desc.portType isEqualToString:AVAudioSessionPortBuiltInMic]) { + NSError* error; + [[AVAudioSession sharedInstance] setPreferredInput:desc error:&error]; + } + } +} +*/ +@end diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.h new file mode 100644 index 0000000..78c2c19 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.h @@ -0,0 +1,21 @@ +// +// CBToast.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/10. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface CBToast : NSObject + +//鏄剧ず娑堟伅-->default center ++ (void)showToastAction:(NSString *)message; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.m new file mode 100644 index 0000000..9767a71 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/CBToast.m @@ -0,0 +1,110 @@ +// +// CBToast.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/6/10. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "CBToast.h" + +@implementation CBToast + +static UILabel *toastLabel = nil; ++ (UILabel *)currentToastLabel { + @synchronized(self) { + if (toastLabel == nil) { + toastLabel = [[UILabel alloc] init]; + toastLabel.backgroundColor = [UIColor darkGrayColor]; + toastLabel.font = [UIFont systemFontOfSize:16]; + toastLabel.textColor = [UIColor whiteColor]; + toastLabel.numberOfLines = 0; + toastLabel.textAlignment = NSTextAlignmentCenter; + toastLabel.lineBreakMode = NSLineBreakByCharWrapping; + toastLabel.layer.masksToBounds = YES; + toastLabel.layer.cornerRadius = 5.0; + toastLabel.alpha = 0; + } + return toastLabel; + } +} + +//榛樿鏄剧ず娑堟伅-->center ++ (void)showToastAction:(NSString *)message +{ + [self showToast:message location:@"center" showTime:2.0]; +} + +//鏄剧ず娑堟伅 ++ (void)showToast:(NSString *)message location:(NSString *)aLocationStr showTime:(float)aShowTime +{ + if (!message) { + message = @""; + } + if ([[NSThread currentThread] isMainThread]) { + toastLabel = [self currentToastLabel]; + [toastLabel removeFromSuperview]; + UIWindow *window = [UIApplication sharedApplication].delegate.window; + [window addSubview:toastLabel]; + + CGFloat main_width = [[UIScreen mainScreen] bounds].size.width; + CGFloat main_height = [[UIScreen mainScreen] bounds].size.height; + + CGFloat width = [self stringText:message font:16 isHeightFixed:YES fixedValue:40]; + CGFloat height = 0; + if (width > main_width - 20) { + width = main_width - 20; + height = [self stringText:message font:16 isHeightFixed:NO fixedValue:width]; + }else{ + height = 40; + } + + CGRect labFrame; + if (aLocationStr && [aLocationStr isEqualToString:@"top"]) { + labFrame = CGRectMake((main_width-width)/2, main_height*0.15, width, height); + }else if (aLocationStr && [aLocationStr isEqualToString:@"bottom"]) { + labFrame = CGRectMake((main_width-width)/2, main_height*0.85, width, height); + }else{ + //default-->center + labFrame = CGRectMake((main_width-width)/2, main_height*0.5, width, height); + } + toastLabel.frame = labFrame; + toastLabel.text = message; + toastLabel.alpha = 1; + [UIView animateWithDuration:aShowTime animations:^{ + toastLabel.alpha = 0; + } completion:^(BOOL finished) { + }]; + }else{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self showToast:message location:aLocationStr showTime:aShowTime]; + }); + return; + } +} + + +//鏍规嵁瀛楃涓查暱搴﹁幏鍙栧搴旂殑瀹藉害鎴栬�呴珮搴� ++ (CGFloat)stringText:(NSString *)aText font:(CGFloat)aFont isHeightFixed:(BOOL)isHeightFixed fixedValue:(CGFloat)fixedValue +{ + CGSize size; + if (isHeightFixed) { + size = CGSizeMake(MAXFLOAT, fixedValue); + } else { + size = CGSizeMake(fixedValue, MAXFLOAT); + } + + CGSize resultSize = CGSizeZero; + if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 7.0) { + //杩斿洖璁$畻鍑虹殑size + resultSize = [aText boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:aFont]} context:nil].size; + } + + if (isHeightFixed) { + return resultSize.width + 20; //澧炲姞宸﹀彸20闂撮殧 + } else { + return resultSize.height + 20; //澧炲姞涓婁笅20闂撮殧 + } +} + +@end diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.h new file mode 100644 index 0000000..24dd5c5 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.h @@ -0,0 +1,29 @@ +// +// ESVideoMonitorViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN + +/* 鏀惰棌鍥炶皟浜嬩欢 */ +typedef void(^CollectButtonCallBack)(bool isCollect); + +@interface ESVideoMonitorViewController : UIViewController + + +@property (nonatomic,strong) NSString *mESVideoID; +@property (nonatomic,assign) int mESRoomID;//浣忔埛鐨勬埧闂碔D +@property (nonatomic,strong) NSString *roomName; +@property (nonatomic,strong) NSString *deviceName; +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + +@property(nonatomic,copy) CollectButtonCallBack collectButtonCallBack; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m new file mode 100644 index 0000000..fbddd12 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESVideoMonitorViewController.m @@ -0,0 +1,955 @@ +// +// ESVideoMonitorViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESVideoMonitorViewController.h" +#import "GDHDLUtlis.h" +#import <AVFoundation/AVFoundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "ESvideoVideoIntercomViewController.h" +#import <Photos/Photos.h> +#import "AudioSessionHelper.h" +#import "CBToast.h" + +@interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 + + +@property (nonatomic, strong) UIButton *backButton; // +@property (nonatomic, strong) UIButton *moreButton; // + +@property (nonatomic, strong) UILabel *titleUILabel; // + + + + +@property (nonatomic, strong) UIView *centerView; //鍐呭鑳屾櫙View +@property (nonatomic, strong) UILabel *topUILabel; //鏍囬 +@property (nonatomic, strong) UIButton *collectButton; // + +@property (nonatomic, strong) UIView *videoView; +@property (nonatomic, strong) UIView *homeView; +@property (nonatomic, strong) UILabel *homeUILabel; //鎴块棿鍚嶅瓧 + +@property (nonatomic, strong) UIButton *screenshotImgBtn; // +@property (nonatomic, strong) UIButton *screenshotTextBtn; // + +@property (nonatomic, strong) UIButton *unlockImgBtn; // +@property (nonatomic, strong) UIButton *unlockTextBtn; // +@property (nonatomic,strong) dispatch_source_t openDoorTimer; +@property (nonatomic, assign) int openDoorTimeout; + +@end + +@implementation ESVideoMonitorViewController +{ + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; + + NSString * tipStr; + NSString * okStr; + NSString * saveToTheAlbumsStr; + NSString * operationFailedStr; + NSString * screenshotStr; + NSString * unlockStr; + NSString * endOfMonitoringStr; + NSString * unlockSuccessfullyStr; + // int _openDoorTimeout; +} + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = HEXCOLORA(0xF5F6FA, 1.0); + + [self initLlanguage]; + [self initTopBarView]; + [self initCentetView]; + [self initData]; + [self initESVideo]; + [self StartMonitoring]; + // Do any additional setup after loading the view. +} + + + +-(void)initLlanguage{ + NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; + + // 绠�浣撲腑鏂� + if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { + tipStr = @"鎻愮ず"; + okStr = @"纭"; + saveToTheAlbumsStr = @"宸蹭繚瀛樿嚦鎵嬫満鐩稿唽."; + operationFailedStr = @"鎿嶄綔澶辫触"; + screenshotStr = @"鎴浘"; + unlockStr = @"寮�閿�"; + endOfMonitoringStr = @"鐩戣缁撴潫"; + unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + + }else{ + tipStr = @"Prompt"; + okStr = @"OK"; + saveToTheAlbumsStr = @"Saved to the albums."; + operationFailedStr = @"Operation failed."; + screenshotStr = @"Screenshot"; + unlockStr = @"Unlock"; + endOfMonitoringStr = @"End of monitoring"; + unlockSuccessfullyStr = @"Unlock successfully"; + } +} + + +//椤堕儴View +- (void)initTopBarView { + UIView *TopView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)]; + TopView.backgroundColor = HEXCOLORA(0xF9F9F9,1.0); + [TopView addSubview:self.backButton]; + [TopView addSubview:self.moreButton]; + [self.view addSubview:TopView]; + TopView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor; + TopView.layer.shadowOffset = CGSizeMake(0,0.5); + TopView.layer.shadowOpacity = 1; + TopView.layer.shadowRadius = 0; +} + +- (UIButton *)backButton{ + if (_backButton == nil) { + _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_backButton setImage:[UIImage imageNamed:@"ic_esvideo_back"] forState:UIControlStateNormal]; + _backButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_backButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +-(void)backAction{ + [self.navigationController popViewControllerAnimated:true]; +// [self dismissViewControllerAnimated:YES completion:NULL]; +} + +- (UIButton *)moreButton{ + if (_moreButton == nil) { + _moreButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 64, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_moreButton setImage:[UIImage imageNamed:@"ic_esvideo_more"] forState:UIControlStateNormal]; + _moreButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_moreButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_moreButton addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _moreButton; +} + +-(void)moreAction{ + // ESvideoVideoIntercomViewController *mVc = [[ESvideoVideoIntercomViewController alloc] init]; + // mVc.deviceName = @"瀹ゅ鏈�88"; + // mVc.roomName = @"10鏍�808"; + // [self presentViewController:mVc animated:YES completion:nil]; +} + + +- (void)initCentetView { + [self.view addSubview:self.centerView]; + [self.centerView addSubview:self.collectButton]; + [self.centerView addSubview:self.homeView]; + [self.centerView addSubview:self.screenshotImgBtn]; + [self.centerView addSubview:self.screenshotTextBtn]; + [self.centerView addSubview:self.unlockImgBtn]; + [self.centerView addSubview:self.unlockTextBtn]; +} + +- (UIView *)centerView{ + if (_centerView == nil) { + _centerView = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_TOP_BAR_HEIGHT + 20, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT-20)]; + _centerView.backgroundColor = UIColor.whiteColor; + [self setRadiusWithView:_centerView]; + + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; + _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); + // _topUILabel.text = @"浜屾纭鏈�"; + _topUILabel.textAlignment = NSTextAlignmentCenter; + [_centerView addSubview:self.topUILabel]; + + } + return _centerView; +} + +-(void)setRadiusWithView:(UIView *)mView{ + //椤堕儴鍦嗚 + UIRectCorner corners = UIRectCornerTopLeft | UIRectCornerTopRight; + if (@available(iOS 11.0, *)) { + mView.layer.cornerRadius = 20; + mView.layer.maskedCorners = (CACornerMask)corners; + }else{ + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:mView.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(20,20)]; + //鍒涘缓 layer + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = mView.bounds; + //璧嬪�� + maskLayer.path = maskPath.CGPath; + mView.layer.mask = maskLayer; + } +} + +- (UIButton *)collectButton{ + if (_collectButton == nil) { + _collectButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 44, 20, 24, 24)]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_select"] forState:UIControlStateSelected]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_unselect"] forState:UIControlStateNormal]; + // _collectButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_collectButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_collectButton addTarget:self action:@selector(collectAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _collectButton; +} + +-(void)collectAction{ + [_collectButton setSelected:!_collectButton.isSelected]; + _isCollect = _collectButton.isSelected; + if(self.collectButtonCallBack != NULL){ + self.collectButtonCallBack(_isCollect); + } + +} + +- (UIView *)homeView{ + if (_homeView == nil) { + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; + [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; + [_homeView addSubview:mUIImageView]; + [_homeView addSubview:self.homeUILabel]; + + } + return _homeView; +} + +- (UILabel *)homeUILabel{ + if (_homeUILabel == nil) { + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; + _homeUILabel.textColor = [UIColor whiteColor]; + // _homeUILabel.text = @"1鏍�203"; + } + return _homeUILabel; +} + + + +- (UIButton *)screenshotImgBtn{ + if (_screenshotImgBtn == nil) { + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, 404, 58, 58)]; + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; + [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotImgBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotImgBtn; +} + +-(void)screenshotDownAction{ + + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateNormal]; + [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateNormal]; +} + +-(void)screenshotAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + [_screenshotTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + + //鎴浘 + if(_es){ + [_es onSnap]; + } +} + +- (UIButton *)screenshotTextBtn{ + if (_screenshotTextBtn == nil) { + _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(59, 470, 100, 21)]; + [_screenshotTextBtn setTitle:@"鎴浘" forState:UIControlStateNormal]; + _screenshotTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _screenshotTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_screenshotTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + // [_screenshotTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_screenshotTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotTextBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotTextBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotTextBtn; +} + +- (UIButton *)unlockImgBtn{ + if (_unlockImgBtn == nil) { + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-138, 404, 58, 58)]; + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; + [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_unlockImgBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_unlockImgBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockImgBtn.adjustsImageWhenHighlighted = NO; + } + return _unlockImgBtn; +} + +-(void)unlockDownAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateNormal]; + [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateNormal]; +} + +-(void)unlockAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + //寮�閿� + if(_es){ + [_es openTheDoorWithRoomid:_mESRoomID]; + } + +} + +- (UIButton *)unlockTextBtn{ + if (_unlockTextBtn == nil) { + _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, 470, 100, 21)]; + [_unlockTextBtn setTitle:@"寮�閿�" forState:UIControlStateNormal]; + _unlockTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + _unlockTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + // _unlockTextBtn.titleLabel.textColor = TextColor; + [_unlockTextBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + [_unlockTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + // [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_unlockTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; + [_unlockTextBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + } + return _unlockTextBtn; +} + +#pragma 寮�閿佹垚鍔� +-(void)setOpenDoorSuccess{ + [self setUnlock:NO]; + _openDoorTimeout = 0; + [self startOpenDoorCountdown]; + [self showUIAlertView:unlockSuccessfullyStr]; +} + +-(void)setUnlock:(BOOL)ISEnable{ + [_unlockImgBtn setEnabled:ISEnable]; + [_unlockTextBtn setEnabled:ISEnable]; +} + +/** 寮�鍚�掕鏃� */ +- (void)startOpenDoorCountdown { + + if (_openDoorTimeout > 20) { + return; + } + + _openDoorTimeout = 0; + + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _openDoorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_openDoorTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_openDoorTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.openDoorTimeout >= 20 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.openDoorTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT setUnlock:YES]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.openDoorTimeout++; + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_openDoorTimer); + +} + + + +#pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 +-(void)initESVideo{ + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + isBackGround = NO; + + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImageToPhotosAlbum:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + _es.showView.backgroundColor = [UIColor whiteColor]; + [self.centerView addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; + + +} + +-(void)initData{ + _topUILabel.text = _deviceName; + _homeUILabel.text = _roomName; + [_screenshotTextBtn setTitle:screenshotStr forState:UIControlStateNormal]; + [_unlockTextBtn setTitle:unlockStr forState:UIControlStateNormal]; + [_collectButton setSelected:_isCollect]; +} + +/** + 寮�濮嬬洃鎺� + */ +-(void)StartMonitoring{ + if(_es){ + [_es onMonitor:_mESVideoID]; + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } +} + +-(NSString *)getCurrentdateInterval +{ + NSDate *datenow = [NSDate date]; + NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([datenow timeIntervalSince1970]*1000)]; + return timeSp; +} + +-(void)showUIAlertView:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alertController animated:YES completion:nil]; + +} + +-(void)showUIAlertViewWithBack:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self backAction]; + }]]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma viewDidAppear +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert + //娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} + +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} + +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + if(_es){ + [_es onHangup]; + [_es onStopCapture]; + [_es stopTalk]; + + _es.delegate = nil; + + + + } + [_es freeSubClass]; +} + +-(void)dealloc{ + NSLog(@"==============dealloc 1"); + [[NSNotificationCenter defaultCenter] removeObserver:self]; + NSLog(@"==============dealloc 2"); + // [_es freeSubClass]; + // NSLog(@"==============dealloc 3"); + + if(_openDoorTimer){ + dispatch_source_cancel(_openDoorTimer); + _openDoorTimer = nil; // OK + + } + NSLog(@"==============dealloc 3"); +} + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"==============ESVideoPhoneDelegate浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + + // [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + [self speaker:nil]; + // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + + +// [CBToast showToastAction:endOfMonitoringStr]; + [self showUIAlertViewWithBack:endOfMonitoringStr]; +// [self backAction]; + + + + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + + + [self setOpenDoorSuccess]; + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"==============ErrorForESVideo閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ + // NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + + +- (void)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + // //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + // if (sender == nil) { + // result = [_sessionHelper speaker:NO]; + // }else{ + // if(!_isSpeaking){ + // result = [_sessionHelper speaker:YES]; + // _isSpeaking = YES; + // }else{ + // result = [_sessionHelper speaker:NO]; + // _isSpeaking = NO; + // } + // } + // if (result) { + // [sender setTitle:result forState:UIControlStateNormal]; + // [_es startTalk]; + // } + + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + if (result) { + // [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } +} + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + [self speaker:nil]; + + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma 淇濆瓨鍥剧墖鍒扮浉鍐� +- (void)saveImageToPhotosAlbum:(UIImage *)savedImage +{ + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; + if (status == PHAuthorizationStatusNotDetermined) + { + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + if(status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + }]; + } + else + { + if (status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + } +} + +// 鎸囧畾鍥炶皟鏂规硶 +- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo +{ + NSString *message = nil; + if (!error) { + message = saveToTheAlbumsStr; + } + else + { + message = operationFailedStr; + } + + [self showUIAlertView:message]; +} + + +@end diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.h new file mode 100644 index 0000000..386a473 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.h @@ -0,0 +1,28 @@ +// +// ESvideoVideoIntercomViewController.h +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import <UIKit/UIKit.h> + +NS_ASSUME_NONNULL_BEGIN +/* 鏀惰棌鍥炶皟浜嬩欢 */ +typedef void(^CollectButtonCallBack)(bool isCollect); + +@interface ESvideoVideoIntercomViewController : UIViewController + +@property (nonatomic,strong) NSString *mESVideoID; +@property (nonatomic,assign) int mESRoomID;//浣忔埛鐨勬埧闂碔D +@property (nonatomic,strong) NSString *roomName; +@property (nonatomic,strong) NSString *deviceName; +@property (nonatomic,assign) BOOL isCollect;//鏄惁鏀惰棌 + +@property(nonatomic,copy) CollectButtonCallBack collectButtonCallBack; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m new file mode 100644 index 0000000..6d8b1d5 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/ESvideoVideoIntercomViewController.m @@ -0,0 +1,1158 @@ +// +// ESvideoVideoIntercomViewController.m +// ESVideoPhoneSDKDemo +// +// Created by 闄堝槈涔� on 2020/5/11. +// Copyright 漏 2020 eTouchSky. All rights reserved. +// + +#import "ESvideoVideoIntercomViewController.h" +#import "GDHDLUtlis.h" +#import <AVFoundation/AVFoundation.h> +#import <ESVideoPhoneSDk/ESVideoPhone.h> +#import <ESVideoPhoneSDk/ESError.h> +#import "AudioSessionHelper.h" +#import <Photos/Photos.h> +#import <AudioToolbox/AudioToolbox.h> + + + + +@interface ESvideoVideoIntercomViewController ()<ESVideoPhoneDelegate> + +@property (nonatomic,strong) AudioSessionHelper *sessionHelper; +@property (nonatomic,strong) ESVideoPhone *es; +@property (nonatomic,assign) BOOL playing; +@property (nonatomic,assign) BOOL isInterrupt; +@property (nonatomic,assign) BOOL isSpeaking; +@property (nonatomic,strong) UIImage *snapImage; //鎴浘 + +@property (nonatomic, strong) UIButton *backButton; // +@property (nonatomic, strong) UIButton *moreButton; // + +@property (nonatomic, strong) UILabel *titleUILabel; // + + + + +@property (nonatomic, strong) UIView *centerView; //鍐呭鑳屾櫙View +@property (nonatomic, strong) UILabel *topUILabel; //鏍囬 +@property (nonatomic, strong) UIButton *collectButton; //鏀惰棌 +@property (nonatomic, strong) UIView *videoView; +@property (nonatomic, strong) UIView *homeView; +@property (nonatomic, strong) UILabel *homeUILabel; //鎴块棿鍚嶅瓧 + +@property (nonatomic, strong) UIView *unlockView; + +@property (nonatomic, strong) UIButton *screenshotImgBtn; //鎴浘 +@property (nonatomic, strong) UIButton *unlockImgBtn; //寮�閿� + + +@property (nonatomic, strong) UIButton *hangUpImgBtn;//鎸傛柇鎸夐挳 +@property (nonatomic, strong) UIButton *hangUpTextBtn; + +@property (nonatomic, strong) UIButton *answerImgBtn;//鎺ュ惉鎸夐挳 +@property (nonatomic, strong) UIButton *answerTextBtn; + +@property (nonatomic, strong) UIButton *calltimeBtn; //閫氳瘽鏃堕棿鎸夐挳 + +//瀹氭椂鍣� +@property (nonatomic,strong) dispatch_source_t countdownTimer; +@property (nonatomic,strong) dispatch_source_t openDoorTimer; +@property (nonatomic, assign) int openDoorTimeout; +@property (nonatomic, assign) int callTimeout; + + +@end + +@implementation ESvideoVideoIntercomViewController{ + + BOOL isAccessAudio; + BOOL isAccessVideo; + BOOL isBackGround; + BOOL iSVideoNotDetermined; + BOOL iSAudioNotDetermined; + + NSString * tipStr; + NSString * okStr; + NSString * saveToTheAlbumsStr; + NSString * operationFailedStr; + NSString * refuseStr; + NSString * answerStr; + NSString * unlockSuccessfullyStr; + // int openDoorTimeout; + //鍏ㄥ眬鍙橀噺 + SystemSoundID sound; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = HEXCOLORA(0xF5F6FA, 1.0); + [self initLlanguage]; + [self initTopBarView]; + [self initCentetView]; + [self initData]; + [self setAnswerBtnEnable:NO]; + [self initESVideo]; + //寮�濮嬪弽鍛� + [self StartReverseCall]; + // Do any additional setup after loading the view. +} + + +-(void)initLlanguage{ + NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; + + // 绠�浣撲腑鏂� + if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { + tipStr = @"鎻愮ず"; + okStr = @"纭"; + saveToTheAlbumsStr = @"宸蹭繚瀛樿嚦鎵嬫満鐩稿唽."; + operationFailedStr = @"鎿嶄綔澶辫触"; + refuseStr = @"鎷掔粷"; + answerStr = @"鎺ュ惉"; + unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; + }else{ + tipStr = @"Prompt"; + okStr = @"OK"; + saveToTheAlbumsStr = @"Saved to the albums."; + operationFailedStr = @"Operation failed."; + refuseStr = @"Refuse"; + answerStr = @"Answer"; + unlockSuccessfullyStr = @"Unlock successfully"; + } +} + + + +- (void)initTopBarView { + UIView *TopView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, APP_TOP_BAR_HEIGHT)]; + TopView.backgroundColor = HEXCOLORA(0xF9F9F9,1.0); + // [TopView addSubview:self.backButton]; + [TopView addSubview:self.moreButton]; + [self.view addSubview:TopView]; + TopView.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.25].CGColor; + TopView.layer.shadowOffset = CGSizeMake(0,0.5); + TopView.layer.shadowOpacity = 1; + TopView.layer.shadowRadius = 0; + +} + +- (UIButton *)backButton{ + if (_backButton == nil) { + _backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_backButton setImage:[UIImage imageNamed:@"ic_esvideo_back"] forState:UIControlStateNormal]; + _backButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_backButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +-(void)backAction{ + [self.navigationController popViewControllerAnimated:true]; + // [self dismissViewControllerAnimated:YES completion:NULL]; +} + +- (UIButton *)moreButton{ + if (_moreButton == nil) { + _moreButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 64, APP_STATUS_BAR_HEIGHT, 44, 44)]; + [_moreButton setImage:[UIImage imageNamed:@"ic_esvideo_more"] forState:UIControlStateNormal]; + _moreButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_moreButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_moreButton addTarget:self action:@selector(moreAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _moreButton; +} + +-(void)moreAction{ + +} + + +- (void)initCentetView { + [self.view addSubview:self.centerView]; + [self.centerView addSubview:self.collectButton]; + [self.centerView addSubview:self.homeView]; + [self.centerView addSubview:self.unlockView]; + [self.unlockView addSubview:self.screenshotImgBtn]; + [self.unlockView addSubview:self.unlockImgBtn]; + [self.centerView addSubview:self.hangUpImgBtn]; + [self.centerView addSubview:self.hangUpTextBtn]; + [self.centerView addSubview:self.answerImgBtn]; + [self.centerView addSubview:self.answerTextBtn]; + [self.centerView addSubview:self.calltimeBtn]; +} + +- (UIView *)centerView{ + if (_centerView == nil) { + _centerView = [[UIButton alloc] initWithFrame:CGRectMake(0, APP_TOP_BAR_HEIGHT + 20, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT-20)]; + _centerView.backgroundColor = UIColor.whiteColor; + [self setRadiusWithView:_centerView]; + + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; + _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); + _topUILabel.text = @"浜屾纭鏈�"; + _topUILabel.textAlignment = NSTextAlignmentCenter; + [_centerView addSubview:self.topUILabel]; + } + return _centerView; +} + +-(void)setRadiusWithView:(UIView *)mView{ + //椤堕儴鍦嗚 + UIRectCorner corners = UIRectCornerTopLeft | UIRectCornerTopRight; + if (@available(iOS 11.0, *)) { + mView.layer.cornerRadius = 20; + mView.layer.maskedCorners = (CACornerMask)corners; + }else{ + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:mView.bounds byRoundingCorners:corners cornerRadii:CGSizeMake(20,20)]; + //鍒涘缓 layer + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = mView.bounds; + //璧嬪�� + maskLayer.path = maskPath.CGPath; + mView.layer.mask = maskLayer; + } +} + +- (UIButton *)collectButton{ + if (_collectButton == nil) { + _collectButton = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH - 44, 20, 24, 24)]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_select"] forState:UIControlStateSelected]; + [_collectButton setImage:[UIImage imageNamed:@"ic_esvideo_collect_unselect"] forState:UIControlStateNormal]; + // _collectButton.imageEdgeInsets = UIEdgeInsetsMake(12,12,12,12); + [_collectButton.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_collectButton addTarget:self action:@selector(collectAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _collectButton; +} + +-(void)collectAction{ + [_collectButton setSelected:!_collectButton.isSelected]; + _isCollect = _collectButton.isSelected; + if(self.collectButtonCallBack != NULL){ + self.collectButtonCallBack(_isCollect); + } +} + +- (UIView *)homeView{ + if (_homeView == nil) { + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; + [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; + [_homeView addSubview:mUIImageView]; + [_homeView addSubview:self.homeUILabel]; + } + return _homeView; +} + +- (UILabel *)homeUILabel{ + if (_homeUILabel == nil) { + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; + _homeUILabel.textColor = [UIColor whiteColor]; + _homeUILabel.text = @"1鏍�203"; + } + return _homeUILabel; +} + + +- (UIView *)unlockView{ + if (_unlockView == nil) { + _unlockView = [[UIView alloc] initWithFrame:CGRectMake(0, 304, APP_SCREEN_WIDTH, 48)]; + _unlockView.backgroundColor = HEXCOLORA(0x232323, 1.0); + _unlockView.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor; + _unlockView.layer.shadowColor = [UIColor colorWithRed:204/255.0 green:204/255.0 blue:204/255.0 alpha:0.4].CGColor; + _unlockView.layer.shadowOffset = CGSizeMake(0,0.5); + _unlockView.layer.shadowOpacity = 1; + _unlockView.layer.shadowRadius = 0; + } + return _unlockView; +} + +- (UIButton *)screenshotImgBtn{ + if (_screenshotImgBtn == nil) { + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(65, 6, 36, 36)]; + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; + [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_screenshotImgBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; + _screenshotImgBtn.adjustsImageWhenHighlighted = NO; + } + return _screenshotImgBtn; +} + +-(void)screenshotDownAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateNormal]; +} + +-(void)screenshotAction{ + [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; + //鎴浘 + if(_es){ + [_es onSnap]; + } +} + +- (UIButton *)unlockImgBtn{ + if (_unlockImgBtn == nil) { + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(274, 6, 36, 36)]; + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; + [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_unlockImgBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; + [_unlockImgBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockImgBtn.adjustsImageWhenHighlighted = NO; + } + return _unlockImgBtn; +} + +-(void)unlockDownAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateNormal]; + +} + +-(void)unlockAction{ + [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; + //寮�閿� + if(_es){ + [_es openTheDoorWithRoomid:_mESRoomID]; + } + +} + +#pragma 鎸傛柇鍜屽紑閿� +- (UIButton *)hangUpImgBtn{ + if (_hangUpImgBtn == nil) { + _hangUpImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(54, 448, 58, 58)]; + [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_hangup"] forState:UIControlStateNormal]; + // [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_hangup"] forState:UIControlStateSelected]; + [_hangUpImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_hangUpImgBtn addTarget:self action:@selector(hangUpAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _hangUpImgBtn; +} + +//鎸傛柇鎸夐挳浜嬩欢 +-(void)hangUpAction{ + [self backAction]; +} + +- (UIButton *)hangUpTextBtn{ + if (_hangUpTextBtn == nil) { + _hangUpTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(33, 514, 100, 21)]; + [_hangUpTextBtn setTitle:@"鎷掔粷" forState:UIControlStateNormal]; + _hangUpTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _hangUpTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + [_hangUpTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + [_hangUpTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_hangUpTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _hangUpTextBtn; +} + +- (UIButton *)answerImgBtn{ + if (_answerImgBtn == nil) { + _answerImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(263, 448, 58, 58)]; + [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_answer"] forState:UIControlStateNormal]; + // [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_answer"] forState:UIControlStateSelected]; + [_answerImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_answerImgBtn addTarget:self action:@selector(answerIAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _answerImgBtn; +} + +-(void)answerIAction{ + [self stopPlaySystemSound]; + if(_es){ + // [self stopPlaySystemSound]; + [_es onAccept]; + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } + + _answerImgBtn.hidden = YES; + _answerTextBtn.hidden = YES; + + //鎸傛柇鎸夐挳绉诲姩涓棿 + _hangUpImgBtn.frame = CGRectMake(159, 448, 58, 58); + _hangUpTextBtn.frame = CGRectMake(138, 514, 100, 21); + + //寮�濮嬭鏃� + _callTimeout = 0; + [self startCountdown]; + +} + +-(void)setAnswerBtnEnable:(BOOL)ISEnable{ + [_answerImgBtn setEnabled:ISEnable]; + [_answerTextBtn setEnabled:ISEnable]; +} + +- (UIButton *)answerTextBtn{ + if (_answerTextBtn == nil) { + _answerTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(242, 514, 100, 21)]; + [_answerTextBtn setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + _answerTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; + _answerTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + // _unlockTextBtn.titleLabel.textColor = TextColor; + [_answerTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + [_answerTextBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + [_answerTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_answerTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; + } + return _answerTextBtn; +} + +- (UIButton *)calltimeBtn{ + if (_calltimeBtn == nil) { + _calltimeBtn = [[UIButton alloc] initWithFrame:CGRectMake(242, 382, 100, 30)]; + _calltimeBtn.backgroundColor = HEXCOLORA(0x000000, 0.4); + [_calltimeBtn setTitle:@"00:00" forState:UIControlStateNormal]; + _calltimeBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:14.0]; + _calltimeBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + [_calltimeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); + _calltimeBtn.hidden = YES; + _calltimeBtn.layer.cornerRadius = 15; + } + return _calltimeBtn; +} + +-(void)ShowTime:(int)nowTime { + if(_calltimeBtn.hidden) _calltimeBtn.hidden = NO; + NSString *timeStr = [self timeFormatted:nowTime]; + [self setCalltimeButtonText:timeStr]; +} + +/* + 鏍规嵁鏂囧瓧璋冩暣鎸夐挳瀹� + */ +-(void)setCalltimeButtonText:(NSString*) mesStr { + [_calltimeBtn setTitle:mesStr forState:UIControlStateNormal]; + _calltimeBtn.frame = CGRectMake(0, 0, 100, 30); + _calltimeBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, 397); +} + + +- (NSString *)timeFormatted:(int)totalSeconds +{ + int seconds = totalSeconds % 60; + int minutes = (totalSeconds / 60); + return [NSString stringWithFormat:@"%02d:%02d", minutes, seconds]; + +} + +- (int *)getTextWidth:(UIButton*) btn +{ + int textWidth = 0; + // 聽 CGSize size = [btn.titleLabel.textsizeWithFont:[UIFontboldSystemFontOfSize:15]constrainedToSize:contentMaxSizes lineBreakMode:UILineBreakModeCharacterWrap]; + // textWidth = (int)fontSize.Width; + return textWidth; +} + + + +/** 寮�鍚�掕鏃� */ +- (void)startCountdown { + + if (_callTimeout > 100) { + return; + } + _callTimeout = 0; + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _countdownTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_countdownTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_countdownTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.callTimeout >= 100 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.countdownTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + NSLog(@"瓒呮椂"); + [weakSelf_AT backAction]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.callTimeout++; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT ShowTime:weakSelf_AT.callTimeout]; + }); + + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_countdownTimer); + +} + +#pragma 寮�閿佹垚鍔� +-(void)setOpenDoorSuccess{ + [self setUnlock:NO]; + _openDoorTimeout = 0; + [self startOpenDoorCountdown]; + [self showUIAlertView:unlockSuccessfullyStr]; + + +} + +-(void)setUnlock:(BOOL)ISEnable{ + [_unlockImgBtn setEnabled:ISEnable]; +} + + + +/** 寮�鍚�掕鏃� */ +- (void)startOpenDoorCountdown { + + if (_openDoorTimeout > 20) { + return; + } + + _openDoorTimeout = 0; + + // GCD瀹氭椂鍣� + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + + _openDoorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); + + dispatch_source_set_timer(_openDoorTimer, dispatch_walltime(NULL, 0), 1.0 * NSEC_PER_SEC, 0); //姣忕鎵ц + + dispatch_source_set_event_handler(_openDoorTimer, ^{ + WEAKSELF_AT + if(weakSelf_AT.openDoorTimeout >= 20 ){// 璁℃椂缁撴潫 + // 鍏抽棴瀹氭椂鍣� + dispatch_source_cancel(weakSelf_AT.openDoorTimer); + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf_AT setUnlock:YES]; + + }); + + }else{// 璁℃椂涓� + weakSelf_AT.openDoorTimeout++; + + } + }); + + // 寮�鍚畾鏃跺櫒 + dispatch_resume(_openDoorTimer); + +} + + + +#pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 +-(void)initESVideo{ + //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _playing = NO; + _isSpeaking = NO; + self.isInterrupt = NO; + isBackGround = NO; + + + + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + ImageCallback snapImageCallback = ^(UIImage *image){ + //block鏄湪鍒嗙嚎绋嬩腑璋冪敤鐨勶紝杩欓噷瑕佹斁鍒颁富绾跨▼ + dispatch_async(dispatch_get_main_queue(), ^{ + self->_snapImage = image; + [self saveImageToPhotosAlbum:image]; + }); + }; + //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 + _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; + if (_es) { + //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 + if (_es.showView) { + _es.delegate = self; + _es.showView.backgroundColor = [UIColor whiteColor]; + [self.centerView addSubview:_es.showView]; + } + }else{ + NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); + return; + } + // 鍒濆鍖朅udio閲囬泦Unit + if(![_es initAudioCaptureSession]){ + return; + } + }else{ + //闊抽娌℃湁鏉冮檺寤鸿涓嶈鍙戣捣閫氳瘽 + return; + } + //鍒濆鍖栬棰戦噰闆咰apture + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + if(![_es initVideoCaptureSession]){ + NSLog(@"VideoCaptureSession 鍒濆鍖栧け璐�"); + } + } + //鍒濆鍖朅udioSession + _sessionHelper = [[AudioSessionHelper alloc]init]; + [_sessionHelper setAudioSession]; + //娣诲姞杩涘叆鍚庡彴锛屼腑鏂瓑閫氱煡 + [self addObservers]; + + +} + +-(void)initData{ + _topUILabel.text = _deviceName; + _homeUILabel.text = _roomName; + [_hangUpTextBtn setTitle:refuseStr forState:UIControlStateNormal]; + [_answerTextBtn setTitle:answerStr forState:UIControlStateNormal]; + + [_collectButton setSelected:_isCollect]; +} + +/** + 寮�濮嬪弽鍛� + */ +-(void)StartReverseCall{ + [self startPlaySystemSound]; + if(_es){ + NSString *param = [NSString stringWithFormat:@"address=%@,tag=mobile://123,",_mESVideoID]; + //NSLog(@"%@", param); + [_es onReverseCall:param]; + + }else{ + NSLog(@"ES鍒濆鍖栧け璐�"); + } + + +} + +////鎺ュ惉 +//-(void)onAccept{ +// if(_es){ +// [_es onAccept]; +// }else{ +// NSLog(@"ES鍒濆鍖栧け璐�"); +// } +// +//} + + +-(NSString *)getCurrentdateInterval +{ + NSDate *datenow = [NSDate date]; + NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)([datenow timeIntervalSince1970]*1000)]; + return timeSp; +} + + +-(void)showUIAlertView:(NSString *)mes +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alertController animated:YES completion:nil]; + + // UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:tipStr message:mes delegate:self cancelButtonTitle:okStr otherButtonTitles:nil, nil]; + // [alertView1 show]; + +} + + +#pragma viewDidAppear +-(void)viewDidAppear:(BOOL)animated{ + //杩欎釜鏂规硶璇锋牴鎹瓵pp鐨勫叿浣撴儏鍐佃皟鐢� + //鍦╲iewDidLoad涓� 璋冪敤requestAccessForAVMediaType: 鏄负浜嗚妭绾﹀垵濮嬪寲鐨勬椂闂� + //鍦╲iewDidAppear涓皟鐢╮equestAccessForAVMediaType: 鏄负浜嗗脊鍑烘彁绀烘墦寮�鏉冮檺鐨凙lert + //娴嬭瘯鐨勬椂鍊欏彂鐜板涓嬫儏鍐碉細濡傛灉鍙妸鎺堟潈鏂规硶鏀惧埌ViewDidAppear鏂规硶涓鐞嗭紝濡傛灉娌℃湁鎺堟潈鍦ㄥ垵濮嬪寲閲囬泦鍣ㄦ椂浼氬け璐ャ�傚悓鏍稟lertView浼氬洜涓篤iew娌℃湁didLoad鑰屽鑷磒resent涓嶅嚭鏉� + if (!isAccessVideo || !isAccessAudio) { + [self requestAccessForAVMedia]; + } +} +-(void)setIsInterrupt:(BOOL)isInterrupt{ + if (_es) { + _es.isInterrupt = isInterrupt; + } +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + [self stopPlaySystemSound]; + //闃叉鐢ㄦ埛涓嶆寜鎸傛柇锛屾垨鑰呬笉绛夋敹鍒板鏂圭殑鎸傛柇锛岀偣鍑昏繑鍥炴寜閽�� + if(_es){ + [_es onHangup]; + [_es onStopCapture]; + [_es stopTalk]; + + _es.delegate = nil; + + + + } + [_es freeSubClass]; +} +-(void)dealloc{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + // [_es freeSubClass]; + + if(_openDoorTimer){ + dispatch_source_cancel(_openDoorTimer); + _openDoorTimer = nil; // OK + } + if(_countdownTimer){ + dispatch_source_cancel(_countdownTimer); + _countdownTimer = nil; // OK + + } + NSLog(@"==============dealloc"); + + +} + +#pragma mark ESVideoPhoneDelegate +//瑙嗛閫氳瘽鐨勭姸鎬佷唬鐞嗕簨浠讹紝phoneEvent涓鸿繑鍥炵殑娑堟伅閲岄潰鍖呭惈event鐘舵�佷笌涓巈vent鐩稿叧鐨勬暟鎹� +-(void)getPhoneEvent_UI:(NSString *)phoneEvent{ + NSLog(@"浜嬩欢%@", phoneEvent); + NSArray *strArray = [phoneEvent componentsSeparatedByString:@"\r\n"]; + NSArray *eventArray = [strArray.firstObject componentsSeparatedByString:@"="]; + NSString *phoneEventStr = eventArray.lastObject; + + if([phoneEventStr isEqual:@"EVT_Ringing"]){ + //鍙嶅懠鎴愬姛 鍏佽鎺ュ惉 鐪嬮渶姹傛槸鍚﹂渶瑕佹挱鏀鹃搩澹板拰闇囧姩 + [self setAnswerBtnEnable:YES]; + + // [_mCallOrAccept setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_StartStream"]){ + + } else if([phoneEventStr isEqual:@"EVT_StopStream"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_Connected"]){ + // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_P2POnlineStatusChanged"]){ + //EVT_P2PStarted(p2p鍒濆鍖朞K锛屽彲浠ヨ繛鎺�),EVT_P2POnlineStatusChangedonline=1 + //p2p鍒濆鍖栨垚鍔�,鎵嬫満绔洰鍓嶆病鏈夎繖涓洖璋冧簡 + //_mCallOrAccept.enabled = YES; + //_monitorBtn.enabled = YES; + }else if([phoneEventStr isEqual:@"EVT_RECV_CUSTOM_DATA"]){ + //寮�闂ㄧ殑缁撴灉浠庤繖閲岃繑鍥� + NSString *baseStr = [strArray[1] substringFromIndex:5]; + NSData *data = [[NSData alloc]initWithBase64EncodedString:baseStr options:NSDataBase64DecodingIgnoreUnknownCharacters]; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; + NSInteger status = [[dic valueForKey:@"status"]integerValue]; + if(status && status == 1){ + NSLog(@"寮�闂ㄦ垚鍔�"); + [self setOpenDoorSuccess]; + }else{ + NSLog(@"寮�闂ㄥけ璐�"); + } + } +} + +-(void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger)errortype{ + NSLog(@"閿欒%@", errorStr); + //娌℃湁鎺堟潈 + if (errortype == LMPVideoCaptureErrorNotAuthorized) { + NSLog(@"閿欒%@", errorStr); + } +} +#pragma mark AudioSession涓嶯otifications澶勭悊 + +- (void) addObservers +{ + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name: UIKeyboardWillChangeFrameNotification object: nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionRuntimeError:) name:AVCaptureSessionRuntimeErrorNotification object:nil]; + + //isAccessVideo锛屽鏋淎VCaptureSession娌℃湁new鍑烘潵涓嶄細鏀跺埌閫氱煡 + if (isAccessVideo) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionWasInterrupted:) name:AVCaptureSessionWasInterruptedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionInterruptionEnded:) name:AVCaptureSessionInterruptionEndedNotification object:nil]; + }else{ + //object:涓簄il 鍙兘涓嶄細瑙﹀彂閫氱煡 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) + name:AVAudioSessionInterruptionNotification object:[AVAudioSession + sharedInstance]]; + } + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) name:AVAudioSessionRouteChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; +} + +- (void) sessionRuntimeError:(NSNotification*)notification +{ + NSError* error = notification.userInfo[AVCaptureSessionErrorKey]; + NSLog(@"Capture session runtime error: %@", error); + + // If media services were reset, and the last start succeeded, restart the session. + if (error.code == AVErrorMediaServicesWereReset) { + [_es onStopCapture]; + [_es startTalk]; + } +} + +- (void)handleInterruption:(NSNotification *)notification +{ + NSUInteger interruptionType = [[[notification userInfo] + objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; + + if (AVAudioSessionInterruptionTypeBegan == interruptionType) + { + if (isBackGround) { + return; + } + [_es stopTalk]; + } + else if (AVAudioSessionInterruptionTypeEnded == interruptionType) + { + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + } +} + +//AVAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� +- (void) sessionWasInterrupted:(NSNotification*)notification +{ + if (_playing == YES) { + self.isInterrupt = YES; + //AVCaptureSessionInterruptionReason + if (@available(iOS 9.0, *)) { + NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; //鐢佃瘽涓柇鏄�1 + NSLog(@"Capture session was interrupted with reason %ld", (long)reason); + + //闊抽纭欢鏆傛椂涓嶅彲鐢ㄨ�岄�犳垚鐨勪腑鏂紝渚嬪锛岀數璇濇垨璀︽姤銆� + if (reason == AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient || + reason == AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient"); + + //VAudioPlayer 绫诲拰 AVAudioRecorder 绫伙紝褰撳彂鐢熶腑鏂椂锛岀郴缁熶細鑷姩鏆傚仠鎾斁鎴栧綍鍒� + //Audio Queue Services, I/O audio unit + [_es onStopCapture]; + [_es stopTalk]; + /* + NSError *error = nil; + [[AVAudioSession sharedInstance] setActive:NO error:&error]; + if (error) { + NSLog(@"sessionWasInterruptedSetActiveNO error:%@", error); + } + */ + }else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground"); + //濡傛灉鏄數璇濅腑鏂紝涓嶄細璧拌繘鍏ュ悗鍙扮殑閫氱煡锛岃繘鍏ュ悗鍙板啀鍒囨崲鍒板墠鍙拌繖閲屾槸涓嶇敤澶勭悊鐨� + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + //澶氫釜搴旂敤绋嬪簭璧勬簮浜夌敤璐ㄩ噺涓嬮檷銆傚彧鏈夊綋搴旂敤绋嬪簭鍗犳嵁鍏ㄥ睆鏃讹紝浼氳瘽鎵嶈兘杩愯銆� + else if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps) { + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"); + // Fade-in a label to inform the user that the camera is unavailable. + }else if (@available(iOS 11.1, *)) { + if (reason == AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure){ + NSLog(@"AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure"); + } + } else { + // Fallback on earlier versions + } + } else { + if (isBackGround) { + return; + } + [_es onStopCapture]; + [_es stopTalk]; + } + } +} + +//杩欎釜閫氱煡鍙兘浼氳幏鍙栦笉鍒帮紝 +- (void) sessionInterruptionEnded:(NSNotification*)notification +{ + // NSInteger reason = [notification.userInfo[AVCaptureSessionInterruptionReasonKey] integerValue]; + NSLog(@"Capture session interruption ended"); + if (self.isInterrupt == NO) { + return; + }else{ + //鐩存帴鍦ㄨ繘鍏ュ墠鍙伴偅涓�氱煡閲岄潰瀹炵幇锛屽疄闄呬笂杩涘叆鍓嶅彴鐨勬柟娉曚細鍦ㄨ繖涓柟娉曞墠闈㈣皟鐢紝鏁堟灉鏇村ソ + [self InterruptionEndedAVAudioSessionSetActiveYES]; + } + +} + +-(void)InterruptionEndedAVAudioSessionSetActiveYES{ + if (isBackGround) { + return; + } + if (self.isInterrupt == YES) { + [_es onStartCapture]; + [_es startTalk]; + self.isInterrupt = NO; + } +} + +- (void)speaker:(UIButton *)sender { + [_es stopTalk]; + + NSString *result = nil; + //鍚瓛鐘舵�� 鎻掕�冲鍚庢嫈鎺夊悗鎭㈠鍒伴粯璁よ缃� + if (sender == nil) { + result = [_sessionHelper speaker:NO]; + }else{ + if(!_isSpeaking){ + result = [_sessionHelper speaker:YES]; + _isSpeaking = YES; + }else{ + result = [_sessionHelper speaker:NO]; + _isSpeaking = NO; + } + } + if (result) { + [sender setTitle:result forState:UIControlStateNormal]; + [_es startTalk]; + } + +} + +- (void)audioRouteChangeListenerCallback:(NSNotification*)notification +{ + + NSDictionary *interuptionDict = notification.userInfo; + NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue]; + switch (routeChangeReason) { + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + //NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); + //鍏嶆彁鐘舵�佷笅鑰虫満鎻掑叆娌℃湁閲囬泦锛屽悓鎰忓垏鎹㈠埌榛樿鐘舵�� + NSLog(@"鑰虫満鎻掑叆"); + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + //NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); + NSLog(@"鑰虫満鎷斿嚭"); + // if([[_speakerBtn titleForState:UIControlStateNormal] isEqualToString:@"鍏嶆彁"]){ + // [self speaker:nil]; + // }else{ + // [self speaker:_speakerBtn]; + // } + [self speaker:nil]; + break; + case AVAudioSessionRouteChangeReasonCategoryChange: + // called at start - also when other audio wants to play + //NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); + break; + } +} + +/* + 闇�瑕佹敞鎰忕殑鏄紝鏈変竴涓腑鏂紑濮嬫秷鎭笉涓�瀹氫細鏈変竴涓腑鏂粨鏉熸秷鎭紝杩欏氨鎰忓懗鐫�涓柇缁撴潫鐨勫洖璋冮噷鐨勫鐞嗛�昏緫鍙兘浼氭病鏈夎鎵ц鍒般�� + 鎵�浠ラ渶瑕佸叧娉ㄥ綋鍒囧埌鍓嶅彴杩愯鐘舵�佹椂锛屾槸涓嶆槸闇�瑕侀噸鏂版縺娲讳綘鐨� Audio Session銆� + */ +- (void)willEnterForeground:(NSNotification*)notification{ + NSLog(@"willEnterForeground"); + //鍒濇鍚姩浼氳蛋杩欎釜閫氱煡(鏍归〉闈�)锛岃繖鏃跺�欐槸娌℃湁杩涘叆鍚庡彴鐨� + if (isBackGround) { + return; + } + + [self InterruptionEndedAVAudioSessionSetActiveYES]; + + // 杩欓噷鏄�冭檻鍒扮敤鎴锋病鏈夋巿鏉冿紝涔嬪悗閫氳繃AlertAction璺宠浆鍒拌缃〉闈㈡巿鏉冨悗鍐嶅洖鍒癆PP鏃跺仛鐨勯噸鏂版娴� + //璺宠浆鍒拌缃〉闈紝鎺堟潈鍚庤繑鍥為〉闈紝缁х画鍒濆鍖栭噰闆嗗櫒 + if (isAccessAudio && isAccessVideo) { + return; + } + if (isAccessVideo && !isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + }else if (!isAccessVideo && isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + + }else if (!isAccessVideo && !isAccessAudio){ + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + if (isAccessAudio) { + [_es initAudioCaptureSession]; + } + if (isAccessVideo) { + [_es initVideoCaptureSession]; + } + } +} +- (void)willEnterBackground:(NSNotification *)notification { + isBackGround = YES; +} + +//鎺堟潈Alert +-(void)requestAccessForAVMedia{ + if (!isAccessAudio) { + [self requestAccessForAVMediaType:AVMediaTypeAudio]; + } + if (!isAccessVideo) { + [self requestAccessForAVMediaType:AVMediaTypeVideo]; + } + if (!iSAudioNotDetermined && iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庢病鏈夋巿鏉�,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"鐩告満娌℃湁鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + }else if(!iSAudioNotDetermined && !iSVideoNotDetermined){ + [self creatAlertViewWith:@"鎺堟潈璇锋眰" message:@"楹﹀厠椋庝笌鐩告満鎺堟潈,璇峰湪璁剧疆涓紑鍚潈闄�,鍚﹀垯灏嗗奖鍝嶉�氳鍔熻兘銆�" cancel:@"纭畾"]; + } +} + +-(void)requestAccessForAVMediaType:(AVMediaType)type{ + if (type == AVMediaTypeVideo) { + isAccessVideo = YES; + iSVideoNotDetermined = YES; + }else{ + isAccessAudio = YES; + iSAudioNotDetermined = YES; + } + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) + { + case AVAuthorizationStatusAuthorized: + { + break; + } + case AVAuthorizationStatusNotDetermined: + { + dispatch_suspend(dispatch_get_main_queue()); + [AVCaptureDevice requestAccessForMediaType:type completionHandler:^(BOOL granted) { + if (!granted) { + if (type == AVMediaTypeVideo) { + self->isAccessVideo = NO; + }else{ + self->isAccessAudio = NO; + } + } + dispatch_resume(dispatch_get_main_queue()); + }]; + break; + } + default: + { + if (type == AVMediaTypeVideo) { + isAccessVideo = NO; + iSVideoNotDetermined = NO; + }else{ + isAccessAudio = NO; + iSAudioNotDetermined = NO; + } + break; + } + } +} + +-(void)creatAlertViewWith:(NSString *)title message:(NSString *) msg cancel:(NSString *)cancelMsg{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:cancelMsg style:UIAlertActionStyleCancel handler:nil]]; + [alertController addAction:[UIAlertAction actionWithTitle:@"璁剧疆" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; + }]]; + [self presentViewController:alertController animated:YES completion:nil]; +} + + + +#pragma 淇濆瓨鍥剧墖鍒扮浉鍐� +- (void)saveImageToPhotosAlbum:(UIImage *)savedImage +{ + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; + if (status == PHAuthorizationStatusNotDetermined) + { + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + if(status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + }]; + } + else + { + if (status == PHAuthorizationStatusAuthorized) + { + UIImageWriteToSavedPhotosAlbum(savedImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), NULL); + } + } +} + +// 鎸囧畾鍥炶皟鏂规硶 +- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo +{ + NSString *message = nil; + if (!error) { + message = saveToTheAlbumsStr; + } + else + { + message = operationFailedStr; + } + [self showUIAlertView:message]; +} + + + +#pragma 闇囧姩瀹炵幇璨屼技鍜孲DK鍐茬獊 涓嶈兘瀹炵幇闇囧姩 +//寮�濮嬫挱鏀剧殑鏃跺�欒皟鐢� +-(void)startPlaySystemSound{ + + return; + // //闇囧姩鐨勬彁绀烘枃浠跺悕鏀惧埌璧勬簮鐩綍涓� + // NSString *path = [[NSBundle mainBundle] pathForResource:@"ring" ofType:@"wav"]; + // AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &sound); + //鍒嗗埆娉ㄥ唽閾冨0鍜岄渿鍔ㄥ畬鍚庣殑鍥炶皟 + AudioServicesAddSystemSoundCompletion(kSystemSoundID_Vibrate, NULL, NULL, vibrationCompleteCallback, NULL); + // AudioServicesAddSystemSoundCompletion(sound, NULL, NULL, soundCompleteCallback, NULL); + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);//寮�濮嬮渿鍔� + // AudioServicesPlaySystemSound(sound);//寮�濮嬫挱鏀鹃搩澹� +} + +//鎵嬪姩鍋滄鎾斁鐨勬椂鍊欒皟鐢� +- (void)stopPlaySystemSound{ + return; + NSLog(@"stop PlaySystemSound"); + stopRingAndVibration(); +} + +//鍋滄鍝嶉搩鍜岄渿鍔紝绉婚櫎鍥炶皟骞跺鐞嗘帀閾冨0鍜岄渿鍔� +void stopRingAndVibration() { + AudioServicesRemoveSystemSoundCompletion(kSystemSoundID_Vibrate); + // AudioServicesRemoveSystemSoundCompletion(sound); + AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate); + // AudioServicesDisposeSystemSoundID(sound); +} + +//闇囧姩瀹屾垚鍥炶皟锛屽洜涓洪渿鍔ㄤ竴涓嬩究浼氳皟鐢ㄤ竴娆★紝杩欓噷寤惰繜800ms鍐嶇户缁渿鍔紝鍜屽井淇″樊涓嶅锛屾椂闂撮暱鐭彲鑷繁鎺у埗銆傚弬鏁皊ound鍗充负娉ㄥ唽鍥炶皟鏃朵紶鐨勭涓�涓弬鏁� +void vibrationCompleteCallback(SystemSoundID sound,void * clientData) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(800 * NSEC_PER_MSEC)), dispatch_get_global_queue(0, 0), ^{ + AudioServicesPlaySystemSound(sound); + }); +} + +////閾冨0鎾斁瀹屾垚鍥炶皟锛岃繖绉嶆柟娉晉鎾斁鐨勯煶棰戦檺鍒跺湪30绉掑唴锛屾挱鏀惧畬鐩存帴鍝嶉搩鍜岄渿鍔� +//void soundCompleteCallback(SystemSoundID sound,void * clientData) { +// +// stopRingAndVibration(); +//} + + +@end + diff --git a/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h new file mode 100644 index 0000000..92b46e7 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/ESVideoPhoneSDKXamarin/GDHDLUtlis.h @@ -0,0 +1,54 @@ +// +// HDLUtlis.h +// HDL_Widget_iOS +// +// Created by HDL on 2019/8/27. +// Copyright 漏 2019 JLChen. All rights reserved. +// + +#define TP_SYSTEM_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) +//#define IOS6 ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) +#define IOS7 (TP_SYSTEM_VERSION >= 7.0) +#define IOS8 (TP_SYSTEM_VERSION >= 8.0) +#define IOS9 (TP_SYSTEM_VERSION >= 9.0) +#define IOS10 (TP_SYSTEM_VERSION >= 10.0) + +//鏄惁鏄疘PhoneX鐨勮澶� +#define IPhoneX ([[UIScreen mainScreen] bounds].size.height == 812) + +// Screen +#define APP_SCREEN_BOUNDS [[UIScreen mainScreen] bounds] +#define APP_SCREEN_HEIGHT (APP_SCREEN_BOUNDS.size.height) +#define APP_SCREEN_WIDTH (APP_SCREEN_BOUNDS.size.width) +#define APP_STATUS_FRAME [UIApplication sharedApplication].statusBarFrame + +#define APP_TOP_BAR_HEIGHT (IPhoneX ? 88 : (IOS7 ? 64 : 44)) +#define APP_STATUS_BAR_HEIGHT (IPhoneX ? 44: (IOS7 ? 20 : 0)) +#define APP_STATUS_BAR_HEIGHT_TURE (IPhoneX ? 44: (IOS7 ? 0 : 0)) +#define APP_TOOL_BAR_HEIGHT 49 +#define APP_TAB_BAR_HEIGHT (IPhoneX ? (49 + 34): 49) +#define APP_CONTENT_WIDTH (APP_SCREEN_BOUNDS.size.width) +#define APP_BUTTOM_HEIGHT (IPhoneX ? 34: 0) +#define APP_CONTENT_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_TAB_BAR_HEIGHT) +#define APP_VISIBLE_HEIGHT (APP_SCREEN_HEIGHT - APP_TOP_BAR_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_B_HEIGHT (APP_SCREEN_HEIGHT - APP_BUTTOM_HEIGHT) +#define APP_UIFont @"PingFangSC-Regular" +#define APP_UIFont_BOLD @"PingFangSC-Semibold" + + + +#define TextColor HEXCOLORA(0x333333, 1.0) +#define TextSelectColor HEXCOLORA(0xFB744A, 1.0) +/** WEAKSELF_AT */ +#define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; +#define HEXCOLORA(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a] + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface GDHDLUtlis : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/ESVideoPhoneSDk b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/ESVideoPhoneSDk new file mode 100644 index 0000000..b4e6dac --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/ESVideoPhoneSDk Binary files differ diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESError.h b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESError.h new file mode 100644 index 0000000..1cda4f1 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESError.h @@ -0,0 +1,76 @@ +// +// ESError.h +// ESVideoPhoneSDk +// +// Created by eTouchSky on 2019/12/14. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// +// ESVideoPhone鐨凟SVideoPhoneDelegate鏂规硶鈥�- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype鈥� 涓璭rrortype鐨勭被鍨� + + +#import <Foundation/Foundation.h> +//瑙嗛閲囬泦锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +//App闇�瑕佸鐞� LMPVideoCaptureErrorGetDevice涓嶭MPVideoCaptureErrorNotAuthorized 绫诲瀷鐨勯敊璇� +typedef NS_ENUM (NSUInteger, LMPVideoCaptureError){ + LMPVideoCaptureErrorGetDevice = 0,//鑾峰彇鎽勫儚澶村け璐� + LMPVideoCaptureErrorGetInput = 1,//鑾峰彇瑙嗛杈撳叆閿欒,浠巈rror涓幏鍙栧叿浣撲俊鎭� + LMPVideoCaptureErrorAddInput = 2,//AddInputVideo閿欒 + LMPVideoCaptureErrorAddOutput = 3,//AddOutputVideo閿欒 + LMPVideoCaptureErrorNotAuthorized = 4,//娌℃湁鎺堟潈锛屾巿鏉冨鐞嗙敱App瀹炵幇 + LMPVideoCaptureErrorSetSessionPreset = 5,//SetSessionPreset澶辫触 +}; +//openGl瑙嗛娓叉煋锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPOpenglError){ + LMPOpenglErrorSetCurrentContext = 0,//EAGLContext涓婁笅鏂囧垱寤哄け璐� + LMPOpenglErrorRenderbuffer = 1,//OpenGL attach娓叉煋缂撳啿鍖哄け璐� + LMPOpenglErrorGenTextures = 2,//OpenGL 绾圭悊鍒涘缓澶辫触 + LMPOpenglErrorShaderConnection = 3,//OpenGL 鐫�鑹插櫒杩炴帴澶辫触 + LMPOpenglErrorLoadShader = 4,//OpenGL 鍔犺浇鐫�鑹插櫒澶辫触 + LMPOpenglErrorShaderCompilation = 5,//OpenGL 鐫�鑹插櫒缂栬瘧澶辫触 +}; +/**瑙嗛瑙g爜锛屼細瀵艰嚧App鐪嬩笉鍒伴棬鍙f満鐨勮棰� +debug妯″紡涓嬶紝鏂偣鍙兘瀵艰嚧鍑虹幇LMPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇� +鍓嶅彴鍚庡垏鎹紝鏉ョ數绛夊師鍥犵殑涓柇鍙兘浼氬嚭鐜癓MPH264HwDecoderErrorKVTInvalidSessionErr鐨勯敊璇紙宸茬粡淇锛屾敞鎰忔祴璇曡繃绋嬩腑鏄惁杩樹細鍑虹幇锛� +*/ +typedef NS_ENUM (NSUInteger, LMPH264HwDecoderError){ + LMPH264HwDecoderErrorInitH264HardwareDecoder = 0,//InitH264HardwareDecoderErr + LMPH264HwDecoderErrorKVTVideoDecoderMalfunction = 1,//kVTVideoDecoderMalfunctionErr + LMPH264HwDecoderErrorKVTInvalidSessionErr = 2,//kVTInvalidSessionErr + LMPH264HwDecoderErrorKVTVideoDecoderBadDataErr = 3,//kVTVideoDecoderBadDataErr + LMPH264HwDecoderErrorDecodeOtherErr = 4,//纭В鐮佸叾浠栭敊璇� + LMPH264HwDecoderErrorCVPixelBufferRefPlantErr = 5,//CVPixelBufferRef涓暟鎹负绌� + LMPH264HwDecoderErrorCVPixelBufferRefYUVErr = 6,//CVPixelBufferRef涓彇鍑篩UV澶辫触 +}; +//瑙嗛缂栫爜锛屼細瀵艰嚧闂ㄥ彛鏈虹湅涓嶅埌App鐨勮棰戯紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄湅涓嶅埌App鐨勮棰戠殑锛� +typedef NS_ENUM (NSUInteger, LMPH264EncoderError){ + LMPH264EncoderErrorVTCompressionSessionCreate = 0,//VTCompressionSessionCreateErr + LMPH264EncoderErrorVideoCompressonOutputCallback = 1,//缂栫爜鍥炶皟澶辫触 +}; +//闊抽閲囬泦锛屼細瀵艰嚧涓嶈兘閲囬泦闊抽锛屽鏂瑰惉涓嶅埌App鐨勫0闊筹紙鐩戞帶鐘舵�佹椂锛岄棬鍙f満鏄惉涓嶅埌App鐨勫0闊崇殑锛� +typedef NS_ENUM (NSUInteger, LMPAudioCaptureError){ + LMPAudioCaptureErrorGetNew = 0,//AudioComponentInstanceNew澶辫触 + LMPAudioCaptureErrorStreamFormat = 1,//kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioCaptureErrorEnableRecord = 2,//鎵撳紑褰曢煶澶辫触 + LMPAudioCaptureErrorEnablePlay = 3,//鍏抽棴鎾斁澶辫触 + LMPAudioCaptureErrorSetInputCallback = 4,//AudioUnitSetCallback澶辫触 + LMPAudioCaptureErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioCaptureErrorBypassVoiceProcessing = 6,//鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioCaptureErrorAudioUnitInitialize = 7,//AudioUnitInitialize澶辫触 +}; +//闊抽鎾斁锛屼細瀵艰嚧涓嶈兘鎾斁闊抽锛屽惉涓嶅埌瀵规柟鐨勫0闊� +typedef NS_ENUM (NSUInteger, LMPAudioPlayError){ + LMPAudioPlayErrorGetNew = 0,//AudioPlay_AudioComponentInstanceNew澶辫触 + LMPAudioPlayErrorStreamFormat = 1,//AudioPlay_kAudioUnitProperty_StreamFormat澶辫触 + LMPAudioPlayErrorEnableRecord = 2,//AudioPlay_鍏抽棴褰曢煶澶辫触 + LMPAudioPlayErrorEnablePlay = 3,//AudioPlay_鎵撳紑鎾斁澶辫触 + LMPAudioPlayErrorSetRenderCallback = 4,//AudioPlay_AudioUnitSetRenderCallback澶辫触 + LMPAudioPlayErrorShouldAllocateBuffer = 5,//浣跨敤鑷繁鐨勭紦瀛樺け璐� + LMPAudioPlayErrorBypassVoiceProcessing = 6,//AudioPlay_鎵撳紑鍥炲0娑堥櫎鍔熻兘澶辫触 + LMPAudioPlayErrorAudioUnitInitialize = 7,//AudioPlay_AudioUnitInitialize澶辫触 +}; + +@interface ESError : NSObject + +@end + + diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h new file mode 100644 index 0000000..11f1d89 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Headers/ESVideoPhone.h @@ -0,0 +1,83 @@ + +// ESVideoPhone.h +// VideoPhone +// +// Created by maygion on 2019/3/26. +// Copyright 漏 2019 eTouchSky. All rights reserved. +// SDK鐗堟湰鍙凤細1.0.0 娴嬭瘯鐗�1 + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +typedef void (^ImageCallback)(UIImage *image); + +@protocol ESVideoPhoneDelegate <NSObject> +- (void)getAErrorForESVideoPhone:(NSString *)errorStr type:(NSUInteger) errortype; +- (void)getPhoneEvent_UI:(NSString*)phoneEvent; +@end + +@interface ESVideoPhone : NSObject + +//閿欒淇℃伅 +@property(nonatomic,weak) id<ESVideoPhoneDelegate> delegate; +////鑾峰彇瑙嗛鎴浘鐨刡lock +//@property(nonatomic,copy) ImageCallback snapImageCallback; +//瑙嗛鏄剧ず鐨刅iew 鈿狅笍璇峰仛闈炵┖鍒ゆ柇 +@property(nonatomic,strong,readonly) UIView* showView; +//涓柇璁剧疆 +@property (nonatomic,assign,readwrite) BOOL isInterrupt; + +/** +* ESVideoPhone 鍒濆鍖栨柟娉� +* +* @param frame 鐢熸垚鏄剧ず瑙嗛鐨凜GRect +* @param delegate ESVideoPhoneDelegate浠g悊 +* @paramimagecallBack 鑾峰彇瑙嗛鎴浘鐨刡lock +* +* @return ESVideoPhone 瀹炰緥,杩斿洖nil琛ㄧず鍒濆鍖栧け璐ャ�� +*/ +- (instancetype)initESVideoPhoneWithFrame:(CGRect)frame delegate: (id<ESVideoPhoneDelegate>)del imagecallBack:(ImageCallback)callBack; +//鎺堟潈鍚庢墦寮�闊抽閲囬泦锛岃棰戞病鏈夋潈闄愪篃鍙互鍙煶棰戦�氳瘽 +-(BOOL)initAudioCaptureSession; +//鈿狅笍鎺堟潈鍚庢墦寮�瑙嗛閲囬泦锛岄煶棰戞病鏈夋潈闄愬缓璁笉瑕佸彂璧烽�氳瘽 +-(BOOL)initVideoCaptureSession; +/** +* 鐩戞帶 +* +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庡悗鍙版媺鍙栵紙涓�鑸槸涓暟缁勫叾涓寘鍚鐢ㄦ埛鏉冮檺鎷ユ湁鐨勬墍鏈夐棬鍙f満锛� +*/ +- (void)onMonitor:(NSString *)deviceId; +/** +* 鎺ュ惉 +* 杩欎釜鏂规硶浼氬湪AppDelegate鐨勯�氱煡鎺ュ彛涓皟鐢紝閲囩敤灏忕背鎺ㄩ�� +* @param deviceId 闂ㄥ彛鏈鸿澶嘔D锛岃繖涓弬鏁颁細浠庨�氱煡涓幏鍙栫敱璁惧ID涓庡崟娆¢�氳瘽tag鎷兼垚锛堝彲鑳戒細鏈夊彉鍔級 +*/ +- (void)onReverseCall:(NSString *)deviceId; +//鎺ュ惉 +- (void)onAccept; +//鎸傛柇 +- (void)onHangup; +//鎵撳紑闊抽閲囬泦涓庨煶棰戞挱鏀� +-(void)startTalk; +//鍏抽棴闊抽閲囬泦涓庨煶棰戞挱鏀� +- (void)stopTalk; +//鑾峰彇瑙嗛鎴浘 +- (void)onSnap; +//鎵撳紑瑙嗛閲囬泦 +- (void)onStartCapture; +//鍏抽棴瑙嗛閲囬泦 +- (void)onStopCapture; +/** +* 寮�闂紝缁撴灉鍦‥SVideoPhoneDelegate 鏂规硶涓繑鍥� +* +* @param roomId 浣忔埛鐨剅oomid锛� +*/ +-(void)openTheDoorWithRoomid: (int)roomId; +//閲婃斁璧勬簮锛坉elegate閲婃斁绛夛級 +-(void)freeSubClass; +@end + + + + + diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Info.plist b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Info.plist new file mode 100644 index 0000000..a2ebd3b --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/Info.plist Binary files differ diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory new file mode 100644 index 0000000..66da18c --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeDirectory Binary files differ diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements new file mode 100644 index 0000000..4a29992 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements Binary files differ diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 new file mode 100644 index 0000000..6c9adc7 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeRequirements-1 Binary files differ diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..94318a3 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeResources @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>files</key> + <dict> + <key>.DS_Store</key> + <data> + Y/zzZVahlzqsXsKRy9ythZX/tmM= + </data> + <key>Headers/ESError.h</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>Headers/ESVideoPhone.h</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>Info.plist</key> + <data> + YgFQhxxTQ5/xhKsrQd4C5NGn22w= + </data> + </dict> + <key>files2</key> + <dict> + <key>Headers/ESError.h</key> + <dict> + <key>hash</key> + <data> + 6x23lohs1gRaX2F7raZcezxZt4A= + </data> + <key>hash2</key> + <data> + y8ReVa9YaZ6fyPjy8EeTl3jbaUadZUYVC0IdLJ/HrgM= + </data> + </dict> + <key>Headers/ESVideoPhone.h</key> + <dict> + <key>hash</key> + <data> + PXntC+GjEn5A+q23YZHDZYIGj3k= + </data> + <key>hash2</key> + <data> + MboPVH5djlpgR//Z7UcRBMEeaakW6FWQbZxlkx4KzaM= + </data> + </dict> + </dict> + <key>rules</key> + <dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^version.plist$</key> + <true/> + </dict> + <key>rules2</key> + <dict> + <key>.*\.dSYM($|/)</key> + <dict> + <key>weight</key> + <real>11</real> + </dict> + <key>^(.*/)?\.DS_Store$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>2000</real> + </dict> + <key>^.*</key> + <true/> + <key>^.*\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>1000</real> + </dict> + <key>^.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>1100</real> + </dict> + <key>^Base\.lproj/</key> + <dict> + <key>weight</key> + <real>1010</real> + </dict> + <key>^Info\.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^PkgInfo$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>20</real> + </dict> + <key>^embedded\.provisionprofile$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + <key>^version\.plist$</key> + <dict> + <key>weight</key> + <real>20</real> + </dict> + </dict> +</dict> +</plist> diff --git a/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature new file mode 100644 index 0000000..7d20839 --- /dev/null +++ b/xamarin/ESVideoPhoneSDKXamarin/Extern/ESVideoPhoneSDk.framework/_CodeSignature/CodeSignature Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs b/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs new file mode 100644 index 0000000..35d842f --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/ApiDefinition.cs @@ -0,0 +1,132 @@ +锘縰sing System; + +using ObjCRuntime; +using Foundation; +using UIKit; + +namespace Shared.IOS.ESVideoPhoneSDK +{ + // The first step to creating a binding is to add your native library ("libNativeLibrary.a") + // to the project by right-clicking (or Control-clicking) the folder containing this source + // file and clicking "Add files..." and then simply select the native library (or libraries) + // that you want to bind. + // + // When you do that, you'll notice that MonoDevelop generates a code-behind file for each + // native library which will contain a [LinkWith] attribute. VisualStudio auto-detects the + // architectures that the native library supports and fills in that information for you, + // however, it cannot auto-detect any Frameworks or other system libraries that the + // native library may depend on, so you'll need to fill in that information yourself. + // + // Once you've done that, you're ready to move on to binding the API... + // + // + // Here is where you'd define your API definition for the native Objective-C library. + // + // For example, to bind the following Objective-C class: + // + // @interface Widget : NSObject { + // } + // + // The C# binding would look like this: + // + // [BaseType (typeof (NSObject))] + // interface Widget { + // } + // + // To bind Objective-C properties, such as: + // + // @property (nonatomic, readwrite, assign) CGPoint center; + // + // You would add a property definition in the C# interface like so: + // + // [Export ("center")] + // CGPoint Center { get; set; } + // + // To bind an Objective-C method, such as: + // + // -(void) doSomething:(NSObject *)object atIndex:(NSInteger)index; + // + // You would add a method definition to the C# interface like so: + // + // [Export ("doSomething:atIndex:")] + // void DoSomething (NSObject object, int index); + // + // Objective-C "constructors" such as: + // + // -(id)initWithElmo:(ElmoMuppet *)elmo; + // + // Can be bound as: + // + // [Export ("initWithElmo:")] + // IntPtr Constructor (ElmoMuppet elmo); + // + // For more information, see https://aka.ms/ios-binding + // + + //***************************鐩戞帶椤甸潰*********************** + // typedef void (^CollectButtonCallBack)(_Bool); + delegate void CollectButtonCallBack(bool arg0); + + // @interface ESVideoMonitorViewController : UIViewController + [BaseType(typeof(UIViewController))] + interface ESVideoMonitorViewController + { + // @property (nonatomic, strong) NSString * _Nonnull mESVideoID; + [Export("mESVideoID", ArgumentSemantic.Strong)] + string MESVideoID { get; set; } + + // @property (assign, nonatomic) int mESRoomID; + [Export("mESRoomID")] + int MESRoomID { get; set; } + + // @property (nonatomic, strong) NSString * _Nonnull roomName; + [Export("roomName", ArgumentSemantic.Strong)] + string RoomName { get; set; } + + // @property (nonatomic, strong) NSString * _Nonnull deviceName; + [Export("deviceName", ArgumentSemantic.Strong)] + string DeviceName { get; set; } + + // @property (assign, nonatomic) BOOL isCollect; + [Export("isCollect")] + bool IsCollect { get; set; } + + // @property (copy, nonatomic) CollectButtonCallBack _Nonnull collectButtonCallBack; + [Export("collectButtonCallBack", ArgumentSemantic.Copy)] + CollectButtonCallBack CollectButtonCallBack { get; set; } + } + + //***************************琚懠鍙〉闈�*********************** + //// typedef void (^CollectButtonCallBack)(_Bool); + //delegate void CollectButtonCallBack(bool arg0); + + // @interface ESvideoVideoIntercomViewController : UIViewController + [BaseType(typeof(UIViewController))] + interface ESvideoVideoIntercomViewController + { + // @property (nonatomic, strong) NSString * _Nonnull mESVideoID; + [Export("mESVideoID", ArgumentSemantic.Strong)] + string MESVideoID { get; set; } + + // @property (assign, nonatomic) int mESRoomID; + [Export("mESRoomID")] + int MESRoomID { get; set; } + + // @property (nonatomic, strong) NSString * _Nonnull roomName; + [Export("roomName", ArgumentSemantic.Strong)] + string RoomName { get; set; } + + // @property (nonatomic, strong) NSString * _Nonnull deviceName; + [Export("deviceName", ArgumentSemantic.Strong)] + string DeviceName { get; set; } + + // @property (assign, nonatomic) BOOL isCollect; + [Export("isCollect")] + bool IsCollect { get; set; } + + // @property (copy, nonatomic) CollectButtonCallBack _Nonnull collectButtonCallBack; + [Export("collectButtonCallBack", ArgumentSemantic.Copy)] + CollectButtonCallBack CollectButtonCallBack { get; set; } + } +} + diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/ESVideoPhoneSDk.a b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/ESVideoPhoneSDk.a new file mode 100644 index 0000000..b4e6dac --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/ESVideoPhoneSDk.a Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a new file mode 100644 index 0000000..49eda5e --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Library/libESVideoPhoneSDKXamarin.a Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Properties/AssemblyInfo.cs b/xamarin/Shared.IOS.ESVideoPhoneSDK/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c507ba8 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; + +using Foundation; + +// This attribute allows you to mark your assemblies as 鈥渟afe to link鈥�. +// When the attribute is present, the linker鈥攊f enabled鈥攚ill process the assembly +// even if you鈥檙e using the 鈥淟ink SDK assemblies only鈥� option, which is the default for device builds. + +[assembly: LinkerSafe] + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Shared.IOS.ESVideoPhoneSDK")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Shared.IOS.ESVideoPhoneSDK")] +[assembly: AssemblyCopyright("Copyright 漏 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.1")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_answer.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_answer.png new file mode 100644 index 0000000..0e1ed8a --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_answer.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_back.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_back.png new file mode 100644 index 0000000..798d1d8 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_back.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_select.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_select.png new file mode 100644 index 0000000..d0c461a --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_select.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_unselect.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_unselect.png new file mode 100644 index 0000000..d882547 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_collect_unselect.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_hangup.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_hangup.png new file mode 100644 index 0000000..6630e1a --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_hangup.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_home.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_home.png new file mode 100644 index 0000000..00b8028 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_home.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_more.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_more.png new file mode 100644 index 0000000..ce341f9 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_more.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_select.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_select.png new file mode 100644 index 0000000..7bd1c04 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_select.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_unselect.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_unselect.png new file mode 100644 index 0000000..be30904 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_takephoto_unselect.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_select.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_select.png new file mode 100644 index 0000000..03e20c5 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_select.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_unselect.png b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_unselect.png new file mode 100644 index 0000000..996941e --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Resources/ic_esvideo_unlock_unselect.png Binary files differ diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Shared.IOS.ESVideoPhoneSDK.csproj b/xamarin/Shared.IOS.ESVideoPhoneSDK/Shared.IOS.ESVideoPhoneSDK.csproj new file mode 100644 index 0000000..f1da521 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Shared.IOS.ESVideoPhoneSDK.csproj @@ -0,0 +1,75 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ProjectGuid>{7953874A-23FD-4619-9F31-D8AE312DAC3C}</ProjectGuid> + <TemplateGuid>{b6f3ff35-79b2-4f25-a2fc-60a7cf61013b}</TemplateGuid> + <OutputType>Library</OutputType> + <RootNamespace>Shared.IOS.ESVideoPhoneSDK</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>Shared.IOS.ESVideoPhoneSDK</AssemblyName> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingApiDefinition Include="ApiDefinition.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingCoreSource Include="Structs.cs" /> + </ItemGroup> + <ItemGroup> + <NativeReference Include="Library\libESVideoPhoneSDKXamarin.a"> + <Kind>Static</Kind> + <LinkerFlags>-ObjC -Wl -all_load -lz -lbz2 -liconv.2.4.0</LinkerFlags> + <Frameworks></Frameworks> + </NativeReference> + <NativeReference Include="Library\ESVideoPhoneSDk.a"> + <Kind>Static</Kind> + <LinkerFlags></LinkerFlags> + <SmartLink>False</SmartLink> + </NativeReference> + </ItemGroup> + <ItemGroup> + <BundleResource Include="Resources\ic_esvideo_answer.png" /> + <BundleResource Include="Resources\ic_esvideo_back.png" /> + <BundleResource Include="Resources\ic_esvideo_collect_select.png" /> + <BundleResource Include="Resources\ic_esvideo_collect_unselect.png" /> + <BundleResource Include="Resources\ic_esvideo_hangup.png" /> + <BundleResource Include="Resources\ic_esvideo_home.png" /> + <BundleResource Include="Resources\ic_esvideo_more.png" /> + <BundleResource Include="Resources\ic_esvideo_takephoto_select.png" /> + <BundleResource Include="Resources\ic_esvideo_takephoto_unselect.png" /> + <BundleResource Include="Resources\ic_esvideo_unlock_select.png" /> + <BundleResource Include="Resources\ic_esvideo_unlock_unselect.png" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/xamarin/Shared.IOS.ESVideoPhoneSDK/Structs.cs b/xamarin/Shared.IOS.ESVideoPhoneSDK/Structs.cs new file mode 100644 index 0000000..e7b46d2 --- /dev/null +++ b/xamarin/Shared.IOS.ESVideoPhoneSDK/Structs.cs @@ -0,0 +1,6 @@ +锘縰sing System; + +namespace Shared.IOS.ESVideoPhoneSDK +{ +} + -- Gitblit v1.8.0