SASNativeAdMediaView

Objective-C

@interface SASNativeAdMediaView : UIView

Swift

class SASNativeAdMediaView : UIView

Provides a standard view used to play SASNativeAd media.

Some SASNativeAd comes with a media (most of the time a video) that needs to be played. You can use the method [SASNativeAd hasMedia] to know if your SASNativeAd needs a SASNativeAdMediaView to be displayed properly. (See Native Ads documentation for more information).

Note

Native ad media cannot be played outside of a SASNativeAdMediaView.

Media view properties

  • The object that acts as the delegate of the receiving SASNativeAdMediaView.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<SASNativeAdMediaViewDelegate> delegate;

    Swift

    weak var delegate: SASNativeAdMediaViewDelegate? { get set }
  • The SASNativeAd currently registered with the MediaView.

    This native ad must have a media and cannot be registered to another SASNativeAdMediaView.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) SASNativeAd *nativeAd;

    Swift

    var nativeAd: SASNativeAd? { get }
  • YES if the view is currently playing media, NO otherwise.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isPlayingMedia;

    Swift

    var isPlayingMedia: Bool { get }

Registering Native Ads

  • Registers the native ad that will use this media view to display its media.

    You MUST register the SASNativeAd for it to be able to play its media. Native ad media cannot be played outside of their SASNativeAdMediaView.

    Declaration

    Objective-C

    - (void)registerNativeAd:(nonnull SASNativeAd *)nativeAd;

    Swift

    func registerNativeAd(_ nativeAd: SASNativeAd)

    Parameters

    nativeAd

    The SASNativeAd to be registered to play its media in this media view.