mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-08-22 23:32:50 +00:00
Sender SDK
This commit is contained in:
parent
fdbefc63e0
commit
afc46f3022
147 changed files with 17638 additions and 114 deletions
8
sdk/sender/examples/ios/.gitignore
vendored
Normal file
8
sdk/sender/examples/ios/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/FCast.xcframework/ios-arm64-simulator/
|
||||
/FCast.xcframework
|
||||
/FCast\ Sender.xcodeproj/xcuserdata/
|
||||
/FCast\ Sender.xcodeproj/project.xcworkspace/xcuserdata
|
||||
/.DS_Store
|
||||
/fcast_sender_sdkFFI.h
|
||||
/fcast_sender_sdk.swift
|
||||
/fcast_sender_sdk.xcframework
|
613
sdk/sender/examples/ios/FCast Sender.xcodeproj/project.pbxproj
Normal file
613
sdk/sender/examples/ios/FCast Sender.xcodeproj/project.pbxproj
Normal file
|
@ -0,0 +1,613 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2C0D5A332E43787700DE5418 /* CodeScanner in Frameworks */ = {isa = PBXBuildFile; productRef = 2C0D5A322E43787700DE5418 /* CodeScanner */; };
|
||||
2CE96CDC2E46221100386DB8 /* fcast_sender_sdk.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE96CDA2E46221100386DB8 /* fcast_sender_sdk.xcframework */; };
|
||||
2CE96CDD2E46221100386DB8 /* fcast_sender_sdk.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE96CD92E46221100386DB8 /* fcast_sender_sdk.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
FE492A182DF43428005DA314 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE492A022DF43426005DA314 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = FE492A092DF43426005DA314;
|
||||
remoteInfo = "FCast Sender";
|
||||
};
|
||||
FE492A222DF43428005DA314 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = FE492A022DF43426005DA314 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = FE492A092DF43426005DA314;
|
||||
remoteInfo = "FCast Sender";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
FE5977C32DF448FF00115F46 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2C10DED52E37B5E7000C85F7 /* FCastSender-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FCastSender-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
2CE96CD92E46221100386DB8 /* fcast_sender_sdk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = fcast_sender_sdk.swift; sourceTree = "<group>"; };
|
||||
2CE96CDA2E46221100386DB8 /* fcast_sender_sdk.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = fcast_sender_sdk.xcframework; sourceTree = "<group>"; };
|
||||
2CE96CDB2E46221100386DB8 /* fcast_sender_sdkFFI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fcast_sender_sdkFFI.h; sourceTree = "<group>"; };
|
||||
FE5977C02DF448FF00115F46 /* FCast Sender.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FCast Sender.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FE5977D22DF5B8F600115F46 /* FCast SenderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FCast SenderTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FE5977D32DF5B8F600115F46 /* FCast SenderUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FCast SenderUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
FE492A0C2DF43426005DA314 /* FCast Sender */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "FCast Sender";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE492A1A2DF43428005DA314 /* FCast SenderTests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "FCast SenderTests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FE492A242DF43428005DA314 /* FCast SenderUITests */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
path = "FCast SenderUITests";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
FE492A072DF43426005DA314 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2C0D5A332E43787700DE5418 /* CodeScanner in Frameworks */,
|
||||
2CE96CDC2E46221100386DB8 /* fcast_sender_sdk.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A142DF43428005DA314 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A1E2DF43428005DA314 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
FE492A012DF43426005DA314 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C10DED52E37B5E7000C85F7 /* FCastSender-Bridging-Header.h */,
|
||||
FE492A0C2DF43426005DA314 /* FCast Sender */,
|
||||
FE492A1A2DF43428005DA314 /* FCast SenderTests */,
|
||||
FE492A242DF43428005DA314 /* FCast SenderUITests */,
|
||||
FE5977C02DF448FF00115F46 /* FCast Sender.app */,
|
||||
FE5977D22DF5B8F600115F46 /* FCast SenderTests.xctest */,
|
||||
FE5977D32DF5B8F600115F46 /* FCast SenderUITests.xctest */,
|
||||
2CE96CD92E46221100386DB8 /* fcast_sender_sdk.swift */,
|
||||
2CE96CDA2E46221100386DB8 /* fcast_sender_sdk.xcframework */,
|
||||
2CE96CDB2E46221100386DB8 /* fcast_sender_sdkFFI.h */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
FE492A092DF43426005DA314 /* FCast Sender */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = FE492A2B2DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast Sender" */;
|
||||
buildPhases = (
|
||||
FE492A062DF43426005DA314 /* Sources */,
|
||||
FE492A072DF43426005DA314 /* Frameworks */,
|
||||
FE492A082DF43426005DA314 /* Resources */,
|
||||
FE5977C32DF448FF00115F46 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
FE492A0C2DF43426005DA314 /* FCast Sender */,
|
||||
);
|
||||
name = "FCast Sender";
|
||||
packageProductDependencies = (
|
||||
2C0D5A322E43787700DE5418 /* CodeScanner */,
|
||||
);
|
||||
productName = "FCast Sender";
|
||||
productReference = FE5977C02DF448FF00115F46 /* FCast Sender.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
FE492A162DF43428005DA314 /* FCast SenderTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = FE492A2E2DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast SenderTests" */;
|
||||
buildPhases = (
|
||||
FE492A132DF43428005DA314 /* Sources */,
|
||||
FE492A142DF43428005DA314 /* Frameworks */,
|
||||
FE492A152DF43428005DA314 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
FE492A192DF43428005DA314 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
FE492A1A2DF43428005DA314 /* FCast SenderTests */,
|
||||
);
|
||||
name = "FCast SenderTests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "FCast SenderTests";
|
||||
productReference = FE5977D22DF5B8F600115F46 /* FCast SenderTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
FE492A202DF43428005DA314 /* FCast SenderUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = FE492A312DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast SenderUITests" */;
|
||||
buildPhases = (
|
||||
FE492A1D2DF43428005DA314 /* Sources */,
|
||||
FE492A1E2DF43428005DA314 /* Frameworks */,
|
||||
FE492A1F2DF43428005DA314 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
FE492A232DF43428005DA314 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
FE492A242DF43428005DA314 /* FCast SenderUITests */,
|
||||
);
|
||||
name = "FCast SenderUITests";
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = "FCast SenderUITests";
|
||||
productReference = FE5977D32DF5B8F600115F46 /* FCast SenderUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
FE492A022DF43426005DA314 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1640;
|
||||
LastUpgradeCheck = 1640;
|
||||
TargetAttributes = {
|
||||
FE492A092DF43426005DA314 = {
|
||||
CreatedOnToolsVersion = 16.4;
|
||||
};
|
||||
FE492A162DF43428005DA314 = {
|
||||
CreatedOnToolsVersion = 16.4;
|
||||
TestTargetID = FE492A092DF43426005DA314;
|
||||
};
|
||||
FE492A202DF43428005DA314 = {
|
||||
CreatedOnToolsVersion = 16.4;
|
||||
TestTargetID = FE492A092DF43426005DA314;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = FE492A052DF43426005DA314 /* Build configuration list for PBXProject "FCast Sender" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = FE492A012DF43426005DA314;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
packageReferences = (
|
||||
2C0D5A312E43787700DE5418 /* XCRemoteSwiftPackageReference "CodeScanner" */,
|
||||
);
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = FE492A012DF43426005DA314;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
FE492A092DF43426005DA314 /* FCast Sender */,
|
||||
FE492A162DF43428005DA314 /* FCast SenderTests */,
|
||||
FE492A202DF43428005DA314 /* FCast SenderUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
FE492A082DF43426005DA314 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A152DF43428005DA314 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A1F2DF43428005DA314 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
FE492A062DF43426005DA314 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2CE96CDD2E46221100386DB8 /* fcast_sender_sdk.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A132DF43428005DA314 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE492A1D2DF43428005DA314 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
FE492A192DF43428005DA314 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = FE492A092DF43426005DA314 /* FCast Sender */;
|
||||
targetProxy = FE492A182DF43428005DA314 /* PBXContainerItemProxy */;
|
||||
};
|
||||
FE492A232DF43428005DA314 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = FE492A092DF43426005DA314 /* FCast Sender */;
|
||||
targetProxy = FE492A222DF43428005DA314 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
FE492A292DF43428005DA314 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
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;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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 = 18.5;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FE492A2A2DF43428005DA314 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
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;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
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 = 18.5;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
FE492A2C2DF43428005DA314 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y29P2S6Z53;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "FCast-Sender-Info.plist";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-Sender";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
"SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "FCastSender-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FE492A2D2DF43428005DA314 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = Y29P2S6Z53;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "FCast-Sender-Info.plist";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-Sender";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
"SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "FCastSender-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
FE492A2F2DF43428005DA314 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-SenderTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FCast Sender.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/FCast Sender";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FE492A302DF43428005DA314 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-SenderTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FCast Sender.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/FCast Sender";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
FE492A322DF43428005DA314 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-SenderUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = "FCast Sender";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FE492A332DF43428005DA314 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "FUTO.FCast-SenderUITests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = "FCast Sender";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
FE492A052DF43426005DA314 /* Build configuration list for PBXProject "FCast Sender" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
FE492A292DF43428005DA314 /* Debug */,
|
||||
FE492A2A2DF43428005DA314 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
FE492A2B2DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast Sender" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
FE492A2C2DF43428005DA314 /* Debug */,
|
||||
FE492A2D2DF43428005DA314 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
FE492A2E2DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast SenderTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
FE492A2F2DF43428005DA314 /* Debug */,
|
||||
FE492A302DF43428005DA314 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
FE492A312DF43428005DA314 /* Build configuration list for PBXNativeTarget "FCast SenderUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
FE492A322DF43428005DA314 /* Debug */,
|
||||
FE492A332DF43428005DA314 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
2C0D5A312E43787700DE5418 /* XCRemoteSwiftPackageReference "CodeScanner" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/twostraws/CodeScanner.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.5.2;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
2C0D5A322E43787700DE5418 /* CodeScanner */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 2C0D5A312E43787700DE5418 /* XCRemoteSwiftPackageReference "CodeScanner" */;
|
||||
productName = CodeScanner;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = FE492A022DF43426005DA314 /* Project object */;
|
||||
}
|
7
sdk/sender/examples/ios/FCast Sender.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
sdk/sender/examples/ios/FCast Sender.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "tinted"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
21
sdk/sender/examples/ios/FCast Sender/Assets.xcassets/airplay-icon.imageset/Contents.json
vendored
Normal file
21
sdk/sender/examples/ios/FCast Sender/Assets.xcassets/airplay-icon.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "airplay-svgrepo-com.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5 16.9866C4.67275 16.9698 4.43855 16.9322 4.23463 16.8478C3.74458 16.6448 3.35523 16.2554 3.15224 15.7654C3 15.3978 3 14.9319 3 14V7.2C3 6.0799 3 5.51984 3.21799 5.09202C3.40973 4.71569 3.71569 4.40973 4.09202 4.21799C4.51984 4 5.0799 4 6.2 4H17.8C18.9201 4 19.4802 4 19.908 4.21799C20.2843 4.40973 20.5903 4.71569 20.782 5.09202C21 5.51984 21 6.0799 21 7.2V14C21 14.9319 21 15.3978 20.8478 15.7654C20.6448 16.2554 20.2554 16.6448 19.7654 16.8478C19.5615 16.9322 19.3273 16.9698 19 16.9866M9.14074 20H14.8593C15.4237 20 15.706 20 15.8367 19.875C15.9501 19.7666 16.0103 19.6039 15.9986 19.4375C15.9851 19.2456 15.7855 19.0222 15.3863 18.5753L12.5271 15.3741C12.3426 15.1675 12.2503 15.0642 12.144 15.0255C12.0504 14.9915 11.9496 14.9915 11.856 15.0255C11.7497 15.0642 11.6574 15.1675 11.4729 15.3741L8.61365 18.5753C8.2145 19.0222 8.01492 19.2456 8.00144 19.4375C7.98974 19.6039 8.04992 19.7666 8.16332 19.875C8.29401 20 8.57626 20 9.14074 20Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
21
sdk/sender/examples/ios/FCast Sender/Assets.xcassets/chromecast-icon.imageset/Contents.json
vendored
Normal file
21
sdk/sender/examples/ios/FCast Sender/Assets.xcassets/chromecast-icon.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "chromecast-brands-solid-full.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 128L128.2 128C104.6 128 85.5 147.1 85.5 170.7L85.5 234.6L128.2 234.6L128.2 170.7L512 170.7L512 469.3L362.8 469.3L362.8 512L512.2 512C535.8 512 554.9 492.9 554.9 469.3L554.9 170.7C554.9 147.1 535.6 128 512 128zM85.5 447.6L85.5 511.5L149.4 511.5C149.4 476.2 120.8 447.6 85.5 447.6zM85.5 362.6L85.5 405C144.4 405 192.1 453.1 192.1 512L234.8 512C234.9 429.6 167.9 362.7 85.5 362.6zM277.6 512L320.3 512C319.8 382.5 215 277.7 85.5 277.4L85.5 319.8C191.5 319.6 277.5 406 277.6 512z"/></svg>
|
After Width: | Height: | Size: 710 B |
605
sdk/sender/examples/ios/FCast Sender/ContentView.swift
Normal file
605
sdk/sender/examples/ios/FCast Sender/ContentView.swift
Normal file
|
@ -0,0 +1,605 @@
|
|||
import Network
|
||||
import PhotosUI
|
||||
import SwiftUI
|
||||
import System
|
||||
import CodeScanner
|
||||
|
||||
final class DevEventHandler: DeviceEventHandler {
|
||||
let onStateChanged: @Sendable (DeviceConnectionState) -> Void
|
||||
let dataModel: DataModel
|
||||
|
||||
init(
|
||||
onStateChanged: @Sendable @escaping (DeviceConnectionState) -> Void,
|
||||
dataModel: DataModel
|
||||
) {
|
||||
self.onStateChanged = onStateChanged
|
||||
self.dataModel = dataModel
|
||||
}
|
||||
|
||||
func connectionStateChanged(state: DeviceConnectionState) {
|
||||
onStateChanged(state)
|
||||
}
|
||||
|
||||
func volumeChanged(volume: Double) {
|
||||
DispatchQueue.main.async {
|
||||
self.dataModel.volume = volume
|
||||
}
|
||||
}
|
||||
|
||||
func timeChanged(time: Double) {
|
||||
DispatchQueue.main.async {
|
||||
self.dataModel.time = time
|
||||
}
|
||||
}
|
||||
|
||||
func playbackStateChanged(state: PlaybackState) {}
|
||||
|
||||
func durationChanged(duration: Double) {
|
||||
DispatchQueue.main.async {
|
||||
self.dataModel.duration = duration
|
||||
}
|
||||
}
|
||||
|
||||
func speedChanged(speed: Double) {
|
||||
DispatchQueue.main.async {
|
||||
self.dataModel.speed = speed
|
||||
}
|
||||
}
|
||||
|
||||
func sourceChanged(source: Source) {}
|
||||
|
||||
func keyEvent(event: GenericKeyEvent) {}
|
||||
|
||||
func mediaEvent(event: GenericMediaEvent) {}
|
||||
|
||||
func playbackError(message: String) {
|
||||
print("Playback error: \(message)")
|
||||
}
|
||||
}
|
||||
|
||||
final class NWDeviceDiscoverer {
|
||||
private var ctx: CastContext
|
||||
private var fCastBrowser: NWBrowser
|
||||
private var chromecastBrowser: NWBrowser
|
||||
|
||||
init(
|
||||
context: CastContext,
|
||||
onAdded: @escaping (FoundDevice) -> Void,
|
||||
onRemoved: @escaping (NWEndpoint) -> Void,
|
||||
) {
|
||||
ctx = context
|
||||
fCastBrowser = NWBrowser(
|
||||
for: .bonjourWithTXTRecord(type: "_fcast._tcp", domain: nil),
|
||||
using: .tcp
|
||||
)
|
||||
chromecastBrowser = NWBrowser(
|
||||
for: .bonjourWithTXTRecord(type: "_googlecast._tcp", domain: nil),
|
||||
using: .tcp
|
||||
)
|
||||
|
||||
fCastBrowser.browseResultsChangedHandler = { newResults, changes in
|
||||
for result in changes {
|
||||
switch result {
|
||||
case .added(let added):
|
||||
if case .service(let name, _, _, _) = added.endpoint {
|
||||
onAdded(
|
||||
FoundDevice(
|
||||
name: name,
|
||||
endpoint: added.endpoint,
|
||||
proto: ProtocolType.fCast
|
||||
)
|
||||
)
|
||||
}
|
||||
case .removed(let removed):
|
||||
onRemoved(removed.endpoint)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
chromecastBrowser.browseResultsChangedHandler = { newResults, changes in
|
||||
for result in changes {
|
||||
switch result {
|
||||
case .added(let added):
|
||||
if case .service(var name, _, _, _) = added.endpoint {
|
||||
if case .bonjour(let txt) = added.metadata,
|
||||
let maybeFriendlyNameData = txt.getEntry(for: "fn"),
|
||||
let friendlyNameData = maybeFriendlyNameData.data,
|
||||
let friendlyName = String(
|
||||
data: friendlyNameData,
|
||||
encoding: .utf8
|
||||
)
|
||||
{
|
||||
name = friendlyName
|
||||
}
|
||||
onAdded(
|
||||
FoundDevice(
|
||||
name: name,
|
||||
endpoint: added.endpoint,
|
||||
proto: ProtocolType.chromecast
|
||||
)
|
||||
)
|
||||
}
|
||||
case .removed(let removed):
|
||||
onRemoved(removed.endpoint)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fCastBrowser.start(queue: .main)
|
||||
chromecastBrowser.start(queue: .main)
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
@ObservedObject var dataModel: DataModel
|
||||
var castContext: CastContext
|
||||
var discoverer: NWDeviceDiscoverer
|
||||
@State var activeDevice: CastingDevice? = nil
|
||||
var eventHandler: DevEventHandler
|
||||
@State var selectedMediaItem: PhotosPickerItem? = nil
|
||||
@State var isImportingFile = false
|
||||
@State var isShowingMediaPicker = false
|
||||
@State var activeFileHandle: FileHandle? = nil
|
||||
var fileServer: FileServer
|
||||
@State var isShowingErrorAlert = false
|
||||
@State var errorAlertMessage = ""
|
||||
|
||||
init(data: DataModel) throws {
|
||||
initLogger(levelFilter: LogLevelFilter.debug)
|
||||
dataModel = data
|
||||
castContext = try CastContext()
|
||||
fileServer = castContext.startFileServer()
|
||||
discoverer = NWDeviceDiscoverer(
|
||||
context: castContext,
|
||||
onAdded: { found in
|
||||
data.devices.append(found)
|
||||
},
|
||||
onRemoved: { endpoint in
|
||||
data.devices.removeAll { it in
|
||||
it.endpoint == endpoint
|
||||
}
|
||||
}
|
||||
)
|
||||
eventHandler = DevEventHandler(
|
||||
onStateChanged: { state in
|
||||
switch state {
|
||||
case .connected(usedRemoteAddr: _, let localAddr):
|
||||
DispatchQueue.main.async {
|
||||
data.sheetState = SheetState.connected
|
||||
data.usedLocalAddress = localAddr
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
dataModel: data,
|
||||
)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack {
|
||||
if activeDevice != nil {
|
||||
Button("Cast local file") {
|
||||
isShowingMediaPicker.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.sheet(isPresented: $isShowingMediaPicker) {
|
||||
MediaPicker { contentType, localFileURL in
|
||||
if let handle = try? FileHandle(
|
||||
forReadingFrom: localFileURL
|
||||
) {
|
||||
self.activeFileHandle = handle
|
||||
Task {
|
||||
if let activeDevice = self.activeDevice,
|
||||
let usedLocalAddress = dataModel
|
||||
.usedLocalAddress
|
||||
{
|
||||
do {
|
||||
let entry = try self.fileServer.serveFile(
|
||||
fd: handle.fileDescriptor
|
||||
)
|
||||
let url =
|
||||
"http://\(urlFormatIpAddr(addr: usedLocalAddress)):\(entry.port)/\(entry.location)"
|
||||
try activeDevice.load(request: .url(contentType: contentType, url: url))
|
||||
} catch {
|
||||
print("Failed to serve file")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} onError: { message in
|
||||
errorAlertMessage = message
|
||||
isShowingErrorAlert.toggle()
|
||||
}
|
||||
}
|
||||
.alert(errorAlertMessage, isPresented: $isShowingErrorAlert) {
|
||||
Button("OK", role: .cancel) {}
|
||||
}
|
||||
.toolbar {
|
||||
Button(action: {
|
||||
dataModel.isShowingSheet.toggle()
|
||||
}) {
|
||||
Image("chromecast-icon")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(maxWidth: 64)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $dataModel.isShowingSheet) {
|
||||
switch dataModel.sheetState {
|
||||
case .deviceList:
|
||||
DeviceList(
|
||||
devices: dataModel.devices,
|
||||
onConnect: { device in
|
||||
dataModel.sheetState = SheetState.connecting(
|
||||
deviceName: device.name
|
||||
)
|
||||
Task {
|
||||
let conn = NWConnection(
|
||||
to: device.endpoint,
|
||||
using: .tcp
|
||||
)
|
||||
conn.stateUpdateHandler = { state in
|
||||
switch state {
|
||||
case .ready:
|
||||
if let innerEndpoint = conn.currentPath?
|
||||
.remoteEndpoint,
|
||||
case .hostPort(let host, let port) =
|
||||
innerEndpoint
|
||||
{
|
||||
switch host {
|
||||
default:
|
||||
break
|
||||
}
|
||||
let address: IpAddr
|
||||
switch host {
|
||||
case .ipv4(let addr):
|
||||
let raw = addr.rawValue
|
||||
address = IpAddr.v4(
|
||||
o1: raw[0],
|
||||
o2: raw[1],
|
||||
o3: raw[2],
|
||||
o4: raw[3]
|
||||
)
|
||||
case .ipv6(let addr):
|
||||
let raw = addr.rawValue
|
||||
address = IpAddr.v6(
|
||||
o1: raw[0],
|
||||
o2: raw[1],
|
||||
o3: raw[2],
|
||||
o4: raw[3],
|
||||
o5: raw[4],
|
||||
o6: raw[5],
|
||||
o7: raw[6],
|
||||
o8: raw[7],
|
||||
o9: raw[8],
|
||||
o10: raw[9],
|
||||
o11: raw[10],
|
||||
o12: raw[11],
|
||||
o13: raw[12],
|
||||
o14: raw[13],
|
||||
o15: raw[14],
|
||||
o16: raw[15],
|
||||
scopeId: UInt32(addr.interface?.index ?? 0)
|
||||
)
|
||||
default:
|
||||
DispatchQueue.main.async {
|
||||
dataModel.sheetState =
|
||||
SheetState.failedToConnect(
|
||||
deviceName: device.name,
|
||||
reason:
|
||||
"No address available"
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
let info = DeviceInfo(
|
||||
name: device.name,
|
||||
protocol: device.proto,
|
||||
addresses: [address],
|
||||
port: port.rawValue
|
||||
)
|
||||
activeDevice =
|
||||
castContext.createDeviceFromInfo(
|
||||
info: info
|
||||
)
|
||||
do {
|
||||
try activeDevice?.connect(
|
||||
appInfo: nil,
|
||||
eventHandler: eventHandler
|
||||
)
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
dataModel.sheetState =
|
||||
SheetState.failedToConnect(
|
||||
deviceName: device.name,
|
||||
reason: "Unknown"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
conn.start(queue: .global())
|
||||
}
|
||||
},
|
||||
onConnectScanned: { scannedDeviceInfo in
|
||||
activeDevice =
|
||||
castContext.createDeviceFromInfo(
|
||||
info: scannedDeviceInfo
|
||||
)
|
||||
do {
|
||||
try activeDevice?.connect(
|
||||
appInfo: nil,
|
||||
eventHandler: eventHandler
|
||||
)
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
dataModel.sheetState =
|
||||
SheetState.failedToConnect(
|
||||
deviceName: scannedDeviceInfo.name,
|
||||
reason: "Unknown"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
.presentationDetents([.medium, .large])
|
||||
case .connecting(let deviceName):
|
||||
VStack {
|
||||
ProgressView("Connecting to \(deviceName)")
|
||||
.progressViewStyle(CircularProgressViewStyle())
|
||||
Button(action: {
|
||||
}) {
|
||||
Text("Cancel")
|
||||
}
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
case .failedToConnect(let deviceName, let reason):
|
||||
VStack {
|
||||
Text("Failed to connect to \(deviceName)")
|
||||
Text("Reason: \(reason)")
|
||||
}
|
||||
.presentationDetents([.medium])
|
||||
.onDisappear {
|
||||
dataModel.sheetState = SheetState.deviceList
|
||||
}
|
||||
case .connected:
|
||||
VStack {
|
||||
if let devName = activeDevice?.name() {
|
||||
(Text("Connected to ") + Text(devName).bold())
|
||||
.padding(.top)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Text("Position")
|
||||
Slider(
|
||||
value: $dataModel.time,
|
||||
in: 0.0...dataModel.duration,
|
||||
onEditingChanged: { editing in
|
||||
if !editing {
|
||||
do {
|
||||
try activeDevice?.seek(
|
||||
timeSeconds: dataModel.time
|
||||
)
|
||||
} catch {
|
||||
print("Failed to seek")
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
Text("Volume")
|
||||
Slider(
|
||||
value: $dataModel.volume,
|
||||
in: 0.0...1.0,
|
||||
onEditingChanged: { editing in
|
||||
if !editing {
|
||||
do {
|
||||
try activeDevice?.changeVolume(
|
||||
volume: dataModel.volume
|
||||
)
|
||||
} catch {
|
||||
print("Failed to change volume")
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
do {
|
||||
try activeDevice?.pausePlayback()
|
||||
} catch {
|
||||
print("Failed to pause playback")
|
||||
}
|
||||
}) {
|
||||
Image(systemName: "pause").font(.system(size: 42))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
do {
|
||||
try activeDevice?.resumePlayback()
|
||||
} catch {
|
||||
print("Failed to resume playback")
|
||||
}
|
||||
}) {
|
||||
Image(systemName: "play").font(.system(size: 42))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
do {
|
||||
try activeDevice?.stopPlayback()
|
||||
} catch {
|
||||
print("Failed to stop playback")
|
||||
}
|
||||
}) {
|
||||
Image(systemName: "stop").font(.system(size: 42))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("Disconnect") {
|
||||
do {
|
||||
try activeDevice?.disconnect()
|
||||
} catch {
|
||||
print("Failed to disconnect device")
|
||||
}
|
||||
activeDevice = nil
|
||||
dataModel.sheetState = SheetState.deviceList
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DeviceList: View {
|
||||
var devices: [FoundDevice]
|
||||
var onConnect: (FoundDevice) -> Void
|
||||
var onConnectScanned: (DeviceInfo) -> Void
|
||||
@State var isPresentingQrScanner = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List(devices, id: \.name) { device in
|
||||
Button(action: {
|
||||
onConnect(device)
|
||||
}) {
|
||||
HStack {
|
||||
// TODO: change these icons
|
||||
switch device.proto {
|
||||
case .chromecast:
|
||||
Image("chromecast-icon")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(maxWidth: 32)
|
||||
default:
|
||||
Image(systemName: "questionmark.app.dashed")
|
||||
}
|
||||
Text(device.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text("Not seeing your receiver?")
|
||||
|
||||
Button("Scan QR", systemImage: "qrcode.viewfinder") {
|
||||
isPresentingQrScanner.toggle()
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $isPresentingQrScanner) {
|
||||
CodeScannerView(codeTypes: [.qr]) { response in
|
||||
if case let .success(result) = response {
|
||||
isPresentingQrScanner = false
|
||||
if let deviceInfo = deviceInfoFromUrl(url: result.string) {
|
||||
onConnectScanned(deviceInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MediaPicker: UIViewControllerRepresentable {
|
||||
var onComplete: (String, URL) -> Void
|
||||
var onError: (String) -> Void
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
Coordinator(onComplete: onComplete, onError: onError)
|
||||
}
|
||||
|
||||
func makeUIViewController(context: Context) -> PHPickerViewController {
|
||||
var config = PHPickerConfiguration(photoLibrary: .shared())
|
||||
config.filter = .any(of: [.images, .videos])
|
||||
config.selectionLimit = 1
|
||||
|
||||
let picker = PHPickerViewController(configuration: config)
|
||||
picker.delegate = context.coordinator
|
||||
return picker
|
||||
}
|
||||
|
||||
func updateUIViewController(
|
||||
_ uiViewController: PHPickerViewController,
|
||||
context: Context
|
||||
) {}
|
||||
|
||||
class Coordinator: NSObject, PHPickerViewControllerDelegate {
|
||||
let onComplete: (String, URL) -> Void
|
||||
let onError: (String) -> Void
|
||||
|
||||
init(onComplete: @escaping (String, URL) -> Void, onError: @escaping (String) -> Void) {
|
||||
self.onComplete = onComplete
|
||||
self.onError = onError
|
||||
}
|
||||
|
||||
func picker(
|
||||
_ picker: PHPickerViewController,
|
||||
didFinishPicking results: [PHPickerResult]
|
||||
) {
|
||||
picker.dismiss(animated: true)
|
||||
guard let item = results.first?.itemProvider else { return }
|
||||
print(item.registeredContentTypes)
|
||||
guard
|
||||
var contentType = item
|
||||
.registeredContentTypes
|
||||
.makeIterator()
|
||||
.map({ it in return it.preferredMIMEType })
|
||||
.filter({ it in it != nil })
|
||||
.first ?? "application/octet-stream"
|
||||
else {
|
||||
print("Unable to get content type")
|
||||
return
|
||||
}
|
||||
if contentType == "video/quicktime" {
|
||||
contentType = "video/mp4"
|
||||
}
|
||||
|
||||
let matchingTypes = [
|
||||
UTType.image.identifier,
|
||||
UTType.movie.identifier,
|
||||
]
|
||||
for typeId in matchingTypes {
|
||||
if item.hasItemConformingToTypeIdentifier(typeId) {
|
||||
item.loadFileRepresentation(forTypeIdentifier: typeId) {
|
||||
tempURL,
|
||||
maybeError in
|
||||
if let error = maybeError {
|
||||
self.onError(error.localizedDescription)
|
||||
return
|
||||
}
|
||||
guard let tempURL = tempURL else {
|
||||
self.onError("Temporary URL is missing")
|
||||
return
|
||||
}
|
||||
self.onComplete(contentType, tempURL)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
42
sdk/sender/examples/ios/FCast Sender/FCast_SenderApp.swift
Normal file
42
sdk/sender/examples/ios/FCast Sender/FCast_SenderApp.swift
Normal file
|
@ -0,0 +1,42 @@
|
|||
import SwiftUI
|
||||
import Synchronization
|
||||
import Combine
|
||||
import Network
|
||||
|
||||
struct FoundDevice {
|
||||
var name: String
|
||||
var endpoint: NWEndpoint
|
||||
var proto: ProtocolType
|
||||
}
|
||||
|
||||
enum SheetState {
|
||||
case deviceList
|
||||
case connecting(deviceName: String)
|
||||
case failedToConnect(deviceName: String, reason: String)
|
||||
case connected
|
||||
}
|
||||
|
||||
@MainActor
|
||||
class DataModel: ObservableObject {
|
||||
@Published var playbackState = PlaybackState.idle
|
||||
@Published var volume = 1.0
|
||||
@Published var time = 0.0
|
||||
@Published var duration = 0.0
|
||||
@Published var speed = 1.0
|
||||
@Published var devices: Array<FoundDevice> = Array()
|
||||
@Published var showingDeviceList = false
|
||||
@Published var showingConnectingToDevice = false
|
||||
@Published var showingFailedToConnect = false
|
||||
@Published var isShowingSheet = false
|
||||
@Published var sheetState = SheetState.deviceList
|
||||
@Published var usedLocalAddress: IpAddr? = nil
|
||||
}
|
||||
|
||||
@main
|
||||
struct FCast_SenderApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
try! ContentView(data: DataModel())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import Testing
|
||||
@testable import FCast_Sender
|
||||
|
||||
struct FCast_SenderTests {
|
||||
|
||||
@Test func example() async throws {
|
||||
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
import XCTest
|
||||
|
||||
final class FCast_SenderUITests: XCTestCase {
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// 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.
|
||||
continueAfterFailure = false
|
||||
|
||||
// In UI tests it’s 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.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testExample() throws {
|
||||
// UI tests must launch the application that they test.
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunchPerformance() throws {
|
||||
// This measures how long it takes to launch your application.
|
||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
||||
XCUIApplication().launch()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import XCTest
|
||||
|
||||
final class FCast_SenderUITestsLaunchTests: XCTestCase {
|
||||
|
||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
override func setUpWithError() throws {
|
||||
continueAfterFailure = false
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func testLaunch() throws {
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
// Insert steps here to perform after app launch but before taking a screenshot,
|
||||
// such as logging into a test account or navigating somewhere in the app
|
||||
|
||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
||||
attachment.name = "Launch Screen"
|
||||
attachment.lifetime = .keepAlways
|
||||
add(attachment)
|
||||
}
|
||||
}
|
16
sdk/sender/examples/ios/FCast-Sender-Info.plist
Normal file
16
sdk/sender/examples/ios/FCast-Sender-Info.plist
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?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>NSCameraUsageDescription</key>
|
||||
<string>Scan QR code</string>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>We need to access your local network to automatically discover receivers</string>
|
||||
<key>NSBonjourServices</key>
|
||||
<array>
|
||||
<string>_googlecast._tcp</string>
|
||||
<string>_fcast._tcp</string>
|
||||
<string>_airplay._tcp</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
6
sdk/sender/examples/ios/FCastSender-Bridging-Header.h
Normal file
6
sdk/sender/examples/ios/FCastSender-Bridging-Header.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef FCastSender_Bridging_Header_h
|
||||
#define FCastSender_Bridging_Header_h
|
||||
|
||||
#import "fcast_sender_sdkFFI.h"
|
||||
|
||||
#endif /* FCastSender_Bridging_Header_h */
|
Loading…
Add table
Add a link
Reference in a new issue