public class IMA: BaseComponent, IMAContentPlayhead, IMAAdsLoaderDelegate, IMAAdsManagerDelegate,
ViewBasedComponentProtocol
extension IMA: AdsComponentProtocol
extension IMA: AdsAPI
public class IMA: BaseComponent, IMAContentPlayhead, IMAAdsLoaderDelegate, IMAAdsManagerDelegate,
ViewBasedComponentProtocol
extension IMA: AdsComponentProtocol
extension IMA: AdsAPI
Default initializer with Ads API
Swift
public init(for session: Session, _ adsDispatcher: AdsDispatcherProtocol)
adsDispatcher
|
state changes dispatcher |
if true
pause ad playback on tap event
Swift
public var pauseOnTap: Bool
Swift
public var onAdsState: ((AdsState) -> Void)?
Reflects the current playback time in seconds for the content
Swift
public var currentTime: TimeInterval
Called when ads are successfully loaded from the ad servers by the loader
Swift
public func adsLoader(_: IMAAdsLoader, adsLoadedWith adsLoadedData: IMAAdsLoadedData)
loader
|
ads loader |
adsLoadedData
|
ads data |
Error dispatched by the ads loader when loading or requesting an ad fails
Swift
public func adsLoader(_: IMAAdsLoader, failedWith adErrorData: IMAAdLoadingErrorData)
loader
|
ads laoder |
adErrorData
|
ad loading error |
Description
Swift
public func playerLayerAttached(_: CALayer)
playerLayer
|
playerLayer description |
Updates current view size Current implementation makes it full screen
Swift
public func viewSizeTransition(_ size: CGSize)
size
|
new size |
Called when there is an IMAAdEvent
Swift
public func adsManager(_ adsManager: IMAAdsManager, didReceive event: IMAAdEvent)
adsManager
|
ads manager |
event
|
event received |
Called when there was an error playing the ad. Log the error and resume playing content.
Swift
public func adsManager(_ adsManager: IMAAdsManager, didReceive error: IMAAdError)
adsManager
|
ads manager |
error
|
error received |
Called when an ad is ready to play. The implementing code should pause the content playback and prepare the UI for ad playback
Swift
public func adsManagerDidRequestContentPause(_ adsManager: IMAAdsManager)
adsManager
|
ads manager |
Called when an ad has finished or an error occurred during the playback. The implementing code should resume the content playback.
Swift
public func adsManagerDidRequestContentResume(_ adsManager: IMAAdsManager)
adsManager
|
ads manager |
Swift
public func adsManagerAdDidStartBuffering(_ adsManager: IMAAdsManager)
Swift
public func adsManagerAdPlaybackReady(_ adsManager: IMAAdsManager)
Swift
public func adsManager(
_ adsManager: IMAAdsManager,
adDidProgressToTime mediaTime: TimeInterval,
totalTime: TimeInterval)
Starts advertisement playback
Swift
public func start()
Pauses advertisement
Swift
public func pause()
Resumes the advertisement
Swift
public func resume()
Skips the advertisement if the ad is skippable and the skip offset has been reached
Swift
public func skip()
Causes the ads manager to stop the ad and clean its internal state
Swift
public func destroy()
If an ad break is currently playing, discard it and resume content Otherwise, ignore the next scheduled ad break
Swift
public func discardAdBreak()
Common ads state
Swift
public var isAdPlaying: Bool { get }
Request ads from the ad server from given url
Swift
public func requestAds(
withUrl url: URL,
onView view: UIView,
viewController: UIViewController?)
url
|
request ad url |
Request ads from the ad server from given Ads Response
Swift
public func requestAds(
withAdsResponse response: String,
onView view: UIView,
viewController: UIViewController?)
response
|
hardcoded response |