OTVQuickmark
public class OTVQuickmark : NSObject
Integration Nexguard watermark support on iOS Platform.
-
MARK: Static API Return the version of SDK
This static method return the version of the SDK
Declaration
Swift
@objc public static func getVersion() -> String
Return Value
A string with the version of the SDK.
-
Returns a QuickMark view initialized with the specified token, url and an apikey for push or pull mode with interally handheld closures for computeSignatureCb, saveBlobCb, errorCb and messageCb. If token, apiKey and url are nil then its assumed that you are in push mode.
Throws
QMError.badQuickMarkInit
if bad parameter for pull mode or push mode.QMError tokenStringIsEmpty
if thetoken
parameter contains an empty stringQMError.urlStringIsEmpty
if theurl
parameter contains an empty string when the instance is configured in pull modeQMError.urlStringIsNotAnUrl
if the string is a malformed URL: no host, bad character (the url string don’t follow RFC 3986) when the instance is configured in pull modeQMError.urlSchemeIsNotHttps
if the scheme of the url is not https when the instance is configured in pull mode
Declaration
Swift
@objc public init(token: String? = nil, apiKey: String? = nil, url: String? = nil) throws
-
Returns a QuickMark view initialized with the specified token, url and an apikey for pull mode and externally handheld closures for computeSignatureCb, saveBlobCb, errorCb and messageCb.
Throws
QMError.badQuickMarkInit
if bad parameter for pull mode or push mode.QMError tokenStringIsEmpty
if thetoken
parameter contains an empty stringQMError.urlStringIsEmpty
if theurl
parameter contains an empty string when the instance is configured in pull modeQMError.urlStringIsNotAnUrl
if the string is a malformed URL: no host, bad character (the url string don’t follow RFC 3986) when the instance is configured in pull modeQMError.urlSchemeIsNotHttps
if the scheme of the url is not https when the instance is configured in pull mode
Declaration
Swift
@objc public init(token: String, apiKey: String, url: String, computeSignatureCb: @escaping (_ inputBuffer: Data) -> Data, saveBlobCb: ((_ blobBuffer: Data) -> Void)? = nil, errorCb: @escaping (_ errorId: QMErrorCode, _ errorMessage: String) -> Void, messageCb: ((_ debugMessage: String) -> Void)? = nil) throws
Parameters
token
An optional token string that contains the Wartermark identifier. The format of the string depend of the QuickMark server deployment (clear, JWT/ …)
apiKey
An optional API key string that depends of the QuickMark server deployment
url
An optionnal Url of the QuickMark server endpoint. This parameter depends of the QuickMark server deployment
computeSignatureCb
A closure that compute the signature of a Data buffer and return a signature Data buffer. The implementation of the closure depends of the server deployment and the signature Algorithm used by the server
inputBuffer
Buffer that contains imput data to sign
saveBlobCb
A optional closure that allows to save the last recieved blob
blobBuffer
Buffer that contains input data to save
errorCb
A closure that handle asynchronous error from the QuickMarkView.
errorId
The QuickMark error code
errorMessage
A string that contains error message
messageCb
An optional closure that handle the debug information. This closure should be set only for debug purpose.
debugMessage
A string that contains debug information
-
Returns a QuickMark view initialized for push mode and externally handheld closures for computeSignatureCb, saveBlobCb, errorCb and messageCb
Throws
QMError.badQuickMarkInit
if bad parameter for pull mode or push mode.QMError tokenStringIsEmpty
if thetoken
parameter contains an empty stringQMError.urlStringIsEmpty
if theurl
parameter contains an empty string when the instance is configured in pull modeQMError.urlStringIsNotAnUrl
if the string is a malformed URL: no host, bad character (the url string don’t follow RFC 3986) when the instance is configured in pull modeQMError.urlSchemeIsNotHttps
if the scheme of the url is not https when the instance is configured in pull mode
Declaration
Swift
@objc public init(computeSignatureCb: @escaping (_ inputBuffer: Data) -> Data, saveBlobCb: ((_ blobBuffer: Data) -> Void)? = nil, errorCb: @escaping (_ errorId: QMErrorCode, _ errorMessage: String) -> Void, messageCb: ((_ debugMessage: String) -> Void)? = nil) throws
-
Throws
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initializedQMError setTokenForbidden
if this method is called with a push mode instanceQMError tokenStringIsEmpty
if thenewvalue
string is emptyQMError startFailed
if the network request failed after token changed
Declaration
Swift
@objc public func setToken(newValue: String) throws
Parameters
newValue
An token string that contains the Wartermark identifier
-
Declaration
Swift
@objc public func setSignKey(signKey: String)
-
Disable the bandwidth reduction for the communication with the QuickMark server in pull mode only
This method allows to remove the
surfaceID
query parameter when the QuickMark Network service make a surface requestThrows
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initialized
Declaration
Swift
@objc public func disableBandwithReduction() throws
-
Start the communication with the QuickMark server in pull mode only
Throws
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initializedQMError badQuickMarkInit
if theQuickMarkHelper
is not well initializedQMError.startForbidden
when the start method is called when the QuickMark view is initialized in push modeQMError.startFailed
when an errors occurs in the QuickMark network service
Declaration
Swift
@objc public func start() throws
-
Pause the Quickmark surface Image updating and the network service when the QuickMark view is initialized in pull mode
This method stops timers of the timelime manager (QuickMarkCore). The image is hidden during the pause. The PNG surface is not updated until the timeline is resumed In pull mode the network service is paused also.
Throws
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initializedQMError badQuickMarkInit
if theQuickMarkHelper
is not well initialized
Declaration
Swift
@objc public func pauseTimeline() throws
-
Resume the Quickmark surface Image updating and the network service when the QuickMark view is initialized in pull mode
This method resumes the refresh timer of the image view and the network service is also resumed sif the instance is configured in pull mode
Throws
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initializedQMError badQuickMarkInit
if theQuickMarkHelper
is not well initialized
Declaration
Swift
@objc public func resumeTimeline() throws
-
Update blob data for push mode or Download to go
This method allows to update the blob in push mode or in Download To Go. The blob validation is disabled if the
enableDTGMode
flag is enableThrows
QMError badQuickMarkViewInit
if theQuickMarkView
is not well initializedQMError badQuickMarkInit
if theQuickMarkHelper
is not well initializedQMError updateBlobForbidden
if this method is called with an instance configured in push modeQMError.blobTooLarge
if blob size is larger than 2 MBQMError.blobIsEmpty
if blob size is equal to 0QMError.blobIsNotValidYet
if the current time is before the blob validity period. Don’t occure if antireplayDisable flag is trueQMError.blobHasExpired
if the current time is after the blob validity period. Don’t occure if antireplayDisable flag is trueQMError.blobHasEmptyTimeline
if the blob don’t contain timeline messageQMError.blobHasEmptyTimelineEntry
if the blob don’t contain any timeline entry. This error occurs only with a full blobQMError.undefinedPreviousSurfaceId
if the previous surface Id is nilQMError.inconsistentSurfaceId
if the previous surface Id isn’t consistent with the blob surfaceIdQMError.blobProtobuffParsingError
if blobData deserialization failedQMError.blobIsEmpty
if blob size is equal to 0
Declaration
Swift
@objc public func updateBlob(blobData: Data, enableDTGMode: Bool = false) throws
Parameters
blobData
blob buffer from QuickMark Server or FileSystem
enableDTGMode
true enable parsing of blob for Downlod to go
-
Return the surfaceId of the latest parsed blob (nil if none)
Declaration
Swift
@objc public func getSurfaceId() -> String?
Return Value
return a string that identify a blob. Could be
nil
if error or no surface Id -
Declaration
Swift
public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?)
-
Bind OTVQuickmarkView to the playerView and AVPlayerLayer provided.
This method allows the OTVQuickmarkView to bind to the playerView provided It also enables OTVQuickmarkView to mointor the state of playback of the player being used. It also allows the OTVQuickmarkView to follow the videoRect of the content being played and adjust to screen rotation.
Declaration
Swift
@objc public func bind(playerView: UIView, playerLayer: AVPlayerLayer)
Parameters
playerView
The UIView in which the OTVQuickmarkView needs to be binded to
playerLayer
The AVPlayerLayer of the content that is being played with.
-
unbind OTVQuickmarkView from the UIView passed in from the bind function.
This method allows the OTVQuickmarkView to unbindded from the UIView (playerView) provided
Declaration
Swift
@objc public func unbind()