Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliza Sapir committed May 15, 2017
2 parents 2fbb871 + 671f929 commit 4047f2c
Show file tree
Hide file tree
Showing 110 changed files with 1,607 additions and 2,503 deletions.
31 changes: 17 additions & 14 deletions Addons/GoogleCast/BasicCastBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import GoogleCast

*/
@objc public class BasicCastBuilder: NSObject {

@objc public enum StreamType: Int {
case live
case vod
case unknown
}

enum BasicBuilderDataError: Error {
Expand All @@ -33,23 +35,26 @@ import GoogleCast
@objc public var partnerID: String?
@objc public var uiconfID: String?
@objc public var adTagURL: String?
@objc public private(set) var streamType = GCKMediaStreamType.none
@objc public var metaData: GCKMediaMetadata?

@objc public var streamType = StreamType.unknown {
didSet {
switch streamType {
case .live: self.gckMediaStreamType = .live
case .vod: self.gckMediaStreamType = .buffered
case .unknown: self.gckMediaStreamType = .unknown
}
}
}
private var gckMediaStreamType = GCKMediaStreamType.unknown

/**
Set - stream type
- Parameter contentId: receiver contentId to play ( Entry id, or Asset id )
*/
@discardableResult
@objc public func set(streamType: StreamType) -> Self{

switch streamType {
case .live:
self.streamType = .live
case .vod:
self.streamType = .buffered
}
@nonobjc public func set(streamType: StreamType) -> Self {
self.streamType = streamType
return self
}

Expand All @@ -58,7 +63,7 @@ import GoogleCast
- Parameter contentId: receiver contentId to play ( Entry id, or Asset id )
*/
@discardableResult
@nonobjc public func set(contentId: String?) -> Self{
@nonobjc public func set(contentId: String?) -> Self {

guard contentId != nil,
contentId?.isEmpty == false
Expand Down Expand Up @@ -169,11 +174,9 @@ import GoogleCast
throw BasicCastBuilder.BasicBuilderDataError.missingContentId
}

guard self.streamType != nil else {
guard self.streamType != .unknown else {
throw BasicCastBuilder.BasicBuilderDataError.missingStreamType
}


}


Expand All @@ -185,7 +188,7 @@ import GoogleCast
try self.validate()
let customData = self.customData()
let mediaInfo: GCKMediaInformation = GCKMediaInformation(contentID:self.contentId,
streamType: self.streamType,
streamType: self.gckMediaStreamType,
contentType: "",
metadata: self.metaData,
streamDuration: 0,
Expand Down
30 changes: 13 additions & 17 deletions Addons/GoogleCast/CastAdInfoParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,29 @@ public class CastAdInfoParser: NSObject, GCKRemoteMediaClientAdInfoParserDelegat
*/
public func remoteMediaClient(_ client: GCKRemoteMediaClient, shouldSetPlayingAdIn mediaStatus: GCKMediaStatus) -> Bool {

guard let customData = mediaStatus.customData as? [String:Any],
let adsInfo = customData["adsInfo"] as? [String:Any],
let metaData : AdsMetadata = AdsMetadata(dict: adsInfo) else {
PKLog.warning("No Ads info from receiver")
return false
guard let customData = mediaStatus.customData as? [String: Any], let adsInfo = customData["adsInfo"] as? [String: Any] else {
PKLog.warning("No Ads info from receiver")
return false
}
let metadata = AdsMetadata(dict: adsInfo)

return metaData.isPlayingAd

return metadata.isPlayingAd
}

/**
A list of playback positions at which the ads occur.
*/
public func remoteMediaClient(_ client: GCKRemoteMediaClient, shouldSetAdBreaksIn mediaStatus: GCKMediaStatus) -> [GCKAdBreakInfo]? {

guard let customData = mediaStatus.customData as? [String:Any],
let adsInfo = customData["adsInfo"] as? [String:Any],
let adsData : AdsMetadata = AdsMetadata(dict: adsInfo),
let adsBreakInfo = adsData.adsBreakInfo else {
PKLog.warning("No Ads info from receiver")
return nil
guard let customData = mediaStatus.customData as? [String: Any], let adsInfo = customData["adsInfo"] as? [String: Any] else {
PKLog.warning("No Ads info from receiver")
return nil
}

let metadata = AdsMetadata(dict: adsInfo)
let adsBreakInfo = metadata.adsBreakInfo ?? []
let adsBreakInfoArray = adsBreakInfo.map({ GCKAdBreakInfo(playbackPosition: TimeInterval($0)) })

return adsBreakInfoArray
}
}
Expand All @@ -71,18 +69,16 @@ private class AdsMetadata: NSObject {

if let isPlaying = dict["isPlayingAd"] as? Bool {
self.isPlayingAd = isPlaying
}else{
} else {
self.isPlayingAd = false
}

if let adBreaksInfo = dict["adsBreakInfo"] as? [NSNumber] {
self.adsBreakInfo = adBreaksInfo.map({ (number:NSNumber) -> Int in
return number.intValue
})
}else{
} else {
self.adsBreakInfo = nil
}


}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import SwiftyJSON
import KalturaNetKit


extension KalturaRequestBuilder {
Expand All @@ -25,8 +26,9 @@ extension KalturaRequestBuilder {
}

@discardableResult
internal func setFormat(format: Int){
internal func setFormat(format: Int) -> Self {
self.setBody(key: "format", value: JSON(format))
return self
}


Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class OTTMultiResponseParser: NSObject {
let objectType: OTTBaseObject.Type? = OTTObjectMapper.classByJsonObject(json: jsonObject.dictionaryObject)
if let type = objectType {
object = type.init(json: jsonObject.object)
} else {
throw OTTMultiResponseParserError.typeNotFound
}

if let obj = object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ class OTTObjectMapper: NSObject {

if let name = className {
switch name {
case "KalturaLoginResponse":
return OTTLoginResponse.self
case "KalturaSession":
return OTTSession.self
case "KalturaMediaAsset":
return OTTAsset.self
case "KalturaLoginSession":
return OTTLoginSession.self
case "KalturaPlaybackSource":
return OTTPlaybackSource.self
case "KalturaPlaybackContext":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import SwiftyJSON

class OTTResponseParser: ResponseParser {
class OTTResponseParser: NSObject {

enum OTTResponseParserError: Error {
case typeNotFound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,11 @@

import UIKit
import SwiftyJSON
import KalturaNetKit

class OTTAssetService {

internal static func get(baseURL: String, ks: String, assetId: String, type: AssetType) -> KalturaRequestBuilder? {

if let request: KalturaRequestBuilder = KalturaRequestBuilder(url: baseURL, service: "asset", action: "get") {
request
.setBody(key: "id", value: JSON(assetId))
.setBody(key: "ks", value: JSON(ks))
.setBody(key: "type", value: JSON(type.asString))
.setBody(key: "assetReferenceType", value: JSON(type.asString))
.setBody(key: "with", value: JSON([["type": "files", "objectType": "KalturaCatalogWithHolder"]]))
return request
} else {
return nil
}
}

internal static func getPlaybackContext(baseURL: String, ks: String, assetId: String, type: AssetType, playbackContextOptions: PlaybackContextOptions) -> KalturaRequestBuilder? {
internal static func getPlaybackContext(baseURL: String, ks: String, assetId: String, type: AssetObjectType, playbackContextOptions: PlaybackContextOptions) -> KalturaRequestBuilder? {

if let request: KalturaRequestBuilder = KalturaRequestBuilder(url: baseURL, service: "asset", action: "getPlaybackContext") {
request
Expand All @@ -38,13 +24,12 @@ class OTTAssetService {
} else {
return nil
}

}
}

struct PlaybackContextOptions {

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

Expand Down
27 changes: 27 additions & 0 deletions Classes/Backend/OTT/Services/OTTUserService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// OTTUserService.swift
// Pods
//
// Created by Admin on 13/11/2016.
//
//

import UIKit
import SwiftyJSON
import KalturaNetKit

class OTTUserService: NSObject {

internal static func anonymousLogin(baseURL: String, partnerId: Int64, udid: String? = nil) -> KalturaRequestBuilder? {
if let request = KalturaRequestBuilder(url: baseURL, service: "ottUser", action: "anonymousLogin") {
request.setBody(key: "partnerId", value: JSON(NSNumber.init(value: partnerId)))

if let deviceId = udid {
request.setBody(key: "udid", value: JSON(deviceId))
}
return request
}
return nil
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation


@objc public enum AssetType: Int {
enum AssetObjectType: Int {
case media
case epg
case unknown
Expand All @@ -24,7 +24,7 @@ import Foundation
}


@objc public enum PlaybackContextType: Int {
enum PlaybackType: Int {

case trailer
case catchup
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions Classes/Backend/OVP/Model/OVPLiveStreamEntry.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// KalturaLiveStreamEntry.swift
// Pods
//
// Created by Gal Orlanczyk on 07/05/2017.
//
//

import Foundation
import SwiftyJSON

class OVPLiveStreamEntry: OVPEntry {

var dvrStatus: Bool?

let dvrStatusKey = "dvrStatus"

required init?(json: Any) {
super.init(json: json)

let jsonObject = JSON(json)
self.dvrStatus = jsonObject[dvrStatusKey].bool
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ class OVPObjectMapper: NSObject {

static func classByJsonObject(json:Any?) -> OVPBaseObject.Type? {

let jsonObject = JSON(json)
guard let js = json else {
return nil
}

let jsonObject = JSON(js)
let className = jsonObject[classNameKey].string
if let name = className{
switch name {
case "KalturaMediaEntry":
return OVPEntry.self
case "KalturaLiveStreamEntry":
return OVPLiveStreamEntry.self
case "KalturaPlaybackContext":
return OVPPlaybackContext.self
case "KalturaAPIException":
return OVPError.self
case "KalturaStartWidgetSessionResponse":
return OVPStartWidgetSessionResponse.self
case "KalturaMetadata":
return OVPMetadata.self
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import SwiftyJSON
import KalturaNetKit


class OVPBaseEntryService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,10 @@

import UIKit
import SwiftyJSON
import KalturaNetKit

class OVPSessionService {

internal static func get(baseURL: String,
ks: String) -> KalturaRequestBuilder? {

if let request: KalturaRequestBuilder = KalturaRequestBuilder(url: baseURL,
service: "session",
action: "get") {
request.setBody(key: "ks", value: JSON(ks))
return request
}else{
return nil
}
}

internal static func startWidgetSession(baseURL: String,
partnerId: Int64 ) -> KalturaRequestBuilder? {

Expand All @@ -38,14 +26,4 @@ class OVPSessionService {
}

}




// .service("session")
// .action("startWidgetSession")
// .method("POST")
// .url(baseUrl)
// .tag("session-startWidget")
// .params(params);
}
2 changes: 1 addition & 1 deletion Classes/Managers/LocalAssetsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ import AVFoundation
return source
}
} else {
if let source = sources.first(where: {$0.fileExt=="m3u8" && $0.drmData==nil}) {
if let source = sources.first(where: {$0.fileExt=="m3u8" && ($0.drmData == nil || $0.drmData!.isEmpty)}) {
return source
}
}
Expand Down
Loading

0 comments on commit 4047f2c

Please sign in to comment.