The CONNECT Player SDK provides classes and interfaces enabling you to access statistics concerning the player and rendering of playback.
CODE
public class OTVPlaybackAnalytics: NSObject {
public var player: Player
public var rendering: Rendering
}
Playback analytics related to adaptive streaming.
CPP
public protocol Player {
/// Returns the total amount of buffered content, in seconds.
/// - Returns: the total amount of buffered content, in seconds
func bufferedDuration() -> Double
/// Returns an array of resoloutions available in the playlist
/// - Returns: an array of resoloutions available in the playlist, or nil if unknown
/// - Note: This function will make a seperate request for the Master playlist to return all the availableresoloutions. This request is only done once you call this function and only on the first time you call it for that contnet. Every subsiquent call on the same content does not requst the playlist again.
func availableResoloutions() -> [CGSize]?
/// Returns the resoloution of the content being played
/// - Returns: the Resoloution of the content being played as a CGSzie e.g CGSize(width: 1920, height: 1080) or CGSizeZero if Uknown or Audio only.
func selectedResoloution() -> CGSize
/// Returns the accumulated duration, in seconds, until the player item is ready to play.
/// - Returns: the accumulated duration, in seconds, until the player item is ready to play or -1 if uknown
func startUpTime() -> Double
/// Returns the total number of playback stalls encountered.
/// - Returns: total number of playback stalls encountered.
func numberOfStalls() -> Int
/// Returns the playback type can be live, VOD, or from a file. If nil is returned the playback type is unknown.
/// - Returns: the playback type can be live, VOD, or from a file. If nil is returned the playback type is unknown.
func playbackType() -> String?
/// Returns the date and time at which playback began for this event.
/// - Returns: the date and time at which playback began for this event.
func playbackStartDate() -> Date?
/// Returns the offset, in seconds, in the playlist where the last uninterrupted period of playback began.
/// - Returns: the offset, in seconds, in the playlist where the last uninterrupted period of playback began.
func playbackStartOffset() -> TimeInterval
}
Playback analytics related to network usage.
CPP
public protocol Rendering {
/// Returns the total number of dropped video frames
/// - Returns: the total number of dropped video frames
func frameDrops() -> Int
/// Returns the total number of dropped dived by the length of watched content
/// - Returns: the total number of dropped dived by the length of watched content
func frameDropsPerSecond() -> Int
/// Returns the frame rate of the current content as measured during playback.
/// - Returns: the frame rate of the current content as measured during playback.
func framesPerSecond() -> Int
/// Returns the frame rate of the current content as announced in the stream.
/// - Returns: the frame rate of the current content as announced in the stream.
/// - Note: This function will make a seperate request for the Master playlist to return all the stream information. This request is only done once you call this function and only on the first time you call it for that contnet. Every subsiquent call on the same content does not requst the playlist again.
func framesPerSecondNominal() -> Int
}
Notification and all event type.
CPP
public static let OTVPlaybackAnalyticsNotification = Notification.Name("OTVPlaybackAnalyticsNotification")
public enum Event: Int {
case availableResoloutionChanged = 0
case selectedResolutionChanged = 1
}
Observe the OTVPlaybackAnalyticsNotification and get the event