Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliza Sapir committed Jul 31, 2017
2 parents d4be754 + f7424a9 commit 0e95b80
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 39 deletions.
8 changes: 0 additions & 8 deletions Classes/Backend/Base/Model/KalturaBaseObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
// https://www.gnu.org/licenses/agpl-3.0.html
// ===================================================================================================

//
// KalturaBaseObject.swift
// Pods
//
// Created by Rivka Peleg on 05/07/2017.
//
//

import Foundation

protocol KalturaBaseObject {
Expand Down
12 changes: 8 additions & 4 deletions Classes/Backend/OTT/Services/OTTAssetService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class OTTAssetService {

struct PlaybackContextOptions {

internal var playbackContextType: PlaybackType
internal var protocls: [String]
internal var assetFileIds: [String]?

var playbackContextType: PlaybackType
var protocls: [String]
var assetFileIds: [String]?
var referrer: String?

func toDictionary() -> [String: Any] {

var dict: [String: Any] = [:]
Expand All @@ -43,6 +44,9 @@ struct PlaybackContextOptions {
if let fileIds = self.assetFileIds {
dict["assetFileIds"] = fileIds.joined(separator: ",")
}
if let referrer = self.referrer {
dict["referrer"] = referrer
}
return dict
}
}
8 changes: 0 additions & 8 deletions Classes/Backend/OVP/Model/OVPEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
// https://www.gnu.org/licenses/agpl-3.0.html
// ===================================================================================================

//
// OVPEntry.swift
// Pods
//
// Created by Rivka Peleg on 28/11/2016.
//
//

import UIKit
import SwiftyJSON

Expand Down
9 changes: 6 additions & 3 deletions Classes/Backend/OVP/Services/OVPBaseEntryService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OVPBaseEntryService {
internal static func getContextData(baseURL: String, ks: String,entryID: String) -> KalturaRequestBuilder? {

if let request: KalturaRequestBuilder = KalturaRequestBuilder(url: baseURL, service: "baseEntry", action: "getContextData") {
let contextData:[String: Any] = [String: Any]()
let contextData: [String: Any] = [String: Any]()
request.setBody(key: "ks", value: JSON(ks))
.setBody(key: "entryId", value: JSON(entryID))
.setBody(key: "contextDataParams", value: JSON(contextData))
Expand All @@ -56,9 +56,12 @@ class OVPBaseEntryService {

}

internal static func getPlaybackContext(baseURL: String, ks: String, entryID: String) -> KalturaRequestBuilder? {
internal static func getPlaybackContext(baseURL: String, ks: String, entryID: String, referrer: String?) -> KalturaRequestBuilder? {
if let request: KalturaRequestBuilder = KalturaRequestBuilder(url: baseURL, service: "baseEntry", action: "getPlaybackContext") {
let contextData:[String: Any] = ["objectType":"KalturaContextDataParams"]
var contextData: [String: Any] = ["objectType": "KalturaContextDataParams"]
if let r = referrer {
contextData["referrer"] = r
}
request.setBody(key: "ks", value: JSON(ks))
.setBody(key: "entryId", value: JSON(entryID))
.setBody(key: "contextDataParams", value: JSON(contextData))
Expand Down
12 changes: 5 additions & 7 deletions Classes/Player/PlayerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ class PlayerController: NSObject, Player, PlayerSettings {
self.currentPlayer.currentPosition = CMTimeGetSeconds(time)
}



func destroy() {
self.currentPlayer.destroy()
self.removeAssetRefreshObservers()
Expand Down Expand Up @@ -275,7 +273,9 @@ extension PlayerController {
PKLog.warning("network unreachable")
}
reachability.onReachable = { [unowned self] reachability in
self.handleRefreshAsset()
if self.shouldRefresh {
self.handleRefreshAsset()
}
}
}

Expand All @@ -302,9 +302,7 @@ extension PlayerController {
}

private func handleRefreshAsset() {
if self.shouldRefresh {
self.shouldRefresh = false
self.refreshAsset()
}
self.shouldRefresh = false
self.refreshAsset()
}
}
12 changes: 11 additions & 1 deletion Classes/Providers/OTT/PhoenixMediaProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public enum PhoenixMediaProviderError: PKError {
@objc public var fileIds: [String]?
@objc public var playbackContextType: PlaybackContextType = .unknown
@objc public var networkProtocol: String?
@objc public var referrer: String?
public weak var responseDelegate: MediaEntryProviderResponseDelegate? = nil

public var executor: RequestExecutor?
Expand Down Expand Up @@ -205,6 +206,15 @@ public enum PhoenixMediaProviderError: PKError {
return self
}


/// - Parameter referrer: the referrer
/// - Returns: Self
@discardableResult
@nonobjc public func set(referrer: String?) -> Self {
self.referrer = referrer
return self
}

/// - Parameter executor: executor which will be used to send request.
/// default is USRExecutor
/// - Returns: Self
Expand Down Expand Up @@ -283,7 +293,7 @@ public enum PhoenixMediaProviderError: PKError {
/// - Returns: request builder
func loaderRequestBuilder(ks: String?, loaderInfo: LoaderInfo) -> KalturaRequestBuilder? {

let playbackContextOptions = PlaybackContextOptions(playbackContextType: loaderInfo.playbackContextType, protocls: [loaderInfo.networkProtocol], assetFileIds: loaderInfo.fileIds)
let playbackContextOptions = PlaybackContextOptions(playbackContextType: loaderInfo.playbackContextType, protocls: [loaderInfo.networkProtocol], assetFileIds: loaderInfo.fileIds, referrer: self.referrer)

if let token = ks {

Expand Down
29 changes: 21 additions & 8 deletions Classes/Providers/OVP/OVPMediaProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ import KalturaNetKit
@objc public var sessionProvider: SessionProvider?
@objc public var entryId: String?
@objc public var uiconfId: NSNumber?
public var executor: RequestExecutor? // TODO: make @objc if needed in the future
@objc public var referrer: String?
public var executor: RequestExecutor?

public override init() {}

Expand All @@ -101,20 +102,31 @@ import KalturaNetKit
}

/**
executor - which resposible for the network, it can be set to
uiconfId - UI Configuration id
*/
@discardableResult
@nonobjc public func set(executor: RequestExecutor?) -> Self {
self.executor = executor
@nonobjc public func set(uiconfId: NSNumber?) -> Self {
self.uiconfId = uiconfId
return self
}


/// set the provider referrer
///
/// - Parameter referrer: the app referrer
/// - Returns: Self
@discardableResult
@nonobjc public func set(referrer: String?) -> Self {
self.referrer = referrer
return self
}

/**
uiconfId - UI Configuration id
executor - which resposible for the network, it can be set to
*/
@discardableResult
@nonobjc public func set(uiconfId: NSNumber?) -> Self{
self.uiconfId = uiconfId
@nonobjc public func set(executor: RequestExecutor?) -> Self {
self.executor = executor
return self
}

Expand Down Expand Up @@ -176,7 +188,8 @@ import KalturaNetKit
// Request for Entry playback data in order to build sources to play
let getPlaybackContext = OVPBaseEntryService.getPlaybackContext(baseURL: loadInfo.apiServerURL,
ks: token,
entryID: loadInfo.entryId)
entryID: loadInfo.entryId,
referrer: self.referrer)

let metadataRequest = OVPBaseEntryService.metadata(baseURL: loadInfo.apiServerURL, ks: token, entryID: loadInfo.entryId)

Expand Down

0 comments on commit 0e95b80

Please sign in to comment.