VPKAdHandler

@protocol VPKAdHandler

Protocol for handling pre-roll video advertising.

When an object conforming to this protocol is assigned to a VPKPreview or VPKVeepViewer, VPKit video content will be loaded and paused to allow the host app to manage preroll advertising.

view, controller and completion objects will be returned to facilitate correct handling and display of prerolls.

When the completion block is called, control will return to the SDK to play the requested video content.

Designed for GoogleAds Interactive Media Ads requirements.

  • Implement this method to provide view, controller and completion block to an advertising handler.

    Declaration

    Objective-C

    - (void)handlePreroll:(nonnull UIView *)view
               controller:(nonnull UIViewController *)controller
               identifier:(nonnull id<VPKMediaIdentifier>)identifier
               completion:(nonnull void (^)(void))completion;
    Parameters
    view

    The view on top of which an advertising videoPlayer should be placed, using the same frame.

    controller

    The parent viewController for the view. This is the viewController that must be used to present an in-app browser for click-through ad content.

    identifier

    An object conforming to VPKMediaIdentifier protocol. Returns any optional mediaIdentifier string and customData dictionary associated with the currently loaded meda item

    completion

    The completion block that must be called when the preroll ad has finished playing. The VPKit SDK video will not play until this block is called.

  • Implement this method to clean up interrupted ad handling.

    Declaration

    Objective-C

    - (void)stopPreroll;