iOS SDK Version

FBMediaView

Objective-C
@interfaceFBMediaView:UIView
Swift
classFBMediaView:UIView
The FBMediaView loads media content from a given FBNativeAd. This view takes the place of manually loading a cover image.
  • the delegate

    Declaration

    Objective-C
    @property(nonatomic,weak,nullable)id<FBMediaViewDelegate>delegate;
    Swift
    weakvardelegate:FBMediaViewDelegate?{getset}
  • A custom FBMediaViewVideoRenderer instance, used to override the default user experience of video ads. The video renderer can only be set prior to registering the mediaView to a nativeAd

    Declaration

    Objective-C
    @property(nonatomic,strong)FBMediaViewVideoRenderer*_NonnullvideoRenderer;
    Swift
    varvideoRenderer:FBMediaViewVideoRenderer{getset}
  • The current volume of the media view, ranging from 0.0 through 1.0.

    Declaration

    Objective-C
    @property(nonatomic,readonly)floatvolume;
    Swift
    varvolume:Float{get}
  • Shows if the video will autoplay or not

    Declaration

    Objective-C
    @property(nonatomic,readonly,getter=isAutoplayEnabled)BOOLautoplayEnabled;
    Swift
    varisAutoplayEnabled:Bool{get}
  • The aspect ratio of the media view visual content. Returns a positive CGFloat, or 0.0 if no ad is currently loaded.

    Declaration

    Objective-C
    @property(nonatomic,readonly)CGFloataspectRatio;
    Swift
    varaspectRatio:CGFloat{get}
  • The tag for media view. It always returns FBNativeAdViewTagMedia.

    Declaration

    Objective-C
    @property(nonatomic,readonly)FBNativeAdViewTagnativeAdViewTag;
    Swift
    varnativeAdViewTag:FBNativeAdViewTag{get}
  • Changes the width of the FBMediaView’s frame based on the current height, respecting aspectRatio.

    Declaration

    Objective-C
    -(void)applyNaturalWidth;
    Swift
    funcapplyNaturalWidth()
  • Changes the height of the FBMediaView’s frame based on the current width, respecting aspectRatio.

    Declaration

    Objective-C
    -(void)applyNaturalHeight;
    Swift
    funcapplyNaturalHeight()