SVSAdManagerDelegate

@protocol SVSAdManagerDelegate <NSObject>

Delegate protocol for SVSAdManager instances.

Use it if you want more information about the ad break that is being played, about errors or about user interactions.

  • Called when an ad manager instance fails to start. This can occur for several reasons such as contentPlayhead not ready, etc. See error for more informations.

    Declaration

    Objective-C

    - (void)adManager:(nonnull SVSAdManager *)adManager
        didFailToStartWithError:(nonnull NSError *)error;

    Parameters

    adManager

    The SVSAdManager instance that failed to start.

    error

    A NSError instance corresponding to the error.

  • Called when an ad manager instance fails to play an ad break.

    Declaration

    Objective-C

    - (void)adManager:(nonnull SVSAdManager *)adManager
        didFailToStartAdBreak:(SVSAdBreakType)adBreakType
                        error:(nonnull NSError *)error;

    Parameters

    adManager

    The SVSAdManager instance that failed to start an AdBreak.

    adBreakType

    The ad break type (overlay, preroll, midroll, postroll).

    error

    A NSError instance corresponding to the error.

  • Called when an ad manager instance starts to play an ad break.

    Declaration

    Objective-C

    - (void)adManager:(nonnull SVSAdManager *)adManager
        didStartAdBreak:(SVSAdBreakType)adBreakType;

    Parameters

    adManager

    The SVSAdManager instance that started.

    adBreakType

    The ad break type (overlay, preroll, midroll, postroll).

  • Called when an ad manager instance is finishing to play an ad break.

    Declaration

    Objective-C

    - (void)adManager:(nonnull SVSAdManager *)adManager
        didFinishAdBreak:(SVSAdBreakType)adBreakType
             numberOfAds:(NSInteger)numberOfAdsPlayed
                duration:(NSTimeInterval)duration
                   error:(nullable NSError *)error;

    Parameters

    adManager

    The SVSAdManager instance that finished an ad break.

    adBreakType

    The ad break type (overlay, preroll, midroll, postroll).

    numberOfAdsPlayed

    The number of ads played during this ad break.

    duration

    The total duration of the ad break.

    error

    A NSError instance if an error happens, nil otherwise.

  • Called when an ad manager instance will start to play ads. You should pause your content player in this method.

    Declaration

    Objective-C

    - (void)adManagerDidRequestToPauseContentPlayer:
                (nonnull SVSAdManager *)adManager
                                         forAdBreak:(SVSAdBreakType)adBreakType;

    Parameters

    adManager

    The SVSAdManager instance about to play an ad.

    adBreakType

    The ad break type (overlay, preroll, midroll, postroll).

  • Called when an ad manager instance finished to play ads. You should resume your content player in this method.

    Declaration

    Objective-C

    - (void)adManagerDidRequestToResumeContentPlayer:
                (nonnull SVSAdManager *)adManager
                                        afterAdBreak:(SVSAdBreakType)adBreakType;

    Parameters

    adManager

    The SVSAdManager instance which finished to play ads.

    adBreakType

    The ad break type (overlay, preroll, midroll, postroll).

  • Called periodically to keep track of the ad manager’s playback status.

    Implement this method for custom tracking, trigger background tasks, etc…

    Declaration

    Objective-C

    - (void)adManager:(nonnull SVSAdManager *)adManager
        didProgressToTime:(NSTimeInterval)currentTime
                totalTime:(NSTimeInterval)totalTime;

    Parameters

    adManager

    The SVSAdManager instance currently playing.

    currentTime

    The current time of the player.

    totalTime

    The total duration of the player’s playlist.

  • Called when the enter fullscreen button of an Ad is clicked by the user. Adapt your UI to properly react to this user action: you should resize your container view so it fits the whole screen.

    Declaration

    Objective-C

    - (void)adManagerDidRequestToEnterFullscreen:(nonnull SVSAdManager *)adManager;

    Parameters

    adManager

    The SVSAdManager instance asking to enter fullscreen.

  • Called when the exit fullscreen button of an Ad is clicked by the user. Adapt your UI to properly react to this user action: you should resize your container view so it goes back to its original size.

    Declaration

    Objective-C

    - (void)adManagerDidRequestToExitFullscreen:(nonnull SVSAdManager *)adManager;

    Parameters

    adManager

    The SVSAdManager instance asking to exit fullscreen.

  • Called when the ad has been clicked and needs to open a modal.

    Implement this method and return the appropriate UIViewController to present the post click modal controller.

    Declaration

    Objective-C

    - (nonnull UIViewController *)
    adManagerDidRequestPostClickPresentationViewController:
        (nonnull SVSAdManager *)adManager;

    Parameters

    adManager

    The SVSAdManager instance that needs the current UIViewController.

    Return Value

    An UIViewController from which the post click modal controller should be presented.