From 54dcc18c542052d560a86f77138ec25f5e4b6f1a Mon Sep 17 00:00:00 2001 From: Gal Orlanczyk Date: Fri, 17 Mar 2017 17:25:15 +0200 Subject: [PATCH 1/5] #FEM-1193 (#110) * Added `TimedMetadata` event that will be posted when timed metadata is available. --- .../TimerExtension.swift} | 0 .../AVPlayerEngine/AVPlayerEngine+Observation.swift | 13 +++++++++++-- Classes/Player/PKEvent.swift | 7 +++++++ Classes/PlayerEvent.swift | 11 ++++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) rename Classes/{PKTimer.swift => Extensions/TimerExtension.swift} (100%) diff --git a/Classes/PKTimer.swift b/Classes/Extensions/TimerExtension.swift similarity index 100% rename from Classes/PKTimer.swift rename to Classes/Extensions/TimerExtension.swift diff --git a/Classes/Player/AVPlayerEngine/AVPlayerEngine+Observation.swift b/Classes/Player/AVPlayerEngine/AVPlayerEngine+Observation.swift index 3668d910..e8bf5da3 100644 --- a/Classes/Player/AVPlayerEngine/AVPlayerEngine+Observation.swift +++ b/Classes/Player/AVPlayerEngine/AVPlayerEngine+Observation.swift @@ -20,7 +20,8 @@ extension AVPlayerEngine { #keyPath(currentItem), #keyPath(currentItem.playbackLikelyToKeepUp), #keyPath(currentItem.playbackBufferEmpty), - #keyPath(currentItem.duration) + #keyPath(currentItem.duration), + #keyPath(currentItem.timedMetadata) ] } @@ -128,6 +129,8 @@ extension AVPlayerEngine { self.handleStatusChange() case #keyPath(currentItem): self.handleItemChange() + case #keyPath(currentItem.timedMetadata): + self.handleTimedMedia() default: super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) } @@ -194,6 +197,12 @@ extension AVPlayerEngine { self.postStateChange(newState: newState, oldState: self.currentState) self.currentState = newState // in case item changed reset player reached end time indicator - isPlayedToEndTime = false + self.isPlayedToEndTime = false + } + + private func handleTimedMedia() { + guard let currentItem = self.currentItem else { return } + guard let metadata = currentItem.timedMetadata else { return } + self.post(event: PlayerEvent.TimedMetadata(metadata: metadata)) } } diff --git a/Classes/Player/PKEvent.swift b/Classes/Player/PKEvent.swift index 2b528f0e..5edcc3e2 100644 --- a/Classes/Player/PKEvent.swift +++ b/Classes/Player/PKEvent.swift @@ -7,6 +7,7 @@ // import Foundation +import AVFoundation /// PKEvent @objc public class PKEvent: NSObject { @@ -28,6 +29,7 @@ extension PKEvent { static let OldState = "oldState" static let NewState = "newState" static let Error = "error" + static let Metadata = "metadata" } // MARK: Player Data Accessors @@ -69,4 +71,9 @@ extension PKEvent { @objc public var error: NSError? { return self.data?[EventDataKeys.Error] as? NSError } + + /// Associated metadata from the event, PKEvent Data Accessor + @objc public var timedMetadata: [AVMetadataItem]? { + return self.data?[EventDataKeys.Metadata] as? [AVMetadataItem] + } } diff --git a/Classes/PlayerEvent.swift b/Classes/PlayerEvent.swift index 748b1761..de818949 100644 --- a/Classes/PlayerEvent.swift +++ b/Classes/PlayerEvent.swift @@ -6,6 +6,7 @@ // // import Foundation +import AVFoundation /// An PlayerEvent is a class used to reflect player events. @objc public class PlayerEvent: PKEvent { @@ -43,6 +44,8 @@ import Foundation @objc public static let playbackParamsUpdated: PlayerEvent.Type = PlaybackParamsUpdated.self /// Sent when player state is changed. @objc public static let stateChanged: PlayerEvent.Type = StateChanged.self + /// Sent when timed metadata is available. + @objc public static let timedMetadata: PlayerEvent.Type = TimedMetadata.self /// Sent when an error occurs. @objc public static let error: PlayerEvent.Type = Error.self @@ -86,6 +89,12 @@ import Foundation } } + class TimedMetadata: PlayerEvent { + convenience init(metadata: [AVMetadataItem]) { + self.init([EventDataKeys.Metadata: metadata]) + } + } + // MARK: - Player Tracks Events class TracksAvailable: PlayerEvent { @@ -105,7 +114,7 @@ import Foundation class StateChanged: PlayerEvent { convenience init(newState: PlayerState, oldState: PlayerState) { self.init([EventDataKeys.NewState : newState as AnyObject, - EventDataKeys.OldState : oldState as AnyObject]) + EventDataKeys.OldState : oldState as AnyObject]) } } } From d64ccbda9ca8456f2c719613aa1a72c8dd275ff7 Mon Sep 17 00:00:00 2001 From: Gal Orlanczyk Date: Fri, 17 Mar 2017 17:25:58 +0200 Subject: [PATCH 2/5] #FEM-1251 (#115) * Added events reporting for KalturaStatsPlugin, KalturaLiveStatsPlugin, PhoenixPlugin and TVPAPI. The events will be sent right before a network request will be made and will include the relevant data. --- .../KalturaLiveStatsPlugin.swift | 60 +++--- Plugins/KalturaStats/KalturaStatsPlugin.swift | 191 ++++++++++-------- Plugins/KalturaStats/OVPStatsService.swift | 3 +- Plugins/Phoenix/BaseOTTAnalyticsPlugin.swift | 6 +- .../Phoenix/OTTAnalyticsPluginProtocol.swift | 4 +- Plugins/Phoenix/OttEvent.swift | 17 ++ Plugins/Youbora/YouboraEvent.swift | 6 +- Plugins/Youbora/YouboraPlugin.swift | 2 +- 8 files changed, 165 insertions(+), 124 deletions(-) diff --git a/Plugins/KalturaLiveStats/KalturaLiveStatsPlugin.swift b/Plugins/KalturaLiveStats/KalturaLiveStatsPlugin.swift index 001a3045..70294e27 100644 --- a/Plugins/KalturaLiveStats/KalturaLiveStatsPlugin.swift +++ b/Plugins/KalturaLiveStats/KalturaLiveStatsPlugin.swift @@ -6,11 +6,32 @@ // // +/// `KalturaStatsEvent` represents an event reporting from kaltura stats plugin. +@objc public class KalturaLiveStatsEvent: PKEvent { + + static let bufferTimeKey = "bufferTime" + + class Report: KalturaLiveStatsEvent { + convenience init(bufferTime: Int32) { + self.init([Report.bufferTimeKey: NSNumber(value: bufferTime)]) + } + } + + @objc public static let report: KalturaLiveStatsEvent.Type = Report.self +} + +extension PKEvent { + /// bufferTime Value, PKEvent Data Accessor + @objc public var kalturaLiveStatsBufferTime: NSNumber? { + return self.data?[KalturaLiveStatsEvent.bufferTimeKey] as? NSNumber + } +} + public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { enum KLiveStatsEventType : Int { - case LIVE = 1 - case DVR = 2 + case live = 1 + case dvr = 2 } public override class var pluginName: String { @@ -91,10 +112,10 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { if type(of: event) == PlayerEvent.stateChanged { switch event.newState { case .ready: - strongSelf.startTimer() + strongSelf.createTimer() if strongSelf.isBuffering { strongSelf.isBuffering = false - strongSelf.sendLiveEvent(theBufferTime: strongSelf.calculateBuffer(isBuffering: false)) + strongSelf.sendLiveEvent(withBufferTime: strongSelf.calculateBuffer(isBuffering: false)) } case .buffering: strongSelf.isBuffering = true @@ -114,10 +135,10 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { private func startLiveEvents() { if !self.isLive { - startTimer() + self.createTimer() isLive = true if isFirstPlay { - sendLiveEvent(theBufferTime: bufferTime); + sendLiveEvent(withBufferTime: bufferTime); isFirstPlay = false } } @@ -125,6 +146,7 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { private func stopLiveEvents(){ self.isLive = false + self.timer?.invalidate() } private func createTimer() { @@ -141,24 +163,7 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { } @objc private func timerHit() { - self.sendLiveEvent(theBufferTime: bufferTime); - } - - private func startTimer() { - if let t = self.timer { - if t.isValid { - t.fire() - } else { - self.timer = Timer.scheduledTimer(timeInterval: TimeInterval(self.interval), target: self, selector: #selector(KalturaLiveStatsPlugin.timerHit), userInfo: nil, repeats: true) - self.timer!.fire() - } - } - } - - private func pauseTimer() { - if let t = self.timer { - t.invalidate() - } + self.sendLiveEvent(withBufferTime: bufferTime); } private func calculateBuffer(isBuffering: Bool) -> Int32 { @@ -176,8 +181,11 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { return bufferTime } - private func sendLiveEvent(theBufferTime: Int32) { + private func sendLiveEvent(withBufferTime bufferTime: Int32) { PKLog.debug("sendLiveEvent - Buffer Time: \(bufferTime)") + // post event to message bus + let event = KalturaLiveStatsEvent.Report(bufferTime: bufferTime) + self.messageBus?.post(event) guard let mediaEntry = self.player?.mediaEntry else { return } @@ -201,7 +209,7 @@ public class KalturaLiveStatsPlugin: BaseAnalyticsPlugin { partnerId: parterId, eventType: self.isLive ? 1 : 0, eventIndex: self.eventIdx, - bufferTime: theBufferTime, + bufferTime: bufferTime, bitrate: self.lastReportedBitrate, sessionId: sessionId, startTime: self.lastReportedStartTime, diff --git a/Plugins/KalturaStats/KalturaStatsPlugin.swift b/Plugins/KalturaStats/KalturaStatsPlugin.swift index afef85ae..b47e1f04 100644 --- a/Plugins/KalturaStats/KalturaStatsPlugin.swift +++ b/Plugins/KalturaStats/KalturaStatsPlugin.swift @@ -6,50 +6,72 @@ // // -public class KalturaStatsPlugin: BaseAnalyticsPlugin { +/// `KalturaStatsEvent` represents an event reporting from kaltura stats plugin. +@objc public class KalturaStatsEvent: PKEvent { + + static let messageKey = "message" + + class Report: KalturaStatsEvent { + convenience init(message: String) { + self.init([KalturaStatsEvent.messageKey: message]) + } + } + + @objc public static let report: KalturaStatsEvent.Type = Report.self +} - enum KStatsEventType : Int { - case WIDGET_LOADED = 1 - case MEDIA_LOADED = 2 - case PLAY = 3 - case PLAY_REACHED_25 = 4 - case PLAY_REACHED_50 = 5 - case PLAY_REACHED_75 = 6 - case PLAY_REACHED_100 = 7 - case OPEN_EDIT = 8 - case OPEN_VIRAL = 9 - case OPEN_DOWNLOAD = 10 - case OPEN_REPORT = 11 - case BUFFER_START = 12 - case BUFFER_END = 13 - case OPEN_FULL_SCREEN = 14 - case CLOSE_FULL_SCREEN = 15 - case REPLAY = 16 - case SEEK = 17 - case OPEN_UPLOAD = 18 - case SAVE_PUBLISH = 19 - case CLOSE_EDITOR = 20 - case PRE_BUMPER_PLAYED = 21 - case POST_BUMPER_PLAYED = 22 - case BUMPER_CLICKED = 23 - case PREROLL_STARTED = 24 - case MIDROLL_STARTED = 25 - case POSTROLL_STARTED = 26 - case OVERLAY_STARTED = 27 - case PREROLL_CLICKED = 28 - case MIDROLL_CLICKED = 29 - case POSTROLL_CLICKED = 30 - case OVERLAY_CLICKED = 31 - case PREROLL_25 = 32 - case PREROLL_50 = 33 - case PREROLL_75 = 34 - case MIDROLL_25 = 35 - case MIDROLL_50 = 36 - case MIDROLL_75 = 37 - case POSTROLL_25 = 38 - case POSTROLL_50 = 39 - case POSTROLL_75 = 40 - case ERROR = 99 +extension PKEvent { + /// bufferTime Value, PKEvent Data Accessor + @objc public var kalturaStatsMessage: String? { + return self.data?[KalturaStatsEvent.messageKey] as? String + } +} + +public class KalturaStatsPlugin: BaseAnalyticsPlugin { + + // stats event types + enum KalturaStatsEventType : Int { + case widgetLoaded = 1 + case mediaLoaded = 2 + case play = 3 + case playReached25 = 4 + case playReached50 = 5 + case playReached75 = 6 + case playReached100 = 7 + case openEdit = 8 + case openViral = 9 + case openDownload = 10 + case openReport = 11 + case bufferStart = 12 + case bufferEnd = 13 + case openFullScreen = 14 + case closeFullScreen = 15 + case replay = 16 + case seek = 17 + case openUpload = 18 + case savePublish = 19 + case closeEditor = 20 + case preBumperPlayed = 21 + case postBumperPlayed = 22 + case bumperClicked = 23 + case prerollStarted = 24 + case midrollStarted = 25 + case postRollStarted = 26 + case overlayStarted = 27 + case prerollClicked = 28 + case midrollClicked = 29 + case postRollClicked = 30 + case overlayClicked = 31 + case preRoll25 = 32 + case preRoll50 = 33 + case preRoll75 = 34 + case midRoll25 = 35 + case midRoll50 = 36 + case midRoll75 = 37 + case postRoll25 = 38 + case postRoll50 = 39 + case postRoll75 = 40 + case error = 99 } public override class var pluginName: String { @@ -70,7 +92,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { private var hasSeeked = false private var timer: Timer? - private var interval = 30 + private var interval: TimeInterval = 30 /************************************************************/ // MARK: - AnalyticsPluginProtocol @@ -112,14 +134,14 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { PKLog.debug("seeked event: \(event)") strongSelf.hasSeeked = true strongSelf.seekPercent = Float(player.currentTime) / Float(player.duration) - strongSelf.sendAnalyticsEvent(action: .SEEK) + strongSelf.sendAnalyticsEvent(action: .seek) }) case let e where e.self == PlayerEvent.playing: self.messageBus?.addObserver(self, events: [e.self], block: { [weak self] (event) in guard let strongSelf = self else { return } PKLog.debug("play event: \(event)") if strongSelf.isFirstPlay { - strongSelf.sendAnalyticsEvent(action: .PLAY) + strongSelf.sendEvent(ofType: .play, withMessage: "Play event") strongSelf.isFirstPlay = false } }) @@ -127,7 +149,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { self.messageBus?.addObserver(self, events: [e.self], block: { [weak self] (event) in guard let strongSelf = self else { return } PKLog.debug("error event: \(event)") - strongSelf.sendAnalyticsEvent(action: .ERROR) + strongSelf.sendEvent(ofType: .error, withMessage: "Error event") }) case let e where e.self == PlayerEvent.stateChanged: self.messageBus?.addObserver(self, events: [e.self]) { [weak self] event in @@ -141,12 +163,12 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { strongSelf.sendWidgetLoaded() if strongSelf.isBuffering { strongSelf.isBuffering = false - strongSelf.sendAnalyticsEvent(action: .BUFFER_END) + strongSelf.sendEvent(ofType: .bufferEnd, withMessage: "Buffer end event") } case .ready: if strongSelf.isBuffering { strongSelf.isBuffering = false - strongSelf.sendAnalyticsEvent(action: .BUFFER_END) + strongSelf.sendEvent(ofType: .bufferEnd, withMessage: "Buffer end event") } if !strongSelf.intervalOn { strongSelf.intervalOn = true @@ -156,7 +178,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { case .buffering: strongSelf.sendWidgetLoaded() strongSelf.isBuffering = true - strongSelf.sendAnalyticsEvent(action: .BUFFER_START) + strongSelf.sendEvent(ofType: .bufferStart, withMessage: "Buffer start event") case .error: break case .unknown: break } @@ -184,18 +206,25 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { private func sendWidgetLoaded() { if !self.isWidgetLoaded { - sendAnalyticsEvent(action: .WIDGET_LOADED) + sendAnalyticsEvent(action: .widgetLoaded) self.isWidgetLoaded = true } } private func sendMediaLoaded(){ if !self.isMediaLoaded { - sendAnalyticsEvent(action: .MEDIA_LOADED) + sendAnalyticsEvent(action: .mediaLoaded) self.isMediaLoaded = true } } + private func sendEvent(ofType type: KalturaStatsEventType, withMessage message: String) { + // send event to messageBus + let event = KalturaStatsEvent.Report(message: message) + self.messageBus?.post(event) + // send event to analytics entity + self.sendAnalyticsEvent(action: type) + } private func resetPlayerFlags() { isFirstPlay = true @@ -211,7 +240,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { private func createTimer() { - if let intr = self.config?.params["timerInterval"] as? Int { + if let intr = self.config?.params["timerInterval"] as? TimeInterval { self.interval = intr } @@ -219,37 +248,23 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { t.invalidate() } - self.timer = Timer.scheduledTimer(timeInterval: TimeInterval(self.interval), target: self, selector: #selector(KalturaStatsPlugin.timerHit), userInfo: nil, repeats: true) - - } - - @objc private func timerHit() { - guard let player = self.player else { return } - let progress = Float(player.currentTime) / Float(player.duration) - PKLog.debug("Progress is \(progress)") - - if progress >= 0.25 && !playReached25 && seekPercent <= 0.25 { - playReached25 = true - sendAnalyticsEvent(action: .PLAY_REACHED_25); - } else if progress >= 0.5 && !playReached50 && seekPercent < 0.5 { - playReached50 = true - sendAnalyticsEvent(action: .PLAY_REACHED_50); - } else if progress >= 0.75 && !playReached75 && seekPercent <= 0.75 { - playReached75 = true - sendAnalyticsEvent(action: .PLAY_REACHED_75); - } else if progress >= 0.98 && !playReached100 && seekPercent < 1 { - playReached100 = true - sendAnalyticsEvent(action: .PLAY_REACHED_100) - } - } - - private func startTimer() { - if let t = self.timer { - if t.isValid { - t.fire() - } else { - self.timer = Timer.scheduledTimer(timeInterval: TimeInterval(self.interval), target: self, selector: #selector(KalturaStatsPlugin.timerHit), userInfo: nil, repeats: true) - self.timer!.fire() + self.timer = Timer.every(self.interval) { + guard let player = self.player else { return } + let progress = Float(player.currentTime) / Float(player.duration) + PKLog.debug("Progress is \(progress)") + + if progress >= 0.25 && !self.playReached25 && self.seekPercent <= 0.25 { + self.playReached25 = true + self.sendAnalyticsEvent(action: .playReached25) + } else if progress >= 0.5 && !self.playReached50 && self.seekPercent < 0.5 { + self.playReached50 = true + self.sendAnalyticsEvent(action: .playReached50) + } else if progress >= 0.75 && !self.playReached75 && self.seekPercent <= 0.75 { + self.playReached75 = true + self.sendAnalyticsEvent(action: .playReached75) + } else if progress >= 0.98 && !self.playReached100 && self.seekPercent < 1 { + self.playReached100 = true + self.sendAnalyticsEvent(action: .playReached100) } } } @@ -260,7 +275,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { } } - private func sendAnalyticsEvent(action: KStatsEventType) { + private func sendAnalyticsEvent(action: KalturaStatsEventType) { guard let player = self.player else { return } PKLog.debug("Action: \(action)") @@ -290,7 +305,7 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { return } - let builder: KalturaRequestBuilder = OVPStatsService.get(baseURL: baseUrl, + guard let builder: KalturaRequestBuilder = OVPStatsService.get(baseURL: baseUrl, partnerId: parterId, eventType: action.rawValue, clientVer: PlayKitManager.clientTag, @@ -300,12 +315,10 @@ public class KalturaStatsPlugin: BaseAnalyticsPlugin { uiConfId: confId, entryId: mediaEntry.id, widgetId: "_\(parterId)", - isSeek: hasSeeked)! + isSeek: hasSeeked) else { return } builder.set { (response: Response) in - PKLog.debug("Response: \(response)") - } USRExecutor.shared.send(request: builder.build()) diff --git a/Plugins/KalturaStats/OVPStatsService.swift b/Plugins/KalturaStats/OVPStatsService.swift index 6544fe81..43b3525d 100644 --- a/Plugins/KalturaStats/OVPStatsService.swift +++ b/Plugins/KalturaStats/OVPStatsService.swift @@ -36,10 +36,9 @@ internal class OVPStatsService { .setParam(key: "event:entryId", value: entryId) .setParam(key: "event:widgetId", value: widgetId) .setParam(key: "event:referrer", value: referrer) - .set(method: .get) return request - }else{ + } else { return nil } } diff --git a/Plugins/Phoenix/BaseOTTAnalyticsPlugin.swift b/Plugins/Phoenix/BaseOTTAnalyticsPlugin.swift index b83bf1ff..e79e7c29 100644 --- a/Plugins/Phoenix/BaseOTTAnalyticsPlugin.swift +++ b/Plugins/Phoenix/BaseOTTAnalyticsPlugin.swift @@ -114,7 +114,7 @@ public class BaseOTTAnalyticsPlugin: BaseAnalyticsPlugin, OTTAnalyticsPluginProt if strongSelf.isFirstPlay { strongSelf.isFirstPlay = false - strongSelf.sendAnalyticsEvent(ofType: .first_play); + strongSelf.sendAnalyticsEvent(ofType: .firstPlay); } else { strongSelf.sendAnalyticsEvent(ofType: .play); } @@ -130,6 +130,10 @@ public class BaseOTTAnalyticsPlugin: BaseAnalyticsPlugin, OTTAnalyticsPluginProt func sendAnalyticsEvent(ofType type: OTTAnalyticsEventType) { PKLog.debug("Send analytics event of type: \(type)") + // post to messageBus + let event = OttEvent.Report(message: "\(type) event") + self.messageBus?.post(event) + if let request = self.buildRequest(ofType: type) { self.send(request: request) } diff --git a/Plugins/Phoenix/OTTAnalyticsPluginProtocol.swift b/Plugins/Phoenix/OTTAnalyticsPluginProtocol.swift index 4fe34795..b81c642a 100644 --- a/Plugins/Phoenix/OTTAnalyticsPluginProtocol.swift +++ b/Plugins/Phoenix/OTTAnalyticsPluginProtocol.swift @@ -13,11 +13,11 @@ enum OTTAnalyticsEventType: String { case play case stop case pause - case first_play + case firstPlay case swoosh case load case finish - case bitrate_change + case bitrateChange case error } diff --git a/Plugins/Phoenix/OttEvent.swift b/Plugins/Phoenix/OttEvent.swift index f041ec17..5ca855f6 100644 --- a/Plugins/Phoenix/OttEvent.swift +++ b/Plugins/Phoenix/OttEvent.swift @@ -15,4 +15,21 @@ public class OttEvent : PKEvent { /// represents the Concurrency event Type. /// Concurrency events fire when more then the allowed connections are exceeded. public static let concurrency: OttEvent.Type = Concurrency.self + + static let messageKey = "message" + + class Report: OttEvent { + convenience init(message: String) { + self.init([OttEvent.messageKey: message]) + } + } + + @objc public static let report: OttEvent.Type = OttEvent.Report.self +} + +extension PKEvent { + /// bufferTime Value, PKEvent Data Accessor + @objc public var ottEventMessage: String? { + return self.data?[OttEvent.messageKey] as? String + } } diff --git a/Plugins/Youbora/YouboraEvent.swift b/Plugins/Youbora/YouboraEvent.swift index 8973badc..b18347b1 100644 --- a/Plugins/Youbora/YouboraEvent.swift +++ b/Plugins/Youbora/YouboraEvent.swift @@ -10,9 +10,9 @@ import UIKit @objc public class YouboraEvent: PKEvent { - class YouboraReportSent : YouboraEvent { - convenience init(message: NSString) { - self.init(["message" : message]) + class YouboraReportSent: YouboraEvent { + convenience init(message: String) { + self.init(["message": message]) } } diff --git a/Plugins/Youbora/YouboraPlugin.swift b/Plugins/Youbora/YouboraPlugin.swift index 2c6c2d62..20393a70 100644 --- a/Plugins/Youbora/YouboraPlugin.swift +++ b/Plugins/Youbora/YouboraPlugin.swift @@ -268,7 +268,7 @@ public class YouboraPlugin: BaseAnalyticsPlugin { private func postEventLogWithMessage(message: String) { PKLog.debug(message) - let eventLog = YouboraEvent.YouboraReportSent(message: message as NSString) + let eventLog = YouboraEvent.YouboraReportSent(message: message) self.messageBus?.post(eventLog) } } From df553721335032baf047e23abb7c17e44db61214 Mon Sep 17 00:00:00 2001 From: Gal Orlanczyk Date: Sun, 19 Mar 2017 15:07:52 +0200 Subject: [PATCH 3/5] Renamed youbora event for shorter name Report like new report events added to kaltura stats and Ott analytics (#116) --- Plugins/Youbora/YouboraEvent.swift | 7 +++++-- Plugins/Youbora/YouboraPlugin.swift | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Youbora/YouboraEvent.swift b/Plugins/Youbora/YouboraEvent.swift index b18347b1..2f886979 100644 --- a/Plugins/Youbora/YouboraEvent.swift +++ b/Plugins/Youbora/YouboraEvent.swift @@ -10,11 +10,14 @@ import UIKit @objc public class YouboraEvent: PKEvent { - class YouboraReportSent: YouboraEvent { + class Report: YouboraEvent { convenience init(message: String) { self.init(["message": message]) } } + /// this event notifies when a youbora event is being sent + @objc public static let report: YouboraEvent.Type = Report.self - @objc public static let youboraReportSent: YouboraEvent.Type = YouboraReportSent.self + @available(*, unavailable, renamed: "report") + @objc public static let youboraReportSent: YouboraEvent.Type = Report.self } diff --git a/Plugins/Youbora/YouboraPlugin.swift b/Plugins/Youbora/YouboraPlugin.swift index 20393a70..2d7cdec2 100644 --- a/Plugins/Youbora/YouboraPlugin.swift +++ b/Plugins/Youbora/YouboraPlugin.swift @@ -268,7 +268,7 @@ public class YouboraPlugin: BaseAnalyticsPlugin { private func postEventLogWithMessage(message: String) { PKLog.debug(message) - let eventLog = YouboraEvent.YouboraReportSent(message: message) + let eventLog = YouboraEvent.Report(message: message) self.messageBus?.post(eventLog) } } From 45dc11d53d2ae5dd7a3db5851f388f51ad7f937f Mon Sep 17 00:00:00 2001 From: ElizaSapir Date: Tue, 21 Mar 2017 12:47:18 +0200 Subject: [PATCH 4/5] add public on PKAdCuePoints properties (#117) --- Classes/Plugins/Ads/PKAdCuePoints.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Plugins/Ads/PKAdCuePoints.swift b/Classes/Plugins/Ads/PKAdCuePoints.swift index 1daacc49..57214d31 100644 --- a/Classes/Plugins/Ads/PKAdCuePoints.swift +++ b/Classes/Plugins/Ads/PKAdCuePoints.swift @@ -16,19 +16,19 @@ import Foundation self.cuePoints = cuePoints.sorted() // makes sure array is sorted } - @objc var count: Int { + @objc public var count: Int { return self.cuePoints.count } - @objc var hasPreRoll: Bool { + @objc public var hasPreRoll: Bool { return self.cuePoints.filter { $0 == 0 }.count > 0 // pre-roll ads values = 0 } - @objc var hasMidRoll: Bool { + @objc public var hasMidRoll: Bool { return self.cuePoints.filter { $0 > 0 }.count > 0 } - @objc var hasPostRoll: Bool { + @objc public var hasPostRoll: Bool { return self.cuePoints.filter { $0 < 0 }.count > 0 // post-roll ads values = -1 } } From 211308002c4015407e3e2c42bd4b33ff36275a11 Mon Sep 17 00:00:00 2001 From: Eliza Sapir Date: Tue, 21 Mar 2017 12:50:32 +0200 Subject: [PATCH 5/5] bump v0.1.26 --- Example/PlayKit.xcworkspace/contents.xcworkspacedata | 10 ---------- Example/PlayKit/Info.plist | 2 +- PlayKit.podspec | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 Example/PlayKit.xcworkspace/contents.xcworkspacedata diff --git a/Example/PlayKit.xcworkspace/contents.xcworkspacedata b/Example/PlayKit.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 2136fb51..00000000 --- a/Example/PlayKit.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/Example/PlayKit/Info.plist b/Example/PlayKit/Info.plist index f7769bc4..fa1d1ef2 100644 --- a/Example/PlayKit/Info.plist +++ b/Example/PlayKit/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.25 + 0.1.26 CFBundleSignature ???? CFBundleVersion diff --git a/PlayKit.podspec b/PlayKit.podspec index ec980811..984e1cb2 100644 --- a/PlayKit.podspec +++ b/PlayKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'PlayKit' -s.version = '0.1.25' +s.version = '0.1.26' s.summary = 'PlayKit: Kaltura Mobile Player SDK - iOS'