Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEC-12640 SPM Added #77

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ concurrency:

jobs:
build:
name: "CocoaPods linting"
environment: PR
runs-on: macos-latest

needs: SPM

steps:
- uses: actions/checkout@v3

Expand All @@ -29,3 +31,22 @@ jobs:

- name: Pod linting
run: pod lib lint --fail-fast --verbose --allow-warnings

SPM:
name: "Test SPM"
environment: PR
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=16.0,name=iPhone 14 Pro"
name: "iOS"
scheme: "KalturaPlayer-Package"
- destination: "OS=16.0,name=Apple TV"
name: "tvOS"
scheme: "KalturaPlayer-Package"
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean test | xcpretty
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:

jobs:
build:
name: "CocoaPods linting"
runs-on: macos-latest

steps:
Expand All @@ -28,3 +29,22 @@ jobs:

- name: Pod linting
run: pod lib lint --fail-fast --verbose --allow-warnings

SPM:
name: "Test SPM"
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
include:
- destination: "OS=16.0,name=iPhone 14 Pro"
name: "iOS"
scheme: "KalturaPlayer-Package"
- destination: "OS=16.0,name=Apple TV"
name: "tvOS"
scheme: "KalturaPlayer-Package"
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean test | xcpretty
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,31 @@ on:

jobs:

SPM:
name: "Test SPM"
environment: Tag
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=16.0,name=iPhone 14 Pro"
name: "iOS"
scheme: "KalturaPlayer-Package"
- destination: "OS=16.0,name=Apple TV"
name: "tvOS"
scheme: "KalturaPlayer-Package"
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean test | xcpretty

TAGGING:
name: "Add Git Tag"
runs-on: macos-latest
environment: Tag
needs: SPM

outputs:
output1: ${{ steps.tagging.outputs.tag }}

Expand All @@ -24,6 +46,7 @@ jobs:
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} sh .github/tag.sh

PODS_PUSH:
name: "CocoaPods push"
runs-on: macos-latest
environment: CocoaPods
needs: TAGGING
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
Package.resolved
.build/

# CocoaPods
Expand Down
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions KalturaPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
sp.ios.deployment_target = '10.0'
sp.tvos.deployment_target = '10.0'

sp.source_files = 'Sources/*', 'Sources/Basic/*', 'Sources/Playlist/*'
sp.source_files = 'Sources/Player/Core/*', 'Sources/Player/Basic/*', 'Sources/Player/Playlist/*'

sp.dependency 'KalturaPlayer/Interceptor'
end
Expand Down Expand Up @@ -63,9 +63,9 @@ Pod::Spec.new do |s|
s.subspec 'Offline' do |sp|
sp.ios.deployment_target = '10.0'

sp.source_files = 'Sources/Offline/*', 'Sources/*', 'Sources/Basic/*', 'Sources/Interceptor/*', 'Sources/Playlist/*'
sp.source_files = 'Sources/Offline/*', 'Sources/Player/Core/*', 'Sources/Player/Basic/*', 'Sources/Interceptor/*', 'Sources/Player/Playlist/*'

sp.dependency 'DownloadToGo', '~> 3.18'
sp.dependency 'DownloadToGo', '~> 3.17'
sp.dependency 'PlayKit', '~> 3.27'

sp.xcconfig = {
Expand Down
87 changes: 87 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// swift-tools-version:5.3

import PackageDescription

let package = Package(
name: "KalturaPlayer",
platforms: [.iOS(.v11),
.tvOS(.v11)],
products: [
.library(name: "KalturaPlayer",
targets: ["KalturaPlayer"]),
.library(name: "KalturaPlayerOTT",
targets: ["KalturaPlayerOTT", "Common", "KalturaPlayer"]),
.library(name: "KalturaPlayerOVP",
targets: ["KalturaPlayerOVP", "Common", "KalturaPlayer"]),
.library(name: "Interceptor",
targets: ["Interceptor"])
],
dependencies: [
.package(name: "PlayKit",
url: "https://github.com/kaltura/playkit-ios.git",
.upToNextMinor(from: "3.27.1")),
.package(name: "PlayKitProviders",
url: "https://github.com/kaltura/playkit-ios-providers.git",
.upToNextMinor(from: "1.18.1")),
.package(name: "PlayKitKava",
url: "https://github.com/kaltura/playkit-ios-kava.git",
.upToNextMinor(from: "1.10.1")),
.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "5.0.0")),
.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "9.0.0")),
],
targets: [

.target(name: "Interceptor",
dependencies: [
.product(name: "PlayKit", package: "PlayKit")
],
path: "Sources/Interceptor/"),

.target(name: "KalturaPlayer",
dependencies: ["Interceptor"],
path: "Sources/Player"),

.target(name: "KalturaPlayerOTT",
dependencies: [
"KalturaPlayer",
"Common",
.product(name: "PlayKitProviders", package: "PlayKitProviders"),
.product(name: "PlayKitKava", package: "PlayKitKava")
],
path: "Sources/OTT",
swiftSettings: [
.define("KalturaPlayerOTT_Package")
]),

.target(name: "KalturaPlayerOVP",
dependencies: [
"KalturaPlayer",
"Common",
.product(name: "PlayKitProviders", package: "PlayKitProviders"),
.product(name: "PlayKitKava", package: "PlayKitKava")
],
path: "Sources/OVP",
swiftSettings: [
.define("KalturaPlayerOVP_Package")
]),

.target(name: "Common",
dependencies: [
.product(name: "PlayKit", package: "PlayKit"),
.product(name: "PlayKitKava", package: "PlayKitKava")
],
path: "Sources/Common"),

.testTarget(name: "KalturaPlayerTests",
dependencies: [
"KalturaPlayer",
"Quick",
"Nimble"
],
path: "Tests/Basic",
exclude: [])
]
// swiftLanguageVersions: [
// SwiftVersion.v5,
// ]
)
4 changes: 2 additions & 2 deletions Sources/Common/KavaHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import Foundation
import PlayKit
import PlayKitKava

class KavaHelper {
public class KavaHelper {

static func getPluginConfig(ovpPartnerId: Int64,
static public func getPluginConfig(ovpPartnerId: Int64,
ovpEntryId: String,
ks: String?,
referrer: String,
Expand Down
2 changes: 1 addition & 1 deletion Sources/OTT/DMSConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct DMSConfiguration: Codable {
var params: DMSConfigParams
}

struct DMSConfigParams: Codable {
public struct DMSConfigParams: Codable {
var analyticsUrl: String
var ovpServiceUrl: String
var ovpPartnerId: Int64
Expand Down
10 changes: 8 additions & 2 deletions Sources/OTT/KPOTTDMSConfigModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum DMSConfigEntityAttribute: String {
case createdDate
}

struct OTTDMSConfig {
public struct OTTDMSConfig {
var analyticsUrl: String
var ovpPartnerId: Int64
var ovpServiceUrl: String
Expand All @@ -34,7 +34,13 @@ class KPOTTDMSConfigModel {
private init() {}

lazy var persistanteContainer: NSPersistentContainer = {
let dmsConfigModelBundle = Bundle(for: KPOTTDMSConfigModel.self)

var dmsConfigModelBundle = Bundle(for: KPOTTDMSConfigModel.self)

#if KalturaPlayerOTT_Package
dmsConfigModelBundle = Bundle.module
#endif

guard let modelURL = dmsConfigModelBundle.url(forResource: "KPOTTDMSConfigModel", withExtension: "momd"),
let managedObjectModel = NSManagedObjectModel(contentsOf: modelURL) else {
fatalError("KPOTTDMSConfigModel is missing from the bundle!")
Expand Down
3 changes: 2 additions & 1 deletion Sources/OTT/KPOTTPlaylistController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import Foundation
import PlayKit
import KalturaPlayer

@objc public class KPOTTPlaylistController: KPPlaylistController {

internal var originalOTTMediaOptions: [OTTMediaOptions]?

override internal func prepareMediaOptions(forMediaEntry entry: PKMediaEntry) -> MediaOptions? {
override public func prepareMediaOptions(forMediaEntry entry: PKMediaEntry) -> MediaOptions? {
let options: OTTMediaOptions

if let ottOptions = self.originalOTTMediaOptions?.first(where: { $0.assetId == entry.id }) {
Expand Down
17 changes: 12 additions & 5 deletions Sources/OTT/KalturaOTTPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import PlayKit
import PlayKitProviders
import PlayKitKava

#if canImport(KalturaPlayer)
import KalturaPlayer
#endif
#if canImport(Common)
import Common
#endif

@objc public class KalturaOTTPlayer: KalturaPlayer {

private var ottMediaOptions: OTTMediaOptions? {
Expand Down Expand Up @@ -92,10 +99,10 @@ import PlayKitKava

// MARK: - Private Methods

internal override func setMediaAndUpdatePlugins(mediaEntry: PKMediaEntry,
mediaOptions: MediaOptions?,
pluginConfig: PluginConfig?,
callback: @escaping (_ error: NSError?) -> Void) {
public override func setMediaAndUpdatePlugins(mediaEntry: PKMediaEntry,
mediaOptions: MediaOptions?,
pluginConfig: PluginConfig?,
callback: @escaping (_ error: NSError?) -> Void) {

if let options = mediaOptions as? OTTMediaOptions {
ottMediaOptions = options
Expand Down Expand Up @@ -289,7 +296,7 @@ extension KalturaOTTPlayer {

extension KalturaOTTPlayer: EntryLoader {

internal func loadMedia(options: MediaOptions, callback: @escaping (_ entry: PKMediaEntry?, _ error: NSError?) -> Void) {
public func loadMedia(options: MediaOptions, callback: @escaping (_ entry: PKMediaEntry?, _ error: NSError?) -> Void) {
guard let mediaOptions = options as? OTTMediaOptions else {
callback(nil, KalturaPlayerError.invalidMediaOptions.asNSError)
return
Expand Down
1 change: 1 addition & 0 deletions Sources/OTT/KalturaOTTPlayerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import KalturaNetKit
import PlayKit
import PlayKitKava
import PlayKitProviders
import KalturaPlayer

class KalturaOTTPlayerManager: KalturaPlayerManager {

Expand Down
1 change: 1 addition & 0 deletions Sources/OTT/OTTMediaOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import PlayKitProviders
import KalturaPlayer

@objc public class OTTMediaOptions: MediaOptions {

Expand Down
8 changes: 7 additions & 1 deletion Sources/OVP/KPOVPConfigModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ class KPOVPConfigModel {
private init() {}

lazy var persistanteContainer: NSPersistentContainer = {
let dmsConfigModelBundle = Bundle(for: KPOVPConfigModel.self)

var dmsConfigModelBundle = Bundle(for: KPOVPConfigModel.self)

#if KalturaPlayerOVP_Package
dmsConfigModelBundle = Bundle.module
#endif

guard let modelURL = dmsConfigModelBundle.url(forResource: "KPOVPConfigModel", withExtension: "momd"),
let managedObjectModel = NSManagedObjectModel(contentsOf: modelURL) else {
fatalError("KPOVPConfigModel is missing from the bundle!")
Expand Down
3 changes: 2 additions & 1 deletion Sources/OVP/KPOVPPlaylistController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import Foundation
import PlayKit
import KalturaPlayer

@objc public class KPOVPPlaylistController: KPPlaylistController {

internal var originalOVPMediaOptions: [OVPMediaOptions]?

override internal func prepareMediaOptions(forMediaEntry entry: PKMediaEntry) -> MediaOptions? {
override public func prepareMediaOptions(forMediaEntry entry: PKMediaEntry) -> MediaOptions? {

let options: MediaOptions

Expand Down
Loading