From 7b9004cc3ac50cbe79f77a332c8c2288358f61b6 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 14 Jun 2025 23:51:09 +0200 Subject: [PATCH 01/35] initial skeleton --- Code/Adscript/README.md | 9 +++++ Code/Adscript/Source/AdscriptConnector.swift | 30 ++++++++++++++++ .../Source/integration/AdscriptAdapter.swift | 35 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 Code/Adscript/README.md create mode 100644 Code/Adscript/Source/AdscriptConnector.swift create mode 100644 Code/Adscript/Source/integration/AdscriptAdapter.swift diff --git a/Code/Adscript/README.md b/Code/Adscript/README.md new file mode 100644 index 00000000..a5775308 --- /dev/null +++ b/Code/Adscript/README.md @@ -0,0 +1,9 @@ +# THEOPlayer 🤝 Adscript + +THEOplayer-Connector-Adscript provides an integration between the THEOplayerSDK and Adscript. + +## Installation +TODO + +## Usage +TODO \ No newline at end of file diff --git a/Code/Adscript/Source/AdscriptConnector.swift b/Code/Adscript/Source/AdscriptConnector.swift new file mode 100644 index 00000000..7d840508 --- /dev/null +++ b/Code/Adscript/Source/AdscriptConnector.swift @@ -0,0 +1,30 @@ +import THEOplayerSDK +import AdScriptApiClient + +public struct AdscriptConfiguration { + let implementationId: String + let debug: Bool +} + +public struct AdscriptConnector { + public let adapter: AdscriptAdapter + public let player: THEOplayer + + + public init(configuration: AdscriptConfiguration, player: THEOplayer, metadata: AdScriptDataObject) { + self.player = player + self.adapter = AdscriptAdapter(configuration: configuration, player: player, metadata: metadata) + } + + public func sessionStart() { + self.adapter.sessionStart() + } + + public func update(metadata: AdScriptDataObject) { + self.adapter.update(metadata: metadata) + } + + public func updateUser(i12n: AdScriptI12n) { + self.adapter.updateUser(i12n: i12n) + } +} diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift new file mode 100644 index 00000000..7ffe0417 --- /dev/null +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -0,0 +1,35 @@ +import THEOplayerSDK +import AdScriptApiClient + +public struct AdscriptAdapter { + private let player: THEOplayer + private let contentMetadata: AdScriptDataObject + private let configuration: AdscriptConfiguration + private let adscriptCollector: AdScriptCollector + + public init(configuration: AdscriptConfiguration, player: THEOplayer, metadata: AdScriptDataObject) { + self.player = player + self.contentMetadata = metadata + self.configuration = configuration + + self.adscriptCollector = AdScriptCollector(implementationId: configuration.implementationId, isDebug: configuration.debug) + + addEventListeners() + } + + public func sessionStart() { + self.adscriptCollector.sessionStart() + } + + public func update(metadata: AdScriptDataObject) { + // TODO + } + + public func updateUser(i12n: AdScriptI12n) { + // TODO + } + + private func addEventListeners() { + // TODO + } +} From 93e5625a490555e655777766e3ae40ad16d00e77 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 14 Jun 2025 23:51:27 +0200 Subject: [PATCH 02/35] initial podspec --- THEOplayer-Connector-Adscript.podspec | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 THEOplayer-Connector-Adscript.podspec diff --git a/THEOplayer-Connector-Adscript.podspec b/THEOplayer-Connector-Adscript.podspec new file mode 100644 index 00000000..83bf2711 --- /dev/null +++ b/THEOplayer-Connector-Adscript.podspec @@ -0,0 +1,24 @@ +require_relative './THEOplayer-Connector-Version' + +Pod::Spec.new do |s| + s.name = 'THEOplayer-Connector-Adscript' + s.module_name = 'THEOplayerConnectorAdscript' + s.version = theoplayer_connector_version + s.summary = 'Integration between the THEOplayerSDK and Adscript' + + s.description = 'This pod gives you access to classes that let you report playback events from a THEOplayer instance to Adscript' + + s.homepage = 'https://github.com/THEOplayer/iOS-Connector' + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = "Dolby Laboratories" + s.source = { :git => 'https://github.com/THEOplayer/iOS-Connector.git', :tag => s.version.to_s } + + s.platforms = { :ios => "13.0", :tvos => "13.0" } + + s.source_files = 'Code/Adscript/Source/**/*' + + s.static_framework = true + s.swift_versions = ['5.3', '5.4', '5.5', '5.6', '5.7'] + s.dependency 'THEOplayerSDK-core', "~> 9" + s.dependency 'AdscriptApiClient', '>= 1.0.4' +end From 04c2af4c1e79de418cafc7b29153f637175bd9e2 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 14 Jun 2025 23:52:22 +0200 Subject: [PATCH 03/35] empty example app from template --- .../project.pbxproj | 617 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../contents.xcworkspacedata | 10 + .../AdscriptReporter/AppDelegate.swift | 36 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 35 + .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../Base.lproj/Main.storyboard | 24 + .../Cocoapod/AdscriptReporter/Info.plist | 25 + .../AdscriptReporter/SceneDelegate.swift | 52 ++ .../AdscriptReporter/ViewController.swift | 19 + Code/Adscript-Examples/README.md | 5 + 13 files changed, 872 insertions(+) create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcworkspace/contents.xcworkspacedata create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift create mode 100644 Code/Adscript-Examples/README.md diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj new file mode 100644 index 00000000..c2774f8e --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj @@ -0,0 +1,617 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 869D111A592EF8154DA1AB03 /* libPods-AdscriptReporter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F7AEAE2F99316EBC3A7E059A /* libPods-AdscriptReporter.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 29994EC92DFDC6DA0016F0E2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29994EAA2DFDC6D80016F0E2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 29994EB12DFDC6D80016F0E2; + remoteInfo = AdscriptReporter; + }; + 29994ED32DFDC6DA0016F0E2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29994EAA2DFDC6D80016F0E2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 29994EB12DFDC6D80016F0E2; + remoteInfo = AdscriptReporter; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 29994EB22DFDC6D80016F0E2 /* AdscriptReporter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdscriptReporter.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 29994EC82DFDC6DA0016F0E2 /* AdscriptReporterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdscriptReporterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 29994ED22DFDC6DA0016F0E2 /* AdscriptReporterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdscriptReporterUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7D223C4308E6BCF0F6785F8F /* Pods-AdscriptReporter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AdscriptReporter.debug.xcconfig"; path = "Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter.debug.xcconfig"; sourceTree = ""; }; + CA025FA0C60D148274C918BC /* Pods-AdscriptReporter.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AdscriptReporter.release.xcconfig"; path = "Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter.release.xcconfig"; sourceTree = ""; }; + F7AEAE2F99316EBC3A7E059A /* libPods-AdscriptReporter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AdscriptReporter.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 29994EDA2DFDC6DA0016F0E2 /* Exceptions for "AdscriptReporter" folder in "AdscriptReporter" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 29994EDA2DFDC6DA0016F0E2 /* Exceptions for "AdscriptReporter" folder in "AdscriptReporter" target */, + ); + path = AdscriptReporter; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 29994EAF2DFDC6D80016F0E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 869D111A592EF8154DA1AB03 /* libPods-AdscriptReporter.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994EC52DFDC6DA0016F0E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994ECF2DFDC6DA0016F0E2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 29994EA92DFDC6D80016F0E2 = { + isa = PBXGroup; + children = ( + 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */, + 29994EB32DFDC6D80016F0E2 /* Products */, + 2DEA1210CC5916F8004A4364 /* Pods */, + D1C02604FAF420079FE8B046 /* Frameworks */, + ); + sourceTree = ""; + }; + 29994EB32DFDC6D80016F0E2 /* Products */ = { + isa = PBXGroup; + children = ( + 29994EB22DFDC6D80016F0E2 /* AdscriptReporter.app */, + 29994EC82DFDC6DA0016F0E2 /* AdscriptReporterTests.xctest */, + 29994ED22DFDC6DA0016F0E2 /* AdscriptReporterUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2DEA1210CC5916F8004A4364 /* Pods */ = { + isa = PBXGroup; + children = ( + 7D223C4308E6BCF0F6785F8F /* Pods-AdscriptReporter.debug.xcconfig */, + CA025FA0C60D148274C918BC /* Pods-AdscriptReporter.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + D1C02604FAF420079FE8B046 /* Frameworks */ = { + isa = PBXGroup; + children = ( + F7AEAE2F99316EBC3A7E059A /* libPods-AdscriptReporter.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */ = { + isa = PBXNativeTarget; + buildConfigurationList = 29994EDB2DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporter" */; + buildPhases = ( + 6191FCA4F0B6655B3496C06F /* [CP] Check Pods Manifest.lock */, + 29994EAE2DFDC6D80016F0E2 /* Sources */, + 29994EAF2DFDC6D80016F0E2 /* Frameworks */, + 29994EB02DFDC6D80016F0E2 /* Resources */, + A31CD09B89FCD1875C0C920D /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */, + ); + name = AdscriptReporter; + productName = AdscriptReporter; + productReference = 29994EB22DFDC6D80016F0E2 /* AdscriptReporter.app */; + productType = "com.apple.product-type.application"; + }; + 29994EC72DFDC6DA0016F0E2 /* AdscriptReporterTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 29994EE02DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporterTests" */; + buildPhases = ( + 29994EC42DFDC6DA0016F0E2 /* Sources */, + 29994EC52DFDC6DA0016F0E2 /* Frameworks */, + 29994EC62DFDC6DA0016F0E2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 29994ECA2DFDC6DA0016F0E2 /* PBXTargetDependency */, + ); + name = AdscriptReporterTests; + productName = AdscriptReporterTests; + productReference = 29994EC82DFDC6DA0016F0E2 /* AdscriptReporterTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 29994ED12DFDC6DA0016F0E2 /* AdscriptReporterUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 29994EE32DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporterUITests" */; + buildPhases = ( + 29994ECE2DFDC6DA0016F0E2 /* Sources */, + 29994ECF2DFDC6DA0016F0E2 /* Frameworks */, + 29994ED02DFDC6DA0016F0E2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 29994ED42DFDC6DA0016F0E2 /* PBXTargetDependency */, + ); + name = AdscriptReporterUITests; + productName = AdscriptReporterUITests; + productReference = 29994ED22DFDC6DA0016F0E2 /* AdscriptReporterUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29994EAA2DFDC6D80016F0E2 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1640; + LastUpgradeCheck = 1640; + TargetAttributes = { + 29994EB12DFDC6D80016F0E2 = { + CreatedOnToolsVersion = 16.4; + }; + 29994EC72DFDC6DA0016F0E2 = { + CreatedOnToolsVersion = 16.4; + TestTargetID = 29994EB12DFDC6D80016F0E2; + }; + 29994ED12DFDC6DA0016F0E2 = { + CreatedOnToolsVersion = 16.4; + TestTargetID = 29994EB12DFDC6D80016F0E2; + }; + }; + }; + buildConfigurationList = 29994EAD2DFDC6D80016F0E2 /* Build configuration list for PBXProject "AdscriptReporter" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 29994EA92DFDC6D80016F0E2; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 29994EB32DFDC6D80016F0E2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */, + 29994EC72DFDC6DA0016F0E2 /* AdscriptReporterTests */, + 29994ED12DFDC6DA0016F0E2 /* AdscriptReporterUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 29994EB02DFDC6D80016F0E2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994EC62DFDC6DA0016F0E2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994ED02DFDC6DA0016F0E2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6191FCA4F0B6655B3496C06F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-AdscriptReporter-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + A31CD09B89FCD1875C0C920D /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 29994EAE2DFDC6D80016F0E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994EC42DFDC6DA0016F0E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29994ECE2DFDC6DA0016F0E2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 29994ECA2DFDC6DA0016F0E2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */; + targetProxy = 29994EC92DFDC6DA0016F0E2 /* PBXContainerItemProxy */; + }; + 29994ED42DFDC6DA0016F0E2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */; + targetProxy = 29994ED32DFDC6DA0016F0E2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 29994EDC2DFDC6DA0016F0E2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7D223C4308E6BCF0F6785F8F /* Pods-AdscriptReporter.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 29994EDD2DFDC6DA0016F0E2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CA025FA0C60D148274C918BC /* Pods-AdscriptReporter.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 29994EDE2DFDC6DA0016F0E2 /* 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; + }; + 29994EDF2DFDC6DA0016F0E2 /* 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; + }; + 29994EE12DFDC6DA0016F0E2 /* 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 = com.theoplayer.adscript.ios.integration.AdscriptReporterTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdscriptReporter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AdscriptReporter"; + }; + name = Debug; + }; + 29994EE22DFDC6DA0016F0E2 /* 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 = com.theoplayer.adscript.ios.integration.AdscriptReporterTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AdscriptReporter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/AdscriptReporter"; + }; + name = Release; + }; + 29994EE42DFDC6DA0016F0E2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporterUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = AdscriptReporter; + }; + name = Debug; + }; + 29994EE52DFDC6DA0016F0E2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporterUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = AdscriptReporter; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 29994EAD2DFDC6D80016F0E2 /* Build configuration list for PBXProject "AdscriptReporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 29994EDE2DFDC6DA0016F0E2 /* Debug */, + 29994EDF2DFDC6DA0016F0E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 29994EDB2DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 29994EDC2DFDC6DA0016F0E2 /* Debug */, + 29994EDD2DFDC6DA0016F0E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 29994EE02DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporterTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 29994EE12DFDC6DA0016F0E2 /* Debug */, + 29994EE22DFDC6DA0016F0E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 29994EE32DFDC6DA0016F0E2 /* Build configuration list for PBXNativeTarget "AdscriptReporterUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 29994EE42DFDC6DA0016F0E2 /* Debug */, + 29994EE52DFDC6DA0016F0E2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29994EAA2DFDC6D80016F0E2 /* Project object */; +} diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcworkspace/contents.xcworkspacedata b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..abee4e66 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift new file mode 100644 index 00000000..7595a9f8 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift @@ -0,0 +1,36 @@ +// +// AppDelegate.swift +// AdscriptReporter +// +// Created by Joosen, Wonne on 14/06/2025. +// + +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..23058801 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -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 + } +} diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard new file mode 100644 index 00000000..25a76385 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist new file mode 100644 index 00000000..dd3c9afd --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift new file mode 100644 index 00000000..c917c725 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift @@ -0,0 +1,52 @@ +// +// SceneDelegate.swift +// AdscriptReporter +// +// Created by Joosen, Wonne on 14/06/2025. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + guard let _ = (scene as? UIWindowScene) else { return } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift new file mode 100644 index 00000000..e8f3b83b --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift @@ -0,0 +1,19 @@ +// +// ViewController.swift +// AdscriptReporter +// +// Created by Joosen, Wonne on 14/06/2025. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + } + + +} + diff --git a/Code/Adscript-Examples/README.md b/Code/Adscript-Examples/README.md new file mode 100644 index 00000000..4869a10f --- /dev/null +++ b/Code/Adscript-Examples/README.md @@ -0,0 +1,5 @@ +# THEOPlayer 🤝 Adscript Samples + +We provide source code of two sample applications that illustrate how to use the connector with different package managers: + +- [Sample using **Cocoapods**](./Cocoapod) (requires Cocoapods installation through terminal) From e48ef6ef12fdf87becafec978b184c05dc8d15b6 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 14 Jun 2025 23:53:02 +0200 Subject: [PATCH 04/35] ignore imported adscript framework --- Code/Adscript-Examples/Cocoapod/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 Code/Adscript-Examples/Cocoapod/.gitignore diff --git a/Code/Adscript-Examples/Cocoapod/.gitignore b/Code/Adscript-Examples/Cocoapod/.gitignore new file mode 100644 index 00000000..a7f1f840 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/.gitignore @@ -0,0 +1 @@ +Frameworks/*.xcframework/ \ No newline at end of file From 00987a932e89c6e277d66cbe2f4c48f39230e499 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 14 Jun 2025 23:54:09 +0200 Subject: [PATCH 05/35] override AdscriptApiClient dependency with manually imported framework --- .../Frameworks/AdscriptApiClient.podspec | 38 +++++++++++++++++++ Code/Adscript-Examples/Cocoapod/Podfile | 13 +++++++ 2 files changed, 51 insertions(+) create mode 100644 Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec create mode 100644 Code/Adscript-Examples/Cocoapod/Podfile diff --git a/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec new file mode 100644 index 00000000..250a5982 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec @@ -0,0 +1,38 @@ +# +# Be sure to run `pod spec lint AdscriptApiClient.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +# info_plist_path = "./Frameworks/AdscriptApiClient.xcframework/ios-arm64/AdscriptApiClient.framework/Info.plist" +# info_cflist = CFPropertyList::List.new(:file => info_plist_path) +# info_plist = CFPropertyList.native_types(info_cflist.value) +# adscriptApiClientVersion = info_plist["CFBundleShortVersionString"] + +# puts "Detected AdscriptApiClient XCFramework" +# puts " - version #{theoadscriptApiClientVersionSdkVersion}" + +adscriptApiClientVersion = "1.0.4" + +Pod::Spec.new do |spec| + + spec.name = "AdscriptApiClient" + spec.version = adscriptApiClientVersion + spec.summary = "The Adscript Api Client for iOS" + + spec.description = "T" + + spec.homepage = "https://theoplayer.com" + spec.license = "MIT" + + spec.author = { "Wonne Joosen" => "wonne.joosen@dolby.com" } + + spec.source = { :git => "https://www.theoplayer.com/.git", :tag => "#{spec.version}" } + + spec.source_files = "Classes", "Classes/**/*.{h,m}" + + spec.ios.vendored_frameworks = "AdscriptApiClient.xcframework" + +end diff --git a/Code/Adscript-Examples/Cocoapod/Podfile b/Code/Adscript-Examples/Cocoapod/Podfile new file mode 100644 index 00000000..8a436795 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/Podfile @@ -0,0 +1,13 @@ +platform :ios, '13.0' + +target 'AdscriptReporter' do + # Use the AdscriptConnector that is locally defined in the parent directory + pod 'THEOplayer-Connector-Adscript', :path => '../../../' + pod 'AdscriptApiClient', :path => 'Frameworks/' + + # When you want to use a custom THEOplayerSDK build: + # - place your build at '../../../Helpers/TheoPod/Frameworks/THEOplayerSDK.xcframework' + # - uncomment the following line + # pod 'THEOplayerSDK-core', :path => '../../../Helpers/TheoPod' + +end From 1a20e82b67608d8aeac640194a9d8a4a4901ba36 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sun, 15 Jun 2025 00:00:51 +0200 Subject: [PATCH 06/35] private --- Code/Adscript/Source/AdscriptConnector.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Adscript/Source/AdscriptConnector.swift b/Code/Adscript/Source/AdscriptConnector.swift index 7d840508..9c7b6d21 100644 --- a/Code/Adscript/Source/AdscriptConnector.swift +++ b/Code/Adscript/Source/AdscriptConnector.swift @@ -7,8 +7,8 @@ public struct AdscriptConfiguration { } public struct AdscriptConnector { - public let adapter: AdscriptAdapter - public let player: THEOplayer + private let adapter: AdscriptAdapter + private let player: THEOplayer public init(configuration: AdscriptConfiguration, player: THEOplayer, metadata: AdScriptDataObject) { From b65559128918f001887386f737e37946532801bf Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 18 Jun 2025 09:47:37 +0200 Subject: [PATCH 07/35] initial player state reporting --- .../Source/integration/AdscriptAdapter.swift | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 7ffe0417..7178a7eb 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -14,6 +14,7 @@ public struct AdscriptAdapter { self.adscriptCollector = AdScriptCollector(implementationId: configuration.implementationId, isDebug: configuration.debug) + reportPlayerState() addEventListeners() } @@ -29,6 +30,40 @@ public struct AdscriptAdapter { // TODO } + private func reportPlayerState() { + reportFullscreen(isFullscreen: player.presentationMode == PresentationMode.fullscreen) + reportDimensions(width: player.videoWidth, height: player.videoHeight) + reportPlaybackSpeed(playbackRate: player.playbackRate) + reportVolumeAndMuted(isMuted: player.muted, volume: player.volume) + reportTriggeredByUser(autoplayEnabled: player.autoplay) + reportVisibility() + } + + private func reportFullscreen(isFullscreen: Bool) { + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.fullscreen, value: isFullscreen ? 1 : 0) + } + + private func reportDimensions(width: Int, height: Int) { + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.width, value: width) + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.height, value: height) + } + + private func reportPlaybackSpeed(playbackRate: Double) { + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.normalSpeed, value: playbackRate == 1 ? 1 : 0) + } + + private func reportVolumeAndMuted(isMuted: Bool, volume: Float) { + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.muted, value: (isMuted || volume == 0) ? 1 : 0) + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.volume, value: Int(volume)) + } + private func reportTriggeredByUser(autoplayEnabled: Bool) { + _ = self.adscriptCollector.playerState.set(key: AdScriptPlayerStateKey.triggeredByUser, value: autoplayEnabled ? 1 : 0) + } + + private func reportVisibility() { + // TODO + } + private func addEventListeners() { // TODO } From ea3f766ed12c5b35bca674bc1ca5619f296de9e3 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 18 Jun 2025 09:48:16 +0200 Subject: [PATCH 08/35] report contentMetadata to adscript sdk --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 7178a7eb..da0d82ad 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -23,7 +23,7 @@ public struct AdscriptAdapter { } public func update(metadata: AdScriptDataObject) { - // TODO + self.adscriptCollector.contentMetadata = metadata } public func updateUser(i12n: AdScriptI12n) { From a3b45ce270066f03a81803206381e0b49a9a071b Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 18 Jun 2025 09:48:47 +0200 Subject: [PATCH 09/35] report i12n to adscript sdk --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index da0d82ad..2ec5da7b 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -27,7 +27,7 @@ public struct AdscriptAdapter { } public func updateUser(i12n: AdScriptI12n) { - // TODO + self.adscriptCollector.i12n = i12n } private func reportPlayerState() { From 97fd5fb57ab70a227e6742a609343229a590b0e2 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 00:00:10 +0200 Subject: [PATCH 10/35] add dependency --- THEOplayer-Connector-Adscript.podspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/THEOplayer-Connector-Adscript.podspec b/THEOplayer-Connector-Adscript.podspec index 83bf2711..8b639793 100644 --- a/THEOplayer-Connector-Adscript.podspec +++ b/THEOplayer-Connector-Adscript.podspec @@ -21,4 +21,6 @@ Pod::Spec.new do |s| s.swift_versions = ['5.3', '5.4', '5.5', '5.6', '5.7'] s.dependency 'THEOplayerSDK-core', "~> 9" s.dependency 'AdscriptApiClient', '>= 1.0.4' + s.dependency 'swift-collections', '~> 1.1' + end From 2bf8a213124067296fb22a3046b25ac7a2a0a493 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 00:00:27 +0200 Subject: [PATCH 11/35] non ad related listeners --- .../Source/integration/AdscriptAdapter.swift | 259 +++++++++++++++++- 1 file changed, 257 insertions(+), 2 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 2ec5da7b..df70db99 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -1,11 +1,41 @@ import THEOplayerSDK +import Collections import AdScriptApiClient -public struct AdscriptAdapter { +public struct LogPoint { + let name: AdScriptEventName; + let cue: Double; +} + +public class AdscriptAdapter { private let player: THEOplayer private let contentMetadata: AdScriptDataObject + private var contentLogPoints: Deque + private let adMetadata: AdScriptDataObject? = nil + private var waitingForFirstSecondOfAd = false + private var waitingForFirstSecondOfSsaiAdSince: Double? = nil private let configuration: AdscriptConfiguration private let adscriptCollector: AdScriptCollector + + private var playEventListener: EventListener? + private var playingEventListener: EventListener? + private var errorEventListener: EventListener? + private var sourceChangeEventListener: EventListener? + private var endedEventListener: EventListener? + private var durationChangeEventListener: EventListener? + private var timeUpdateEventListener: EventListener? + private var volumeChangeEventListener: EventListener? + private var rateChangeEventListener: EventListener? + private var presentationModeChangeEventListener: EventListener? + + private var adBreakBeginListener: EventListener? + private var adBeginListener: EventListener? + private var adFirstQuartileListener: EventListener? + private var adMidpointListener: EventListener? + private var adThirdQuartileListener: EventListener? + private var adCompletedListener: EventListener? + private var adBreakEndedListener: EventListener? + public init(configuration: AdscriptConfiguration, player: THEOplayer, metadata: AdScriptDataObject) { self.player = player @@ -64,7 +94,232 @@ public struct AdscriptAdapter { // TODO } + private func handlePlaying(event: PlayingEvent) { + if (self.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + } + if (self.player.ads.playing) { + self.adscriptCollector.push(event: AdScriptEventName.start, data: self.adMetadata ?? AdScriptDataObject()) + } else { + self.adscriptCollector.push(event: AdScriptEventName.start, data: self.contentMetadata) + // TODO check if flag is needed or just one playing event is dispatched on iOS + } + if let playingEventListener: THEOplayerSDK.EventListener = self.playingEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: playingEventListener) + } + } + + private func addLogPoints(duration: Double?) { + if let duration = duration { + if (duration.isFinite) { + self.contentLogPoints.append(LogPoint(name: AdScriptEventName.progress1 , cue: 1.0)) + self.contentLogPoints.append(LogPoint(name: AdScriptEventName.firstQuartile , cue: 0.25 * duration)) + self.contentLogPoints.append(LogPoint(name: AdScriptEventName.midpoint , cue: 0.5 * duration)) + self.contentLogPoints.append(LogPoint(name: AdScriptEventName.thirdQuartile , cue: 0.75 * duration)) + } else { + self.contentLogPoints.append(LogPoint(name: AdScriptEventName.progress1, cue: 1.0)) + } + } + + } + + private func reportLogPoint(name: AdScriptEventName) { + self.adscriptCollector.push(event: name, data: self.contentMetadata) + } + + private func maybeReportAdProgress(currentTime: Double) { + if (!self.waitingForFirstSecondOfAd) { return } + if let currentAd = player.ads.currentAds.first { + switch currentAd.integration { + case .google_ima: + if (currentTime >= 1) { + self.adscriptCollector.push(event: AdScriptEventName.progress1, data: self.adMetadata ?? AdScriptDataObject()) + self.waitingForFirstSecondOfAd = false + } + case .google_dai: + if let waitingSince = self.waitingForFirstSecondOfSsaiAdSince { + if (currentTime >= waitingSince + 1.0) { + self.adscriptCollector.push(event: AdScriptEventName.progress1, data: self.adMetadata ?? AdScriptDataObject()) + self.waitingForFirstSecondOfAd = false + self.waitingForFirstSecondOfSsaiAdSince = nil + } + } + default: + if (self.configuration.debug) { print("[AdscriptConnector] Ad Integration is not supported (maybeReportAdProgress)") } + } + } + } + + private func maybeReportProgress(currentTime: Double) { + if (player.ads.playing) { + maybeReportAdProgress(currentTime: currentTime) + return + } + + let nextLogPoint = contentLogPoints.first + if (nextLogPoint != nil && nextLogPoint!.cue >= currentTime) { + reportLogPoint(name: nextLogPoint!.name) + contentLogPoints.removeFirst() + } + } + + private func addEventListeners() { - // TODO + self.playEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAY, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + } + }) + self.playingEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) + self.errorEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ERROR, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : code = $s ; cause = $s", event.type, event.errorObject?.code ?? "", event.errorObject?.cause ?? "") + } + }) + self.sourceChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.SOURCE_CHANGE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : source = $f", event.type, event.source.debugDescription) + } + welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) + }) + self.endedEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + } + welf.adscriptCollector.push(event: AdScriptEventName.complete, data: welf.contentMetadata) + }) + self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : duration = $d", event.type, event.duration ?? "N/A") + } + welf.addLogPoints(duration: event.duration) + }) + self.timeUpdateEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.TIME_UPDATE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + } + welf.maybeReportProgress(currentTime: event.currentTime) + }) + self.volumeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.VOLUME_CHANGE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : volume = $f", event.type, event.volume) + } + welf.reportVolumeAndMuted(isMuted: welf.player.muted, volume: event.volume) + }) + self.rateChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.RATE_CHANGE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : playbackRate = $d", event.type, event.playbackRate) + } + welf.reportPlaybackSpeed(playbackRate: event.playbackRate) + }) + self.presentationModeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PRESENTATION_MODE_CHANGE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : presentationMode = $s", event.type, event.presentationMode._rawValue) + } + welf.reportFullscreen(isFullscreen: event.presentationMode == PresentationMode.fullscreen) + }) + + + if (hasAdIntegration()) { + self.adBreakBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adThirdQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in + guard let welf: AdscriptAdapter = self else { return } + }) + } + } + + private func removeEventListeners() { + if let playEventListener: THEOplayerSDK.EventListener = self.playEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.TIME_UPDATE, listener: playEventListener) + } + if let playingEventListener: THEOplayerSDK.EventListener = self.playingEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: playingEventListener) + } + if let errorEventListener: THEOplayerSDK.EventListener = self.errorEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.ERROR, listener: errorEventListener) + } + if let sourceChangeEventListener: THEOplayerSDK.EventListener = self.sourceChangeEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.SOURCE_CHANGE, listener: sourceChangeEventListener) + } + if let endedEventListener: THEOplayerSDK.EventListener = self.endedEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: endedEventListener) + } + if let durationChangeEventListener: THEOplayerSDK.EventListener = self.durationChangeEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: durationChangeEventListener) + } + if let timeUpdateEventListener: THEOplayerSDK.EventListener = self.timeUpdateEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.TIME_UPDATE, listener: timeUpdateEventListener) + } + if let volumeChangeEventListener: THEOplayerSDK.EventListener = self.volumeChangeEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.VOLUME_CHANGE, listener: volumeChangeEventListener) + } + if let rateChangeEventListener: THEOplayerSDK.EventListener = self.rateChangeEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.RATE_CHANGE, listener: rateChangeEventListener) + } + if let presentationModeChangeEventListener: THEOplayerSDK.EventListener = self.presentationModeChangeEventListener { + self.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.PRESENTATION_MODE_CHANGE, listener: presentationModeChangeEventListener) + } + if let adBreakBeginListener: THEOplayerSDK.EventListener = self.adBreakBeginListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: adBreakBeginListener) + } + if let adBeginListener: THEOplayerSDK.EventListener = self.adBeginListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: adBeginListener) + } + if let adFirstQuartileListener: THEOplayerSDK.EventListener = self.adFirstQuartileListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: adFirstQuartileListener) + } + if let adMidpointListener: THEOplayerSDK.EventListener = self.adMidpointListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: adMidpointListener) + } + if let adThirdQuartileListener: THEOplayerSDK.EventListener = self.adThirdQuartileListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: adThirdQuartileListener) + } + if let adCompletedListener: THEOplayerSDK.EventListener = self.adCompletedListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: adCompletedListener) + } + if let adBreakEndedListener: THEOplayerSDK.EventListener = self.adBreakEndedListener { + self.player.removeEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: adBreakEndedListener) + } + } + + private func hasAdIntegration() -> Bool { + let hasAdIntegration = player.getAllIntegrations().contains { integration in + switch integration.kind { + case IntegrationKind.GOOGLE_DAI: + return true + case IntegrationKind.GOOGLE_IMA: + return true + default: + print("[AdscriptConnector] no supported ad integration was found") + return false + } + } + return hasAdIntegration } } From 752374af70fc585757212ac47a0389876e8f6fe1 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 22:27:20 +0200 Subject: [PATCH 12/35] handle ad related events --- .../Source/integration/AdscriptAdapter.swift | 64 ++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index df70db99..167f7216 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -10,8 +10,8 @@ public struct LogPoint { public class AdscriptAdapter { private let player: THEOplayer private let contentMetadata: AdScriptDataObject - private var contentLogPoints: Deque - private let adMetadata: AdScriptDataObject? = nil + private var contentLogPoints: Deque = Deque() + private var adMetadata: AdScriptDataObject? = nil private var waitingForFirstSecondOfAd = false private var waitingForFirstSecondOfSsaiAdSince: Double? = nil private let configuration: AdscriptConfiguration @@ -162,6 +162,27 @@ public class AdscriptAdapter { contentLogPoints.removeFirst() } } + + private func getAdType(offset: Int) -> AdScriptDataValueType { + return .midroll + } + + private func buildAdMetadata(ad: THEOplayerSDK.Ad) { + if (false) { + + } else { + var currentAdMetadata = AdScriptDataObject() + _ = _ = currentAdMetadata.set(key: .assetId, value: ad.id ?? "N/A") + _ = currentAdMetadata.set(key: .type, value: self.getAdType(offset: ad.adBreak.timeOffset)) + if (ad is LinearAd && ad.duration != nil) { + _ = currentAdMetadata.set(key: .length, value: ad.duration!) + } + _ = currentAdMetadata.set(key: .title, value: ad.id ?? "N/A") +// _ = currentAdMetadata.set(key: .asmea, value: "TODO") + _ = currentAdMetadata.set(key: .attribute, value: .commercial) + adMetadata = currentAdMetadata + } + } private func addEventListeners() { @@ -232,24 +253,63 @@ public class AdscriptAdapter { if (hasAdIntegration()) { self.adBreakBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, event.ad?.timeOffset ?? "N/A") + } }) self.adBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + } + guard let ad = event.ad else {return} + welf.buildAdMetadata(ad: event.ad!) + welf.waitingForFirstSecondOfAd = true + if (event.ad?.integration == .google_dai) { + welf.waitingForFirstSecondOfSsaiAdSince = welf.player.currentTime + } + welf.adscriptCollector.push(event: AdScriptEventName.start, data: welf.adMetadata ?? AdScriptDataObject()) }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + } + guard let adMetadata = welf.adMetadata else { return } + welf.adscriptCollector.push(event: .firstQuartile, data: adMetadata) }) self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + } + guard let adMetadata = welf.adMetadata else { return } + welf.adscriptCollector.push(event: .midpoint, data: adMetadata) }) self.adThirdQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + } + guard let adMetadata = welf.adMetadata else { return } + welf.adscriptCollector.push(event: .thirdQuartile, data: adMetadata) }) self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + } + guard let adMetadata = welf.adMetadata else { return } + welf.adscriptCollector.push(event: .complete, data: adMetadata) }) self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, event.ad?.timeOffset ?? "N/A") + } + if (event.ad?.timeOffset == 0) { + welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) + } }) } } From 427b1bbb2dd1b825a7d02b8d01e15f5b060f660d Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 22:30:25 +0200 Subject: [PATCH 13/35] improve readability --- .../Source/integration/AdscriptAdapter.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 167f7216..dc375dc3 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -99,9 +99,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } if (self.player.ads.playing) { - self.adscriptCollector.push(event: AdScriptEventName.start, data: self.adMetadata ?? AdScriptDataObject()) + self.adscriptCollector.push(event: .start, data: self.adMetadata ?? AdScriptDataObject()) } else { - self.adscriptCollector.push(event: AdScriptEventName.start, data: self.contentMetadata) + self.adscriptCollector.push(event: .start, data: self.contentMetadata) // TODO check if flag is needed or just one playing event is dispatched on iOS } if let playingEventListener: THEOplayerSDK.EventListener = self.playingEventListener { @@ -112,12 +112,12 @@ public class AdscriptAdapter { private func addLogPoints(duration: Double?) { if let duration = duration { if (duration.isFinite) { - self.contentLogPoints.append(LogPoint(name: AdScriptEventName.progress1 , cue: 1.0)) - self.contentLogPoints.append(LogPoint(name: AdScriptEventName.firstQuartile , cue: 0.25 * duration)) - self.contentLogPoints.append(LogPoint(name: AdScriptEventName.midpoint , cue: 0.5 * duration)) - self.contentLogPoints.append(LogPoint(name: AdScriptEventName.thirdQuartile , cue: 0.75 * duration)) + self.contentLogPoints.append(LogPoint(name: .progress1 , cue: 1.0)) + self.contentLogPoints.append(LogPoint(name: .firstQuartile , cue: 0.25 * duration)) + self.contentLogPoints.append(LogPoint(name: .midpoint , cue: 0.5 * duration)) + self.contentLogPoints.append(LogPoint(name: .thirdQuartile , cue: 0.75 * duration)) } else { - self.contentLogPoints.append(LogPoint(name: AdScriptEventName.progress1, cue: 1.0)) + self.contentLogPoints.append(LogPoint(name: .progress1, cue: 1.0)) } } @@ -133,13 +133,13 @@ public class AdscriptAdapter { switch currentAd.integration { case .google_ima: if (currentTime >= 1) { - self.adscriptCollector.push(event: AdScriptEventName.progress1, data: self.adMetadata ?? AdScriptDataObject()) + self.adscriptCollector.push(event: .progress1, data: self.adMetadata ?? AdScriptDataObject()) self.waitingForFirstSecondOfAd = false } case .google_dai: if let waitingSince = self.waitingForFirstSecondOfSsaiAdSince { if (currentTime >= waitingSince + 1.0) { - self.adscriptCollector.push(event: AdScriptEventName.progress1, data: self.adMetadata ?? AdScriptDataObject()) + self.adscriptCollector.push(event: .progress1, data: self.adMetadata ?? AdScriptDataObject()) self.waitingForFirstSecondOfAd = false self.waitingForFirstSecondOfSsaiAdSince = nil } @@ -211,7 +211,7 @@ public class AdscriptAdapter { if (welf.configuration.debug) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } - welf.adscriptCollector.push(event: AdScriptEventName.complete, data: welf.contentMetadata) + welf.adscriptCollector.push(event: .complete, data: welf.contentMetadata) }) self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } @@ -268,7 +268,7 @@ public class AdscriptAdapter { if (event.ad?.integration == .google_dai) { welf.waitingForFirstSecondOfSsaiAdSince = welf.player.currentTime } - welf.adscriptCollector.push(event: AdScriptEventName.start, data: welf.adMetadata ?? AdScriptDataObject()) + welf.adscriptCollector.push(event: .start, data: welf.adMetadata ?? AdScriptDataObject()) }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } From 216ac41b0e38aca5659c0bb31774bd16fdb1b4ee Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 23:00:51 +0200 Subject: [PATCH 14/35] cleaner unwrapping --- .../Source/integration/AdscriptAdapter.swift | 81 +++++++++++-------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index dc375dc3..a7929bd1 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -99,7 +99,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } if (self.player.ads.playing) { - self.adscriptCollector.push(event: .start, data: self.adMetadata ?? AdScriptDataObject()) + if let adMetadata = self.adMetadata { + self.adscriptCollector.push(event: .start, data: adMetadata) + } } else { self.adscriptCollector.push(event: .start, data: self.contentMetadata) // TODO check if flag is needed or just one playing event is dispatched on iOS @@ -132,19 +134,23 @@ public class AdscriptAdapter { if let currentAd = player.ads.currentAds.first { switch currentAd.integration { case .google_ima: - if (currentTime >= 1) { - self.adscriptCollector.push(event: .progress1, data: self.adMetadata ?? AdScriptDataObject()) + if let adMetadata = self.adMetadata, currentTime >= 1 { + self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false } case .google_dai: - if let waitingSince = self.waitingForFirstSecondOfSsaiAdSince { - if (currentTime >= waitingSince + 1.0) { - self.adscriptCollector.push(event: .progress1, data: self.adMetadata ?? AdScriptDataObject()) + if let waitingSince = self.waitingForFirstSecondOfSsaiAdSince, + let adMetadata = self.adMetadata, + currentTime >= waitingSince + 1.0 { + self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false self.waitingForFirstSecondOfSsaiAdSince = nil } - } - default: + case .theoads: + if (self.configuration.debug) { print("[AdscriptConnector] Ad Integration is not supported (maybeReportAdProgress)") } + case .custom: + if (self.configuration.debug) { print("[AdscriptConnector] Ad Integration is not supported (maybeReportAdProgress)") } + @unknown default: if (self.configuration.debug) { print("[AdscriptConnector] Ad Integration is not supported (maybeReportAdProgress)") } } } @@ -169,17 +175,21 @@ public class AdscriptAdapter { private func buildAdMetadata(ad: THEOplayerSDK.Ad) { if (false) { - + // TODO provide adProcessor } else { var currentAdMetadata = AdScriptDataObject() - _ = _ = currentAdMetadata.set(key: .assetId, value: ad.id ?? "N/A") - _ = currentAdMetadata.set(key: .type, value: self.getAdType(offset: ad.adBreak.timeOffset)) - if (ad is LinearAd && ad.duration != nil) { - _ = currentAdMetadata.set(key: .length, value: ad.duration!) + if let id = ad.id { + _ = currentAdMetadata.set(key: .assetId, value: id) + _ = currentAdMetadata.set(key: .title, value: id) + } - _ = currentAdMetadata.set(key: .title, value: ad.id ?? "N/A") // _ = currentAdMetadata.set(key: .asmea, value: "TODO") _ = currentAdMetadata.set(key: .attribute, value: .commercial) + _ = currentAdMetadata.set(key: .type, value: self.getAdType(offset: ad.adBreak.timeOffset)) + if let duration = ad.duration { + _ = currentAdMetadata.set(key: .length, value: duration) + } + adMetadata = currentAdMetadata } } @@ -195,8 +205,8 @@ public class AdscriptAdapter { self.playingEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) self.errorEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ERROR, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : code = $s ; cause = $s", event.type, event.errorObject?.code ?? "", event.errorObject?.cause ?? "") + if let code = event.errorObject?.code, let cause = event.errorObject?.cause, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : code = $s ; cause = $s", event.type, code, cause) } }) self.sourceChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.SOURCE_CHANGE, listener: { [weak self] event in @@ -215,8 +225,8 @@ public class AdscriptAdapter { }) self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : duration = $d", event.type, event.duration ?? "N/A") + if let duration = event.duration, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : duration = $d", event.type, duration) } welf.addLogPoints(duration: event.duration) }) @@ -253,59 +263,60 @@ public class AdscriptAdapter { if (hasAdIntegration()) { self.adBreakBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, event.ad?.timeOffset ?? "N/A") + if let offset = event.ad?.timeOffset, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) } }) self.adBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + if let id = event.ad?.id, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } - guard let ad = event.ad else {return} - welf.buildAdMetadata(ad: event.ad!) + guard let ad = event.ad else { return } + welf.buildAdMetadata(ad: ad) welf.waitingForFirstSecondOfAd = true if (event.ad?.integration == .google_dai) { welf.waitingForFirstSecondOfSsaiAdSince = welf.player.currentTime } - welf.adscriptCollector.push(event: .start, data: welf.adMetadata ?? AdScriptDataObject()) + guard let adMetadata = self?.adMetadata else { return } + welf.adscriptCollector.push(event: .start, data: adMetadata) }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + if let id = event.ad?.id, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } welf.adscriptCollector.push(event: .firstQuartile, data: adMetadata) }) self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + if let id = event.ad?.id, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } welf.adscriptCollector.push(event: .midpoint, data: adMetadata) }) self.adThirdQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + if let id = event.ad?.id, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } welf.adscriptCollector.push(event: .thirdQuartile, data: adMetadata) }) self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, event.ad?.id ?? "N/A") + if let id = event.ad?.id, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } welf.adscriptCollector.push(event: .complete, data: adMetadata) }) self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { - print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, event.ad?.timeOffset ?? "N/A") + if let offset = event.ad?.timeOffset, welf.configuration.debug { + print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) } if (event.ad?.timeOffset == 0) { welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) From 9802adb43e71d5b619d3aba5eafaaa65ec9e4d5f Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 23:07:15 +0200 Subject: [PATCH 15/35] implement getAdType --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index a7929bd1..455fc6b8 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -170,7 +170,15 @@ public class AdscriptAdapter { } private func getAdType(offset: Int) -> AdScriptDataValueType { - return .midroll + if (offset == 0) { + return .preroll + } else if (offset == -1) { + return .postroll + } else if let duration = player.duration, offset >= Int(floor(duration)) { + return .postroll + } else { + return .midroll + } } private func buildAdMetadata(ad: THEOplayerSDK.Ad) { From 5bba92547728acb2de63046e4088c042ef680c2d Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 24 Jun 2025 23:50:28 +0200 Subject: [PATCH 16/35] example app --- .../project.pbxproj | 2 + .../Base.lproj/Main.storyboard | 116 +++++++++++++++++- .../AdscriptReporter/PlayerView.swift | 32 +++++ .../AdscriptReporter/ViewController.swift | 105 +++++++++++++++- .../Frameworks/AdscriptApiClient.podspec | 2 +- .../AdscriptApiClient_withidfa.podspec | 38 ++++++ Code/Adscript/Source/AdscriptConnector.swift | 11 +- .../Source/integration/AdscriptAdapter.swift | 2 +- 8 files changed, 297 insertions(+), 11 deletions(-) create mode 100644 Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift create mode 100644 Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient_withidfa.podspec diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj index c2774f8e..97617fee 100644 --- a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj @@ -337,6 +337,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = G749Q24N3X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AdscriptReporter/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -365,6 +366,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = G749Q24N3X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AdscriptReporter/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard index 25a76385..478dadae 100644 --- a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard @@ -1,24 +1,130 @@ - + + - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift new file mode 100644 index 00000000..8fc1d2da --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift @@ -0,0 +1,32 @@ +// +// PlayerView.swift +// AdscriptReporter +// +// Created by Joosen, Wonne on 24/06/2025. +// + +import UIKit +import THEOplayerSDK + +/// A container UIView that holds a `THEOPlayer` and lays it out +/// to stretch the entire frame of this container view +class PlayerView: UIView { + /// The player that is streched out to fit this view + let player: THEOplayer + + required init?(coder: NSCoder) {nil} + + /// Create a container view that holds a `THEOPlayer` and lays it out + /// to stretch its contents to fill the entire frame of the container view. + /// - Parameter player: The player that will be laid out in this view + init(player: THEOplayer) { + self.player = player + super.init(frame: player.frame) + player.addAsSubview(of: self) + } + + override func layoutSubviews() { + super.layoutSubviews() + player.frame = bounds + } +} diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift index e8f3b83b..6b7fac5b 100644 --- a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift @@ -6,14 +6,117 @@ // import UIKit +import THEOplayerSDK +import THEOplayerConnectorAdscript +import AdScriptNoTrackingApiClient + +#if canImport(THEOplayerGoogleIMAIntegration) +import THEOplayerGoogleIMAIntegration +#endif class ViewController: UIViewController { + + + var adscript: AdscriptConnector + @IBOutlet weak var playerViewContainer: UIView! + var player: THEOplayer + + required init?(coder: NSCoder) { +// self.player = THEOplayer(with: nil, configuration: THEOplayerConfiguration(chromeless: false, ads: AdsConfiguration( +// showCountdown: true, +// preload: AdPreloadType.MIDROLL_AND_POSTROLL, +// googleIma: GoogleIMAAdsConfiguration(useNativeIma: false) +// ))) + self.player = THEOplayer(with: nil, configuration: THEOplayerConfigurationBuilder().build()) + let adscriptContentMetadata = AdScriptDataObject() + #if canImport(THEOplayerGoogleIMAIntegration) + let imaIntegration = GoogleIMAIntegrationFactory.createIntegration(on: player) + player.addIntegration(imaIntegration) + #endif + self.adscript = AdscriptConnector( + configuration: AdscriptConfiguration(implementationId: "test123", debug: true), + player: player, + metadata: adscriptContentMetadata + ) + super.init(coder: coder) + } + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. + + let playerView = PlayerView(player: player) + playerView.translatesAutoresizingMaskIntoConstraints = true + playerView.frame = playerViewContainer.bounds + playerView.autoresizingMask = [.flexibleHeight, .flexibleWidth] + playerViewContainer.addSubview(playerView) + } + + + @IBAction func bbbButtonClicked(_ sender: UIButton) { + player.source = SourceDescription( + source: TypedSource( + src: bigBuckBunnyURL, + type: "application/x-mpegurl" + ), + metadata: MetadataDescription( + metadataKeys: nil, + title: "Big buck bunny" + ) + ) + var adscriptContentMetadata = AdScriptDataObject() + .set(key: .length, value: 596) + .set(key: .assetId, value: "0123ABC") + .set(key: .channelId, value: "Dolby Test Asset") + .set(key: .program, value: "Big Buck Bunny") + .set(key: .livestream, value: "0") + .set(key: .type, value: .content) + + adscript.update(metadata: adscriptContentMetadata) + } + + @IBAction func starWarsButtonClicked(_ sender: UIButton) { + player.source = SourceDescription( + source: TypedSource( + src: starwarsURL.absoluteString, + type: "application/x-mpegurl" + ), + ads: [GoogleImaAdDescription(src: "https://cdn.theoplayer.com/demos/ads/vmap/single-pre-mid-post-no-skip.xml")], + metadata: MetadataDescription( + metadataKeys: nil, + title: "Star wars episode VII the force awakens official comic-con 2015 reel (2015)" + ) + ) - + var adscriptContentMetadata = AdScriptDataObject() + .set(key: .length, value: 211) + .set(key: .assetId, value: "4567DEF") + .set(key: .channelId, value: "Dolby Test Asset 2") + .set(key: .program, value: "Star Wars: Episode VII The Force Awakens") + .set(key: .livestream, value: "0") + .set(key: .attribute, value: "1") + .set(key: .type, value: .content) + adscript.update(metadata: adscriptContentMetadata) + } + + @IBAction func togglePlayPause(_ sender: UIButton) { + if (player.paused) { + player.play() + } else { + player.pause() + } + } + + @IBAction func seekForward(_ sender: Any) { + self.player.currentTime = self.player.currentTime + 10 + } + } +let bigBuckBunnyURL = "https://cdn.theoplayer.com/video/big_buck_bunny/big_buck_bunny.m3u8" +let starwarsURL = URL(string: "https://cdn.theoplayer.com/video/star_wars_episode_vii-the_force_awakens_official_comic-con_2015_reel_(2015)/index-daterange.m3u8")! + + + diff --git a/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec index 250a5982..78a09a61 100644 --- a/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec +++ b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient.podspec @@ -33,6 +33,6 @@ Pod::Spec.new do |spec| spec.source_files = "Classes", "Classes/**/*.{h,m}" - spec.ios.vendored_frameworks = "AdscriptApiClient.xcframework" + spec.ios.vendored_frameworks = "AdScriptNoTrackingApiClient.xcframework" end diff --git a/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient_withidfa.podspec b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient_withidfa.podspec new file mode 100644 index 00000000..250a5982 --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/Frameworks/AdscriptApiClient_withidfa.podspec @@ -0,0 +1,38 @@ +# +# Be sure to run `pod spec lint AdscriptApiClient.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +# info_plist_path = "./Frameworks/AdscriptApiClient.xcframework/ios-arm64/AdscriptApiClient.framework/Info.plist" +# info_cflist = CFPropertyList::List.new(:file => info_plist_path) +# info_plist = CFPropertyList.native_types(info_cflist.value) +# adscriptApiClientVersion = info_plist["CFBundleShortVersionString"] + +# puts "Detected AdscriptApiClient XCFramework" +# puts " - version #{theoadscriptApiClientVersionSdkVersion}" + +adscriptApiClientVersion = "1.0.4" + +Pod::Spec.new do |spec| + + spec.name = "AdscriptApiClient" + spec.version = adscriptApiClientVersion + spec.summary = "The Adscript Api Client for iOS" + + spec.description = "T" + + spec.homepage = "https://theoplayer.com" + spec.license = "MIT" + + spec.author = { "Wonne Joosen" => "wonne.joosen@dolby.com" } + + spec.source = { :git => "https://www.theoplayer.com/.git", :tag => "#{spec.version}" } + + spec.source_files = "Classes", "Classes/**/*.{h,m}" + + spec.ios.vendored_frameworks = "AdscriptApiClient.xcframework" + +end diff --git a/Code/Adscript/Source/AdscriptConnector.swift b/Code/Adscript/Source/AdscriptConnector.swift index 9c7b6d21..d6f9153d 100644 --- a/Code/Adscript/Source/AdscriptConnector.swift +++ b/Code/Adscript/Source/AdscriptConnector.swift @@ -1,9 +1,14 @@ import THEOplayerSDK -import AdScriptApiClient +import AdScriptNoTrackingApiClient public struct AdscriptConfiguration { - let implementationId: String - let debug: Bool + let implementationId: String + let debug: Bool + + public init(implementationId: String, debug: Bool) { + self.implementationId = implementationId + self.debug = debug + } } public struct AdscriptConnector { diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 455fc6b8..f1263283 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -1,6 +1,6 @@ import THEOplayerSDK import Collections -import AdScriptApiClient +import AdScriptNoTrackingApiClient public struct LogPoint { let name: AdScriptEventName; From ce06ee45ca93b2444e7636bd4f01d5c55c244f6b Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 1 Jul 2025 17:19:36 +0200 Subject: [PATCH 17/35] disbable user script sandboxing --- .../Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj index 97617fee..1f46b609 100644 --- a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj @@ -424,7 +424,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -487,7 +487,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu17; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; From 2d640a594d6ad50d823fa48431a8e915ed2b878c Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 1 Jul 2025 23:51:09 +0200 Subject: [PATCH 18/35] conditional imports --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index f1263283..a94fee0b 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -1,7 +1,11 @@ import THEOplayerSDK import Collections +#if canImport(AdScriptNoTrackingApiClient) import AdScriptNoTrackingApiClient - +#endif +#if canImport(AdScriptApiClient) +import AdScriptApiClient +#endif public struct LogPoint { let name: AdScriptEventName; let cue: Double; From 36ebf9d6a6b6f5ee01a87801715cf3f60d73addd Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 1 Jul 2025 23:51:57 +0200 Subject: [PATCH 19/35] fix compare --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index a94fee0b..b58eb0e3 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -167,7 +167,7 @@ public class AdscriptAdapter { } let nextLogPoint = contentLogPoints.first - if (nextLogPoint != nil && nextLogPoint!.cue >= currentTime) { + if (nextLogPoint != nil && currentTime >= nextLogPoint!.cue) { reportLogPoint(name: nextLogPoint!.name) contentLogPoints.removeFirst() } From 904db64cbceef1dcbc072609a8b44edc13fe4270 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 1 Jul 2025 23:52:14 +0200 Subject: [PATCH 20/35] add logging for event reporting --- .../Source/integration/AdscriptAdapter.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index b58eb0e3..72d6ba27 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -104,9 +104,15 @@ public class AdscriptAdapter { } if (self.player.ads.playing) { if let adMetadata = self.adMetadata { + if (self.configuration.debug) { + print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.description) + } self.adscriptCollector.push(event: .start, data: adMetadata) } } else { + if (self.configuration.debug) { + print("[AdscriptConnector] Push .start event with contentMetadata $s", contentMetadata.description) + } self.adscriptCollector.push(event: .start, data: self.contentMetadata) // TODO check if flag is needed or just one playing event is dispatched on iOS } @@ -130,6 +136,9 @@ public class AdscriptAdapter { } private func reportLogPoint(name: AdScriptEventName) { + if (self.configuration.debug) { + print("[AdscriptConnector] Push .$s event with contentMetadata $s", name.rawValue, contentMetadata.description) + } self.adscriptCollector.push(event: name, data: self.contentMetadata) } @@ -139,6 +148,9 @@ public class AdscriptAdapter { switch currentAd.integration { case .google_ima: if let adMetadata = self.adMetadata, currentTime >= 1 { + if (self.configuration.debug) { + print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.description) + } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false } @@ -146,6 +158,9 @@ public class AdscriptAdapter { if let waitingSince = self.waitingForFirstSecondOfSsaiAdSince, let adMetadata = self.adMetadata, currentTime >= waitingSince + 1.0 { + if (self.configuration.debug) { + print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.description) + } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false self.waitingForFirstSecondOfSsaiAdSince = nil @@ -233,6 +248,9 @@ public class AdscriptAdapter { if (welf.configuration.debug) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .complete event with contentMetadata $s", welf.contentMetadata.description) + } welf.adscriptCollector.push(event: .complete, data: welf.contentMetadata) }) self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in @@ -291,6 +309,9 @@ public class AdscriptAdapter { welf.waitingForFirstSecondOfSsaiAdSince = welf.player.currentTime } guard let adMetadata = self?.adMetadata else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.description) + } welf.adscriptCollector.push(event: .start, data: adMetadata) }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in @@ -299,6 +320,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .firstQuartile event with adMetadata $s", adMetadata.description) + } welf.adscriptCollector.push(event: .firstQuartile, data: adMetadata) }) self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in @@ -307,6 +331,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .midpoint event with adMetadata $s", adMetadata.description) + } welf.adscriptCollector.push(event: .midpoint, data: adMetadata) }) self.adThirdQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: { [weak self] event in @@ -315,6 +342,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .thirdQuartile event with adMetadata $s", adMetadata.description) + } welf.adscriptCollector.push(event: .thirdQuartile, data: adMetadata) }) self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in @@ -323,6 +353,9 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } + if (welf.configuration.debug) { + print("[AdscriptConnector] Push .complete event with adMetadata $s", adMetadata.description) + } welf.adscriptCollector.push(event: .complete, data: adMetadata) }) self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in From d4a2c6cc8112bd13ccf62c315128ba01799b6c68 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Tue, 1 Jul 2025 23:52:22 +0200 Subject: [PATCH 21/35] conditional import --- Code/Adscript/Source/AdscriptConnector.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Code/Adscript/Source/AdscriptConnector.swift b/Code/Adscript/Source/AdscriptConnector.swift index d6f9153d..2951f240 100644 --- a/Code/Adscript/Source/AdscriptConnector.swift +++ b/Code/Adscript/Source/AdscriptConnector.swift @@ -1,5 +1,10 @@ import THEOplayerSDK +#if canImport(AdScriptNoTrackingApiClient) import AdScriptNoTrackingApiClient +#endif +#if canImport(AdScriptApiClient) +import AdScriptApiClient +#endif public struct AdscriptConfiguration { let implementationId: String From 1e5717b2d45b1799b33e4f5e77192b8736cea7bb Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 21:26:33 +0200 Subject: [PATCH 22/35] remove old playing listener first --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 72d6ba27..5964b7a4 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -241,6 +241,10 @@ public class AdscriptAdapter { if (welf.configuration.debug) { print("[AdscriptConnector] Player Event: %s : source = $f", event.type, event.source.debugDescription) } + + if let playingEventListener: THEOplayerSDK.EventListener = welf.playingEventListener { + welf.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: playingEventListener) + } welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) }) self.endedEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: { [weak self] event in From 12eb96e931a565dd060f4f29e0f1563d791e55d9 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:08:30 +0200 Subject: [PATCH 23/35] store contentMetadata in adapter --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 5964b7a4..a311fa7c 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -13,7 +13,7 @@ public struct LogPoint { public class AdscriptAdapter { private let player: THEOplayer - private let contentMetadata: AdScriptDataObject + private var contentMetadata: AdScriptDataObject private var contentLogPoints: Deque = Deque() private var adMetadata: AdScriptDataObject? = nil private var waitingForFirstSecondOfAd = false @@ -57,7 +57,7 @@ public class AdscriptAdapter { } public func update(metadata: AdScriptDataObject) { - self.adscriptCollector.contentMetadata = metadata + self.contentMetadata = metadata } public func updateUser(i12n: AdScriptI12n) { From 78fe517292531446c0d25bcf5e8853479b3613d0 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:12:28 +0200 Subject: [PATCH 24/35] use jsonstring --- .../Source/integration/AdscriptAdapter.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index a311fa7c..d0b28b87 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -105,13 +105,13 @@ public class AdscriptAdapter { if (self.player.ads.playing) { if let adMetadata = self.adMetadata { if (self.configuration.debug) { - print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.toJsonString()) } self.adscriptCollector.push(event: .start, data: adMetadata) } } else { if (self.configuration.debug) { - print("[AdscriptConnector] Push .start event with contentMetadata $s", contentMetadata.description) + print("[AdscriptConnector] Push .start event with contentMetadata $s", contentMetadata.toJsonString()) } self.adscriptCollector.push(event: .start, data: self.contentMetadata) // TODO check if flag is needed or just one playing event is dispatched on iOS @@ -137,7 +137,7 @@ public class AdscriptAdapter { private func reportLogPoint(name: AdScriptEventName) { if (self.configuration.debug) { - print("[AdscriptConnector] Push .$s event with contentMetadata $s", name.rawValue, contentMetadata.description) + print("[AdscriptConnector] Push .$s event with contentMetadata $s", name.rawValue, contentMetadata.toJsonString()) } self.adscriptCollector.push(event: name, data: self.contentMetadata) } @@ -149,7 +149,7 @@ public class AdscriptAdapter { case .google_ima: if let adMetadata = self.adMetadata, currentTime >= 1 { if (self.configuration.debug) { - print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.toJsonString()) } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false @@ -159,7 +159,7 @@ public class AdscriptAdapter { let adMetadata = self.adMetadata, currentTime >= waitingSince + 1.0 { if (self.configuration.debug) { - print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.toJsonString()) } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false @@ -253,7 +253,7 @@ public class AdscriptAdapter { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .complete event with contentMetadata $s", welf.contentMetadata.description) + print("[AdscriptConnector] Push .complete event with contentMetadata $s", welf.contentMetadata.toJsonString()) } welf.adscriptCollector.push(event: .complete, data: welf.contentMetadata) }) @@ -314,7 +314,7 @@ public class AdscriptAdapter { } guard let adMetadata = self?.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.toJsonString()) } welf.adscriptCollector.push(event: .start, data: adMetadata) }) @@ -325,7 +325,7 @@ public class AdscriptAdapter { } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .firstQuartile event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .firstQuartile event with adMetadata $s", adMetadata.toJsonString()) } welf.adscriptCollector.push(event: .firstQuartile, data: adMetadata) }) @@ -336,7 +336,7 @@ public class AdscriptAdapter { } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .midpoint event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .midpoint event with adMetadata $s", adMetadata.toJsonString()) } welf.adscriptCollector.push(event: .midpoint, data: adMetadata) }) @@ -347,7 +347,7 @@ public class AdscriptAdapter { } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .thirdQuartile event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .thirdQuartile event with adMetadata $s", adMetadata.toJsonString()) } welf.adscriptCollector.push(event: .thirdQuartile, data: adMetadata) }) @@ -358,7 +358,7 @@ public class AdscriptAdapter { } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .complete event with adMetadata $s", adMetadata.description) + print("[AdscriptConnector] Push .complete event with adMetadata $s", adMetadata.toJsonString()) } welf.adscriptCollector.push(event: .complete, data: adMetadata) }) From bdffb1564b9ba10fa104d2c23415bc112e6897bd Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:27:00 +0200 Subject: [PATCH 25/35] remove logpoints on sourcechange --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index d0b28b87..58e5c436 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -245,6 +245,7 @@ public class AdscriptAdapter { if let playingEventListener: THEOplayerSDK.EventListener = welf.playingEventListener { welf.player.removeEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: playingEventListener) } + welf.contentLogPoints = Deque() welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) }) self.endedEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: { [weak self] event in From d17063e198c6f4cff66a4242fb8e603900f40031 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:27:22 +0200 Subject: [PATCH 26/35] print logpoints --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 58e5c436..39d666ea 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -131,6 +131,9 @@ public class AdscriptAdapter { } else { self.contentLogPoints.append(LogPoint(name: .progress1, cue: 1.0)) } + if (self.configuration.debug) { + print("[AdscriptConnector] Added logpoints : $s", self.contentLogPoints.debugDescription, self.contentLogPoints.count) + } } } From 90a82ae26a4f8e586080f690e37b5c04dd68a6f2 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:27:39 +0200 Subject: [PATCH 27/35] some logging flags --- .../Source/integration/AdscriptAdapter.swift | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 39d666ea..2ea98247 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -11,6 +11,9 @@ public struct LogPoint { let cue: Double; } +let LOG_PLAYER_EVENTS = false +let LOG_ADSCRIPT_EVENTS = false + public class AdscriptAdapter { private let player: THEOplayer private var contentMetadata: AdScriptDataObject @@ -46,7 +49,7 @@ public class AdscriptAdapter { self.contentMetadata = metadata self.configuration = configuration - self.adscriptCollector = AdScriptCollector(implementationId: configuration.implementationId, isDebug: configuration.debug) + self.adscriptCollector = AdScriptCollector(implementationId: configuration.implementationId, isDebug: configuration.debug && LOG_ADSCRIPT_EVENTS) reportPlayerState() addEventListeners() @@ -99,7 +102,7 @@ public class AdscriptAdapter { } private func handlePlaying(event: PlayingEvent) { - if (self.configuration.debug) { + if (self.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } if (self.player.ads.playing) { @@ -228,20 +231,20 @@ public class AdscriptAdapter { private func addEventListeners() { self.playEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAY, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } }) self.playingEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) self.errorEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ERROR, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let code = event.errorObject?.code, let cause = event.errorObject?.cause, welf.configuration.debug { + if let code = event.errorObject?.code, let cause = event.errorObject?.cause, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : code = $s ; cause = $s", event.type, code, cause) } }) self.sourceChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.SOURCE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : source = $f", event.type, event.source.debugDescription) } @@ -253,7 +256,7 @@ public class AdscriptAdapter { }) self.endedEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } if (welf.configuration.debug) { @@ -263,35 +266,35 @@ public class AdscriptAdapter { }) self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let duration = event.duration, welf.configuration.debug { + if let duration = event.duration, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : duration = $d", event.type, duration) } welf.addLogPoints(duration: event.duration) }) self.timeUpdateEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.TIME_UPDATE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) } welf.maybeReportProgress(currentTime: event.currentTime) }) self.volumeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.VOLUME_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : volume = $f", event.type, event.volume) } welf.reportVolumeAndMuted(isMuted: welf.player.muted, volume: event.volume) }) self.rateChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.RATE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : playbackRate = $d", event.type, event.playbackRate) } welf.reportPlaybackSpeed(playbackRate: event.playbackRate) }) self.presentationModeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PRESENTATION_MODE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if (welf.configuration.debug) { + if (welf.configuration.debug && LOG_PLAYER_EVENTS) { print("[AdscriptConnector] Player Event: %s : presentationMode = $s", event.type, event.presentationMode._rawValue) } welf.reportFullscreen(isFullscreen: event.presentationMode == PresentationMode.fullscreen) @@ -301,13 +304,13 @@ public class AdscriptAdapter { if (hasAdIntegration()) { self.adBreakBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let offset = event.ad?.timeOffset, welf.configuration.debug { + if let offset = event.ad?.timeOffset, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) } }) self.adBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let id = event.ad?.id, welf.configuration.debug { + if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let ad = event.ad else { return } @@ -324,7 +327,7 @@ public class AdscriptAdapter { }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let id = event.ad?.id, welf.configuration.debug { + if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } @@ -335,7 +338,7 @@ public class AdscriptAdapter { }) self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let id = event.ad?.id, welf.configuration.debug { + if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } @@ -357,7 +360,7 @@ public class AdscriptAdapter { }) self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let id = event.ad?.id, welf.configuration.debug { + if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) } guard let adMetadata = welf.adMetadata else { return } @@ -368,7 +371,7 @@ public class AdscriptAdapter { }) self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } - if let offset = event.ad?.timeOffset, welf.configuration.debug { + if let offset = event.ad?.timeOffset, welf.configuration.debug && LOG_PLAYER_EVENTS { print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) } if (event.ad?.timeOffset == 0) { From 43575bd538178a5957cbb6054e016d4a94375ad8 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 22:47:10 +0200 Subject: [PATCH 28/35] newline --- Code/Adscript/Source/integration/AdscriptAdapter.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 2ea98247..11b29fda 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -6,6 +6,7 @@ import AdScriptNoTrackingApiClient #if canImport(AdScriptApiClient) import AdScriptApiClient #endif + public struct LogPoint { let name: AdScriptEventName; let cue: Double; From 491ce458b81e591cf2a65ed5749be997582cfca4 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 2 Jul 2025 23:06:05 +0200 Subject: [PATCH 29/35] fix logs --- .../Source/integration/AdscriptAdapter.swift | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Code/Adscript/Source/integration/AdscriptAdapter.swift b/Code/Adscript/Source/integration/AdscriptAdapter.swift index 11b29fda..0440c6af 100644 --- a/Code/Adscript/Source/integration/AdscriptAdapter.swift +++ b/Code/Adscript/Source/integration/AdscriptAdapter.swift @@ -104,18 +104,18 @@ public class AdscriptAdapter { private func handlePlaying(event: PlayingEvent) { if (self.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + print("[AdscriptConnector] Player Event: \(event.type) : currentTime = \(event.currentTime)") } if (self.player.ads.playing) { if let adMetadata = self.adMetadata { if (self.configuration.debug) { - print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .start event with adMetadata \(adMetadata.toJsonString())") } self.adscriptCollector.push(event: .start, data: adMetadata) } } else { if (self.configuration.debug) { - print("[AdscriptConnector] Push .start event with contentMetadata $s", contentMetadata.toJsonString()) + print("[AdscriptConnector] Push .start event with contentMetadata \(contentMetadata.toJsonString())") } self.adscriptCollector.push(event: .start, data: self.contentMetadata) // TODO check if flag is needed or just one playing event is dispatched on iOS @@ -136,7 +136,7 @@ public class AdscriptAdapter { self.contentLogPoints.append(LogPoint(name: .progress1, cue: 1.0)) } if (self.configuration.debug) { - print("[AdscriptConnector] Added logpoints : $s", self.contentLogPoints.debugDescription, self.contentLogPoints.count) + print("[AdscriptConnector] Stored \(self.contentLogPoints.count) logPoints : \(self.contentLogPoints.debugDescription)") } } @@ -144,7 +144,7 @@ public class AdscriptAdapter { private func reportLogPoint(name: AdScriptEventName) { if (self.configuration.debug) { - print("[AdscriptConnector] Push .$s event with contentMetadata $s", name.rawValue, contentMetadata.toJsonString()) + print("[AdscriptConnector] Push .\(name.rawValue) event with contentMetadata \(contentMetadata.toJsonString())") } self.adscriptCollector.push(event: name, data: self.contentMetadata) } @@ -156,7 +156,7 @@ public class AdscriptAdapter { case .google_ima: if let adMetadata = self.adMetadata, currentTime >= 1 { if (self.configuration.debug) { - print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .progress1 event with adMetadata \(adMetadata.toJsonString())") } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false @@ -166,7 +166,7 @@ public class AdscriptAdapter { let adMetadata = self.adMetadata, currentTime >= waitingSince + 1.0 { if (self.configuration.debug) { - print("[AdscriptConnector] Push .progress1 event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .progress1 event with adMetadata \(adMetadata.toJsonString())") } self.adscriptCollector.push(event: .progress1, data: adMetadata) self.waitingForFirstSecondOfAd = false @@ -233,20 +233,20 @@ public class AdscriptAdapter { self.playEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAY, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + print("[AdscriptConnector] Player Event: \(event.type) : currentTime = \(event.currentTime)") } }) self.playingEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) self.errorEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ERROR, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let code = event.errorObject?.code, let cause = event.errorObject?.cause, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : code = $s ; cause = $s", event.type, code, cause) + print("[AdscriptConnector] Player Event: \(event.type) : code = \(code) ; cause = \(cause)") } }) self.sourceChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.SOURCE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : source = $f", event.type, event.source.debugDescription) + print("[AdscriptConnector] Player Event: \(event.type) : source = \(event.source.debugDescription)") } if let playingEventListener: THEOplayerSDK.EventListener = welf.playingEventListener { @@ -258,45 +258,45 @@ public class AdscriptAdapter { self.endedEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.ENDED, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + print("[AdscriptConnector] Player Event: \(event.type) : currentTime = \(event.currentTime)") } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .complete event with contentMetadata $s", welf.contentMetadata.toJsonString()) + print("[AdscriptConnector] Push .complete event with contentMetadata \(welf.contentMetadata.toJsonString())") } welf.adscriptCollector.push(event: .complete, data: welf.contentMetadata) }) self.durationChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.DURATION_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let duration = event.duration, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : duration = $d", event.type, duration) + print("[AdscriptConnector] Player Event: \(event.type) : duration = \(duration)") } welf.addLogPoints(duration: event.duration) }) self.timeUpdateEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.TIME_UPDATE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : currentTime = $f", event.type, event.currentTime) + print("[AdscriptConnector] Player Event: \(event.type) : currentTime = \(event.currentTime)") } welf.maybeReportProgress(currentTime: event.currentTime) }) self.volumeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.VOLUME_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : volume = $f", event.type, event.volume) + print("[AdscriptConnector] Player Event: \(event.type) : volume = \(event.volume)") } welf.reportVolumeAndMuted(isMuted: welf.player.muted, volume: event.volume) }) self.rateChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.RATE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : playbackRate = $d", event.type, event.playbackRate) + print("[AdscriptConnector] Player Event: \(event.type) : playbackRate = \(event.playbackRate)") } welf.reportPlaybackSpeed(playbackRate: event.playbackRate) }) self.presentationModeChangeEventListener = player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PRESENTATION_MODE_CHANGE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if (welf.configuration.debug && LOG_PLAYER_EVENTS) { - print("[AdscriptConnector] Player Event: %s : presentationMode = $s", event.type, event.presentationMode._rawValue) + print("[AdscriptConnector] Player Event: \(event.type) : presentationMode = \(event.presentationMode._rawValue)") } welf.reportFullscreen(isFullscreen: event.presentationMode == PresentationMode.fullscreen) }) @@ -306,13 +306,13 @@ public class AdscriptAdapter { self.adBreakBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let offset = event.ad?.timeOffset, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) + print("[AdscriptConnector] Player Event: \(event.type) : offset = \(offset)") } }) self.adBeginListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BEGIN, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) + print("[AdscriptConnector] Player Event: \(event.type) : id = \(id)") } guard let ad = event.ad else { return } welf.buildAdMetadata(ad: ad) @@ -322,58 +322,58 @@ public class AdscriptAdapter { } guard let adMetadata = self?.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .start event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .start event with adMetadata \(adMetadata.toJsonString())") } welf.adscriptCollector.push(event: .start, data: adMetadata) }) self.adFirstQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_FIRST_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) + print("[AdscriptConnector] Player Event: \(event.type) : id = \(id)") } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .firstQuartile event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .firstQuartile event with adMetadata \(adMetadata.toJsonString())") } welf.adscriptCollector.push(event: .firstQuartile, data: adMetadata) }) self.adMidpointListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_MIDPOINT, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) + print("[AdscriptConnector] Player Event: \(event.type) : id = \(id)") } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .midpoint event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .midpoint event with adMetadata \(adMetadata.toJsonString())") } welf.adscriptCollector.push(event: .midpoint, data: adMetadata) }) self.adThirdQuartileListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_THIRD_QUARTILE, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let id = event.ad?.id, welf.configuration.debug { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) + print("[AdscriptConnector] Player Event: \(event.type) : id = \(id)") } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .thirdQuartile event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .thirdQuartile event with adMetadata \(adMetadata.toJsonString())") } welf.adscriptCollector.push(event: .thirdQuartile, data: adMetadata) }) self.adCompletedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let id = event.ad?.id, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : id = $s", event.type, id) + print("[AdscriptConnector] Player Event: \(event.type) : id = \(id)") } guard let adMetadata = welf.adMetadata else { return } if (welf.configuration.debug) { - print("[AdscriptConnector] Push .complete event with adMetadata $s", adMetadata.toJsonString()) + print("[AdscriptConnector] Push .complete event with adMetadata \(adMetadata.toJsonString())") } welf.adscriptCollector.push(event: .complete, data: adMetadata) }) self.adBreakEndedListener = player.ads.addEventListener(type: THEOplayerSDK.AdsEventTypes.AD_BREAK_END, listener: { [weak self] event in guard let welf: AdscriptAdapter = self else { return } if let offset = event.ad?.timeOffset, welf.configuration.debug && LOG_PLAYER_EVENTS { - print("[AdscriptConnector] Player Event: %s : offset = $s", event.type, offset) + print("[AdscriptConnector] Player Event: \(event.type) : offset = \(offset)") } if (event.ad?.timeOffset == 0) { welf.playingEventListener = welf.player.addEventListener(type: THEOplayerSDK.PlayerEventTypes.PLAYING, listener: { [weak self] event in self?.handlePlaying(event: event) }) From cf9876d1c7df109a7bae468c236a16dffac1b250 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Thu, 3 Jul 2025 23:32:19 +0200 Subject: [PATCH 30/35] split up pods and spm project --- .../project.pbxproj | 91 +++-- Code/Adscript-Examples/Cocoapod/Podfile.lock | 51 +++ .../project.pbxproj | 380 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../AppDelegate.swift | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 .../Info.plist | 0 .../PlayerView.swift | 0 .../SceneDelegate.swift | 0 .../ViewController.swift | 0 14 files changed, 502 insertions(+), 27 deletions(-) create mode 100644 Code/Adscript-Examples/Cocoapod/Podfile.lock create mode 100644 Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj create mode 100644 Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/AppDelegate.swift (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Assets.xcassets/Contents.json (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Base.lproj/LaunchScreen.storyboard (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Base.lproj/Main.storyboard (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/Info.plist (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/PlayerView.swift (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/SceneDelegate.swift (100%) rename Code/Adscript-Examples/{Cocoapod/AdscriptReporter => SharedCode}/ViewController.swift (100%) diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj index 1f46b609..86c56021 100644 --- a/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj +++ b/Code/Adscript-Examples/Cocoapod/AdscriptReporter.xcodeproj/project.pbxproj @@ -7,6 +7,13 @@ objects = { /* Begin PBXBuildFile section */ + 295ED3E52E16B2350095420B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3DB2E16B2350095420B /* Assets.xcassets */; }; + 295ED3E72E16B2350095420B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3E02E16B2350095420B /* Main.storyboard */; }; + 295ED3E82E16B2350095420B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3DE2E16B2350095420B /* LaunchScreen.storyboard */; }; + 295ED3E92E16B2350095420B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3DA2E16B2350095420B /* AppDelegate.swift */; }; + 295ED3EA2E16B2350095420B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3E32E16B2350095420B /* ViewController.swift */; }; + 295ED3EB2E16B2350095420B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3E22E16B2350095420B /* SceneDelegate.swift */; }; + 295ED3EC2E16B2350095420B /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3E12E16B2350095420B /* PlayerView.swift */; }; 869D111A592EF8154DA1AB03 /* libPods-AdscriptReporter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F7AEAE2F99316EBC3A7E059A /* libPods-AdscriptReporter.a */; }; /* End PBXBuildFile section */ @@ -28,6 +35,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 295ED3DA2E16B2350095420B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 295ED3DB2E16B2350095420B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 295ED3DC2E16B2350095420B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 295ED3DD2E16B2350095420B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 295ED3DF2E16B2350095420B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 295ED3E12E16B2350095420B /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; + 295ED3E22E16B2350095420B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 295ED3E32E16B2350095420B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 29994EB22DFDC6D80016F0E2 /* AdscriptReporter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdscriptReporter.app; sourceTree = BUILT_PRODUCTS_DIR; }; 29994EC82DFDC6DA0016F0E2 /* AdscriptReporterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdscriptReporterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 29994ED22DFDC6DA0016F0E2 /* AdscriptReporterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdscriptReporterUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -36,27 +51,6 @@ F7AEAE2F99316EBC3A7E059A /* libPods-AdscriptReporter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AdscriptReporter.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 29994EDA2DFDC6DA0016F0E2 /* Exceptions for "AdscriptReporter" folder in "AdscriptReporter" target */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - Info.plist, - ); - target = 29994EB12DFDC6D80016F0E2 /* AdscriptReporter */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - 29994EDA2DFDC6DA0016F0E2 /* Exceptions for "AdscriptReporter" folder in "AdscriptReporter" target */, - ); - path = AdscriptReporter; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ 29994EAF2DFDC6D80016F0E2 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -83,10 +77,26 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 295ED3E42E16B2350095420B /* AdscriptReporter */ = { + isa = PBXGroup; + children = ( + 295ED3DA2E16B2350095420B /* AppDelegate.swift */, + 295ED3DB2E16B2350095420B /* Assets.xcassets */, + 295ED3DC2E16B2350095420B /* Info.plist */, + 295ED3DE2E16B2350095420B /* LaunchScreen.storyboard */, + 295ED3E02E16B2350095420B /* Main.storyboard */, + 295ED3E12E16B2350095420B /* PlayerView.swift */, + 295ED3E22E16B2350095420B /* SceneDelegate.swift */, + 295ED3E32E16B2350095420B /* ViewController.swift */, + ); + name = AdscriptReporter; + path = ../SharedCode; + sourceTree = SOURCE_ROOT; + }; 29994EA92DFDC6D80016F0E2 = { isa = PBXGroup; children = ( - 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */, + 295ED3E42E16B2350095420B /* AdscriptReporter */, 29994EB32DFDC6D80016F0E2 /* Products */, 2DEA1210CC5916F8004A4364 /* Pods */, D1C02604FAF420079FE8B046 /* Frameworks */, @@ -137,9 +147,6 @@ ); dependencies = ( ); - fileSystemSynchronizedGroups = ( - 29994EB42DFDC6D80016F0E2 /* AdscriptReporter */, - ); name = AdscriptReporter; productName = AdscriptReporter; productReference = 29994EB22DFDC6D80016F0E2 /* AdscriptReporter.app */; @@ -230,6 +237,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 295ED3E52E16B2350095420B /* Assets.xcassets in Resources */, + 295ED3E72E16B2350095420B /* Main.storyboard in Resources */, + 295ED3E82E16B2350095420B /* LaunchScreen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -280,10 +290,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AdscriptReporter/Pods-AdscriptReporter-frameworks.sh\"\n"; @@ -296,6 +310,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 295ED3E92E16B2350095420B /* AppDelegate.swift in Sources */, + 295ED3EA2E16B2350095420B /* ViewController.swift in Sources */, + 295ED3EB2E16B2350095420B /* SceneDelegate.swift in Sources */, + 295ED3EC2E16B2350095420B /* PlayerView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -328,6 +346,25 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + 295ED3DE2E16B2350095420B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 295ED3DD2E16B2350095420B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + 295ED3E02E16B2350095420B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 295ED3DF2E16B2350095420B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 29994EDC2DFDC6DA0016F0E2 /* Debug */ = { isa = XCBuildConfiguration; @@ -339,7 +376,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = G749Q24N3X; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_FILE = ../SharedCode/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -368,7 +405,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = G749Q24N3X; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_FILE = ../SharedCode/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; diff --git a/Code/Adscript-Examples/Cocoapod/Podfile.lock b/Code/Adscript-Examples/Cocoapod/Podfile.lock new file mode 100644 index 00000000..cd14db5b --- /dev/null +++ b/Code/Adscript-Examples/Cocoapod/Podfile.lock @@ -0,0 +1,51 @@ +PODS: + - AdscriptApiClient (1.0.4) + - InternalCollectionsUtilities (1.1.1) + - swift-collections (1.1.1): + - swift-collections/BitCollections (= 1.1.1) + - swift-collections/DequeModule (= 1.1.1) + - swift-collections/HashTreeCollections (= 1.1.1) + - swift-collections/HeapModule (= 1.1.1) + - swift-collections/OrderedCollections (= 1.1.1) + - swift-collections/BitCollections (1.1.1): + - InternalCollectionsUtilities (= 1.1.1) + - swift-collections/DequeModule (1.1.1): + - InternalCollectionsUtilities (= 1.1.1) + - swift-collections/HashTreeCollections (1.1.1): + - InternalCollectionsUtilities (= 1.1.1) + - swift-collections/HeapModule (1.1.1): + - InternalCollectionsUtilities (= 1.1.1) + - swift-collections/OrderedCollections (1.1.1): + - InternalCollectionsUtilities (= 1.1.1) + - THEOplayer-Connector-Adscript (9.5.1): + - AdscriptApiClient (>= 1.0.4) + - swift-collections (~> 1.1) + - THEOplayerSDK-core (~> 9) + - THEOplayerSDK-core (9.5.1) + +DEPENDENCIES: + - AdscriptApiClient (from `Frameworks/`) + - THEOplayer-Connector-Adscript (from `../../../`) + +SPEC REPOS: + trunk: + - InternalCollectionsUtilities + - swift-collections + - THEOplayerSDK-core + +EXTERNAL SOURCES: + AdscriptApiClient: + :path: Frameworks/ + THEOplayer-Connector-Adscript: + :path: "../../../" + +SPEC CHECKSUMS: + AdscriptApiClient: 7ef1012a2b6d597c7dd5858d20726c4045768733 + InternalCollectionsUtilities: af3f471602c4a67cbcb0bee0a80f6f55a33ae453 + swift-collections: ba248ecaf44ef500b27d5cf94d304218c89892ff + THEOplayer-Connector-Adscript: 4dfcb0ebb17aa868ddbe6b63b5a53226861deb37 + THEOplayerSDK-core: df3ec4ed64e19bd006f6a5476d96161e07f700a3 + +PODFILE CHECKSUM: 2d601d96608b6ce3d8d2f78d6e205aca8709be50 + +COCOAPODS: 1.16.2 diff --git a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj new file mode 100644 index 00000000..32669337 --- /dev/null +++ b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj @@ -0,0 +1,380 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 295ED3D22E16B19B0095420B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3C92E16B19B0095420B /* Info.plist */; }; + 295ED3D32E16B19B0095420B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CB2E16B19B0095420B /* LaunchScreen.storyboard */; }; + 295ED3D42E16B19B0095420B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CD2E16B19B0095420B /* Main.storyboard */; }; + 295ED3D52E16B19B0095420B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3C82E16B19B0095420B /* Assets.xcassets */; }; + 295ED3D62E16B19B0095420B /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3CE2E16B19B0095420B /* PlayerView.swift */; }; + 295ED3D72E16B19B0095420B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3C72E16B19B0095420B /* AppDelegate.swift */; }; + 295ED3D82E16B19B0095420B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3D02E16B19B0095420B /* ViewController.swift */; }; + 295ED3D92E16B19B0095420B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295ED3CF2E16B19B0095420B /* SceneDelegate.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 295ED3AF2E16B1260095420B /* AdscriptReporter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdscriptReporter.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 295ED3C72E16B19B0095420B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 295ED3C82E16B19B0095420B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 295ED3C92E16B19B0095420B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 295ED3CA2E16B19B0095420B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 295ED3CC2E16B19B0095420B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 295ED3CE2E16B19B0095420B /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; + 295ED3CF2E16B19B0095420B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 295ED3D02E16B19B0095420B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 295ED3AC2E16B1260095420B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 295ED3A62E16B1260095420B = { + isa = PBXGroup; + children = ( + 295ED3D12E16B19B0095420B /* SharedCode */, + 295ED3B02E16B1260095420B /* Products */, + ); + sourceTree = ""; + }; + 295ED3B02E16B1260095420B /* Products */ = { + isa = PBXGroup; + children = ( + 295ED3AF2E16B1260095420B /* AdscriptReporter.app */, + ); + name = Products; + sourceTree = ""; + }; + 295ED3D12E16B19B0095420B /* SharedCode */ = { + isa = PBXGroup; + children = ( + 295ED3C72E16B19B0095420B /* AppDelegate.swift */, + 295ED3C82E16B19B0095420B /* Assets.xcassets */, + 295ED3C92E16B19B0095420B /* Info.plist */, + 295ED3CB2E16B19B0095420B /* LaunchScreen.storyboard */, + 295ED3CD2E16B19B0095420B /* Main.storyboard */, + 295ED3CE2E16B19B0095420B /* PlayerView.swift */, + 295ED3CF2E16B19B0095420B /* SceneDelegate.swift */, + 295ED3D02E16B19B0095420B /* ViewController.swift */, + ); + name = AdscriptReporter; + path = ../SharedCode; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 295ED3AE2E16B1260095420B /* AdscriptReporter */ = { + isa = PBXNativeTarget; + buildConfigurationList = 295ED3C22E16B1270095420B /* Build configuration list for PBXNativeTarget "AdscriptReporter" */; + buildPhases = ( + 295ED3AB2E16B1260095420B /* Sources */, + 295ED3AC2E16B1260095420B /* Frameworks */, + 295ED3AD2E16B1260095420B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AdscriptReporter; + packageProductDependencies = ( + ); + productName = AdscriptReporter; + productReference = 295ED3AF2E16B1260095420B /* AdscriptReporter.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 295ED3A72E16B1260095420B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1640; + LastUpgradeCheck = 1640; + TargetAttributes = { + 295ED3AE2E16B1260095420B = { + CreatedOnToolsVersion = 16.4; + }; + }; + }; + buildConfigurationList = 295ED3AA2E16B1260095420B /* Build configuration list for PBXProject "AdscriptReporter" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 295ED3A62E16B1260095420B; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 295ED3B02E16B1260095420B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 295ED3AE2E16B1260095420B /* AdscriptReporter */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 295ED3AD2E16B1260095420B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 295ED3D22E16B19B0095420B /* Info.plist in Resources */, + 295ED3D32E16B19B0095420B /* LaunchScreen.storyboard in Resources */, + 295ED3D42E16B19B0095420B /* Main.storyboard in Resources */, + 295ED3D52E16B19B0095420B /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 295ED3AB2E16B1260095420B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 295ED3D62E16B19B0095420B /* PlayerView.swift in Sources */, + 295ED3D72E16B19B0095420B /* AppDelegate.swift in Sources */, + 295ED3D82E16B19B0095420B /* ViewController.swift in Sources */, + 295ED3D92E16B19B0095420B /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 295ED3CB2E16B19B0095420B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 295ED3CA2E16B19B0095420B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + 295ED3CD2E16B19B0095420B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 295ED3CC2E16B19B0095420B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 295ED3C32E16B1270095420B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8YAB8ZY55Y; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 295ED3C42E16B1270095420B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8YAB8ZY55Y; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.theoplayer.adscript.ios.integration.AdscriptReporter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 295ED3C52E16B1270095420B /* 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; + DEVELOPMENT_TEAM = 8YAB8ZY55Y; + 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; + }; + 295ED3C62E16B1270095420B /* 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"; + DEVELOPMENT_TEAM = 8YAB8ZY55Y; + 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; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 295ED3AA2E16B1260095420B /* Build configuration list for PBXProject "AdscriptReporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 295ED3C52E16B1270095420B /* Debug */, + 295ED3C62E16B1270095420B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 295ED3C22E16B1270095420B /* Build configuration list for PBXNativeTarget "AdscriptReporter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 295ED3C32E16B1270095420B /* Debug */, + 295ED3C42E16B1270095420B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 295ED3A72E16B1260095420B /* Project object */; +} diff --git a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift b/Code/Adscript-Examples/SharedCode/AppDelegate.swift similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/AppDelegate.swift rename to Code/Adscript-Examples/SharedCode/AppDelegate.swift diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json b/Code/Adscript-Examples/SharedCode/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AccentColor.colorset/Contents.json rename to Code/Adscript-Examples/SharedCode/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json b/Code/Adscript-Examples/SharedCode/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Code/Adscript-Examples/SharedCode/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json b/Code/Adscript-Examples/SharedCode/Assets.xcassets/Contents.json similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Assets.xcassets/Contents.json rename to Code/Adscript-Examples/SharedCode/Assets.xcassets/Contents.json diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard b/Code/Adscript-Examples/SharedCode/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/LaunchScreen.storyboard rename to Code/Adscript-Examples/SharedCode/Base.lproj/LaunchScreen.storyboard diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard b/Code/Adscript-Examples/SharedCode/Base.lproj/Main.storyboard similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Base.lproj/Main.storyboard rename to Code/Adscript-Examples/SharedCode/Base.lproj/Main.storyboard diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist b/Code/Adscript-Examples/SharedCode/Info.plist similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/Info.plist rename to Code/Adscript-Examples/SharedCode/Info.plist diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift b/Code/Adscript-Examples/SharedCode/PlayerView.swift similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/PlayerView.swift rename to Code/Adscript-Examples/SharedCode/PlayerView.swift diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift b/Code/Adscript-Examples/SharedCode/SceneDelegate.swift similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/SceneDelegate.swift rename to Code/Adscript-Examples/SharedCode/SceneDelegate.swift diff --git a/Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift b/Code/Adscript-Examples/SharedCode/ViewController.swift similarity index 100% rename from Code/Adscript-Examples/Cocoapod/AdscriptReporter/ViewController.swift rename to Code/Adscript-Examples/SharedCode/ViewController.swift From 79fc2af0ebfd1a4f935abc539b33d3718b995573 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 4 Jul 2025 00:19:09 +0200 Subject: [PATCH 31/35] add adscript --- Package.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Package.swift b/Package.swift index 94c685a3..5b236002 100644 --- a/Package.swift +++ b/Package.swift @@ -13,6 +13,8 @@ let package = Package( .library(name: "THEOplayerConnectorNielsen", targets: ["THEOplayerConnectorNielsen"]), + .library(name: "THEOplayerConnectorAdscript", targets: ["THEOplayerConnectorAdscript"]), + .library(name: "THEOplayerConnectorUtilities", targets: ["THEOplayerConnectorUtilities"]), .library(name: "THEOplayerConnectorSideloadedSubtitle", targets: ["THEOplayerConnectorSideloadedSubtitle"]), @@ -61,6 +63,15 @@ let package = Package( path: "Code/Nielsen/Source" ), + // ADSCRIPT \\ + .target( + name: "THEOplayerConnectorAdscript", + dependencies: [ + "THEOplayerSDK" + ], + path: "Code/Adscript/Source" + ), + // UTILITY \\ .target( name: "THEOplayerConnectorUtilities", From 57684d8f600239070f150eecafa39bbb8c93e5c1 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 4 Jul 2025 00:49:38 +0200 Subject: [PATCH 32/35] add collections dependency --- Package.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 5b236002..e19db05e 100644 --- a/Package.swift +++ b/Package.swift @@ -29,6 +29,7 @@ let package = Package( .package(name: "NielsenAppApi", url: "https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-dynamic-spm-global", from: "9.0.0"), .package(name: "Swifter", url: "https://github.com/httpswift/swifter.git", .exactItem("1.5.0")), .package(name: "SwiftSubtitles", url: "https://github.com/dagronf/SwiftSubtitles.git", .exactItem("0.9.1")), + .package(url: "https://github.com/apple/swift-collections.git", .upToNextMinor(from: "1.2.0")), ], targets: [ // CONVIVA \\ @@ -67,7 +68,8 @@ let package = Package( .target( name: "THEOplayerConnectorAdscript", dependencies: [ - "THEOplayerSDK" + "THEOplayerSDK", + .product(name: "Collections", package: "swift-collections") ], path: "Code/Adscript/Source" ), From bedf365925b7019c56acabd89fda88e991ed478e Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 4 Jul 2025 00:52:44 +0200 Subject: [PATCH 33/35] add package dependency --- .../project.pbxproj | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj index 32669337..543af74b 100644 --- a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj +++ b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 295C3DD72E174118000C4499 /* THEOplayerConnectorAdscript in Frameworks */ = {isa = PBXBuildFile; productRef = 295C3DD62E174118000C4499 /* THEOplayerConnectorAdscript */; }; 295ED3D22E16B19B0095420B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3C92E16B19B0095420B /* Info.plist */; }; 295ED3D32E16B19B0095420B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CB2E16B19B0095420B /* LaunchScreen.storyboard */; }; 295ED3D42E16B19B0095420B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CD2E16B19B0095420B /* Main.storyboard */; }; @@ -34,6 +35,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 295C3DD72E174118000C4499 /* THEOplayerConnectorAdscript in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -43,7 +45,7 @@ 295ED3A62E16B1260095420B = { isa = PBXGroup; children = ( - 295ED3D12E16B19B0095420B /* SharedCode */, + 295ED3D12E16B19B0095420B /* AdscriptReporter */, 295ED3B02E16B1260095420B /* Products */, ); sourceTree = ""; @@ -56,7 +58,7 @@ name = Products; sourceTree = ""; }; - 295ED3D12E16B19B0095420B /* SharedCode */ = { + 295ED3D12E16B19B0095420B /* AdscriptReporter */ = { isa = PBXGroup; children = ( 295ED3C72E16B19B0095420B /* AppDelegate.swift */, @@ -89,6 +91,7 @@ ); name = AdscriptReporter; packageProductDependencies = ( + 295C3DD62E174118000C4499 /* THEOplayerConnectorAdscript */, ); productName = AdscriptReporter; productReference = 295ED3AF2E16B1260095420B /* AdscriptReporter.app */; @@ -118,6 +121,9 @@ ); mainGroup = 295ED3A62E16B1260095420B; minimizedProjectReferenceProxies = 1; + packageReferences = ( + 295C3DD52E174118000C4499 /* XCLocalSwiftPackageReference "../../../../iOS-Connector" */, + ); preferredProjectObjectVersion = 77; productRefGroup = 295ED3B02E16B1260095420B /* Products */; projectDirPath = ""; @@ -375,6 +381,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 295C3DD52E174118000C4499 /* XCLocalSwiftPackageReference "../../../../iOS-Connector" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = "../../../../iOS-Connector"; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 295C3DD62E174118000C4499 /* THEOplayerConnectorAdscript */ = { + isa = XCSwiftPackageProductDependency; + productName = THEOplayerConnectorAdscript; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 295ED3A72E16B1260095420B /* Project object */; } From 6e47b203e9c55586947c0af9cb6f80036bcd3961 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 4 Jul 2025 00:53:51 +0200 Subject: [PATCH 34/35] use shared info.plist --- .../SPM/AdscriptReporter.xcodeproj/project.pbxproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj index 543af74b..1cffcb52 100644 --- a/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj +++ b/Code/Adscript-Examples/SPM/AdscriptReporter.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 295C3DD72E174118000C4499 /* THEOplayerConnectorAdscript in Frameworks */ = {isa = PBXBuildFile; productRef = 295C3DD62E174118000C4499 /* THEOplayerConnectorAdscript */; }; - 295ED3D22E16B19B0095420B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3C92E16B19B0095420B /* Info.plist */; }; 295ED3D32E16B19B0095420B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CB2E16B19B0095420B /* LaunchScreen.storyboard */; }; 295ED3D42E16B19B0095420B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3CD2E16B19B0095420B /* Main.storyboard */; }; 295ED3D52E16B19B0095420B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 295ED3C82E16B19B0095420B /* Assets.xcassets */; }; @@ -139,7 +138,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 295ED3D22E16B19B0095420B /* Info.plist in Resources */, 295ED3D32E16B19B0095420B /* LaunchScreen.storyboard in Resources */, 295ED3D42E16B19B0095420B /* Main.storyboard in Resources */, 295ED3D52E16B19B0095420B /* Assets.xcassets in Resources */, @@ -191,7 +189,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 8YAB8ZY55Y; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_FILE = ../SharedCode/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -219,7 +217,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 8YAB8ZY55Y; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = AdscriptReporter/Info.plist; + INFOPLIST_FILE = ../SharedCode/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; From bfe13a696c48c120b14536aa5aee6f7dfe17ef65 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 4 Jul 2025 10:19:18 +0200 Subject: [PATCH 35/35] add documentation --- Code/Adscript-Examples/README.md | 3 +- Code/Adscript/README.md | 94 +++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 3 deletions(-) diff --git a/Code/Adscript-Examples/README.md b/Code/Adscript-Examples/README.md index 4869a10f..84efebcd 100644 --- a/Code/Adscript-Examples/README.md +++ b/Code/Adscript-Examples/README.md @@ -2,4 +2,5 @@ We provide source code of two sample applications that illustrate how to use the connector with different package managers: -- [Sample using **Cocoapods**](./Cocoapod) (requires Cocoapods installation through terminal) +- [Sample using **Swift Package Manager**](./SPM) (works out of the box with Xcode 12 and above) +- [Sample using **Cocoapods**](./Cocoapod) (requires Cocoapods installation through terminal) \ No newline at end of file diff --git a/Code/Adscript/README.md b/Code/Adscript/README.md index a5775308..ec4a23d8 100644 --- a/Code/Adscript/README.md +++ b/Code/Adscript/README.md @@ -2,8 +2,98 @@ THEOplayer-Connector-Adscript provides an integration between the THEOplayerSDK and Adscript. +For example xcode projects with this connector see [Adscript-Examples](../Adscript-Examples/README.md). + ## Installation -TODO + +### [Swift Package Manager](https://swift.org/package-manager/) + +1. In Xcode, install the Adscript connector by navigating to **File > Add Packages** +2. In the prompt that appears, select the iOS-Connector GitHub repository: `https://github.com/THEOplayer/iOS-Connector` +3. Select the version you want to use. +4. Choose the Connector libraries you want to include in your app. +5. The Adscript SDK is not available as a Swift Package. Download the .xcframework from the Adscript developer portal and drag it onto Project > General > Frameworks, Libraries and Embedded Content. + +To support custom feature builds of THEOplayerSDK perform the following steps: + +1. Clone this repository to your computer. +2. Use a [local override](https://developer.apple.com/documentation/xcode/editing-a-package-dependency-as-a-local-package) of the `theoplayer-sdk-ios` package by selecting the folder `../../Helpers/TheoSPM/theoplayer-sdk-ios` in Finder and dragging it into the Project navigator of your Xcode project. +3. Place your custom THEOplayerSDK.xcframework at `../../Helpers/TheoSPM/theoplayer-sdk-ios/THEOplayerSDK.xcframework`. (It is also possible to place your xcframework somewhere else. In that case make sure to update the [Package.swift](../../Helpers/TheoSPM/theoplayer-sdk-ios/Package.swift) manifest inside the your local override so that it points to your custom THEOplayer build) +4. If Xcode complains about a missing xcframework + 1. Choose `File` > `Packages` > `Reset Package Caches` from the menu bar. + 2. If it is still not working, make sure to remove any `THEOplayerSDK.xcframework` inclusions that you manually installed before installing this THEOplayer-Connector-Adscript package. + +### [Cocoapods](https://guides.cocoapods.org/using/getting-started.html#getting-started) + +1. Create a Podfile if you don't already have one. From the root of your project directory, run the following command: `pod init` +2. To your Podfile, add the Adscript connector pods that you want to use in your app: `pod 'THEOplayer-Connector-Adscript'` +3. The Adscript SDK is not available as a pod. Download the .xcframework from the Adscript developer portal. Place it in a folder next to a custom podspec. Refer to the ones in [Adscript-Example for Cocoapods for an example](./../Adscript-Examples//Cocoapod/Frameworks/). Include a line in you app's Podfile to point to that podspec for the `AscriptApiClient` dependency. +```ruby + pod 'AdscriptApiClient', :path => 'path/to/folder/with/custompodspec/' +``` +4. Install the pods using `pod install` , then open your `.xcworkspace` file to see the project in Xcode. + +**Important note**: You will need to set Project > Build Settings > User Script Sandboxing to `No` + + +To support custom feature builds of THEOplayerSDK perform the following steps: + +1. Clone this repository to your computer. +2. Use a [local override](https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine) of the `THEOplayerSDK-basic` pod by adding the following line to your projects Podfile: `pod 'THEOplayerSDK-basic', :path => 'iOS-Connector/Helpers/TheoPod'` and make sure the path points to the [TheoPod folder](../../Helpers/TheoPod). ## Usage -TODO \ No newline at end of file + +Import the `THEOplayerConnectorAdscript` module + +```swift +import THEOplayerConnectorAdscript +``` + +Create a `AdscriptConfiguration` that contains your implementation id and a flag to enable/disable debug logging: + +```swift +let configuration = AdscriptConfiguration( + implementationId: "test123", + debug: true +) +``` + +Create a `AdscriptConnector` that uses this `configuration`, your `THEOplayer` instance and the metadata for the first source you will set on the player: + +```swift +let connector = AdscriptConnector( + configuration: configuration, + player: player, + metadata: adscriptContentMetadata +) +``` + +During the connector's lifecycle, you can update the metadata of the currently set source using the `update` method, which you pass an `AdScriptDataObject`. + +```swift +var adscriptContentMetadata = AdScriptDataObject() + .set(key: .length, value: 596) + .set(key: .assetId, value: "0123ABC") + .set(key: .channelId, value: "Dolby Test Asset") + .set(key: .program, value: "Big Buck Bunny") + .set(key: .livestream, value: "0") + .set(key: .type, value: .content) + +connector.update(metadata: adscriptContentMetadata) +``` + +Change user info with the `updateUser` method, which you pass a `AdScriptI12n` object: +```swift +var adScriptI12n = AdScriptI12n() + .set(key: 1, value: "28c7dacc-e68b-4fb7-9770-efeaaabe6688") // client-side user identifier (customerId) + .set(key: 2, value: "29c7dacc-e68b-4fb7-9770-efeaaabe6688") // client-side user device identifier (deviceId) + .set(key: 3, value: "30c7dacc-e68b-4fb7-9770-efeaaabe6688") // client-side profile identifier of the logged-in user (profileId) + .set(key: 4, value: "31c7dacc-e68b-4fb7-9770-efeaaabe6688") // optional - SW device identifier for a situation where there are multiple device IDs in the client DB (typically a) HW ID - fill in i2, b) SW ID - fill in i4). + .set(key: 5, value: "ef3c6dc72a26912f07f0e733d51b46c771d807bf") // fingerprint of user's email address +connector.updateUser(i12n: adScriptI12n) +``` + +On each DidBecomeActive, you need to call +```swift +connector.sessionStart() +``` \ No newline at end of file