tvOS (Apple TV) - Suitest video grabbing protocol

Suitest instrumentation library for tvOS can grab video properties in case your application is using Apple's AVKit for playing video content. However, if you have implemented your own player or used an external that is not based on the AVKit, Suitest will not be able to recognize the video.

If this is your case, we suggest to adopt the Suitest Video protocol. Conforming this protocol you will give hooks for Suitest to find your player and get its properties. If this is something that is needed, you will have to ask the developer of the app to conform to the protocol.

Protocol

/// Suitest type with custom video properties.
///
/// Make sure that only UIView instances adopts it, otherwise Suitest will not grab it.
/// UIView instances that conform to the `SuitestVideoGrabbing` protocol can provide
/// information about video player e.g. state, video url, duration, position and etc.
/// That information can be used in tests.
@objc public protocol SuitestVideoGrabbing : SuitestPlayerGrabbing, SuitestPlayerItemGrabbing {

}

/// Suitest type with custom video player state.
///
/// UIView instances that conform to the `SuitestPlayerGrabbing` protocol can provide
/// videoState representation to be used for determining video playback state.
/// That information can be used in tests.
@objc public protocol SuitestPlayerGrabbing {

    /// Current video state as SuitestVideoState enum case
    var videoState                  : SuitestVideoState { get }
}

/// Suitest type with video item custom properties.
///
/// UIView instances that conform to the `SuitestPlayerItemGrabbing` protocol can provide
/// additional information about video item. That information can be used in tests.
@objc public protocol SuitestPlayerItemGrabbing {
    /// Video duration in milliseconds
    var videoDuration               : Int64 { get }

    /// Video playback posistion in milliseconds
    var videoPosition               : Int64 { get }

    /// Video asset's URL absolute String
    var videoURL                    : String? { get } /// do not forget to call convertSpecialCharacters()

    #if os(tvOS)
    /// The item's URL absolute String proposed to follow the current content.
    var nextContentProposalURL      : String? { get } /// do not forget to call convertSpecialCharacters()

    /// In case video asset has supplements metadata
    var hasExternalMetadata         : Bool { get }

    /// In case video asset has array of navigation marker groups
    var hasNavigationMarkerGroups   : Bool { get }
    #endif
}