GoogleMobileAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GADMediaContent
@interface GADMediaContent : NSObject
Provides media content information. Interact with instances of this class on the main queue
only.
-
Controls the media content’s video.
Declaration
Swift
var videoController: VideoController { get }
-
Indicates whether the media content has video content.
Declaration
Swift
var hasVideoContent: Bool { get }
Objective-C
@property (nonatomic, readonly) BOOL hasVideoContent;
-
Media content aspect ratio (width/height). The value is 0 when there’s no media content or the
media content aspect ratio is unknown.
Declaration
Swift
var aspectRatio: CGFloat { get }
Objective-C
@property (nonatomic, readonly) CGFloat aspectRatio;
-
The video’s duration in seconds or 0 if there’s no video or the duration is unknown.
Declaration
Swift
var duration: TimeInterval { get }
Objective-C
@property (nonatomic, readonly) NSTimeInterval duration;
-
The video’s current playback time in seconds or 0 if there’s no video or the current playback
time is unknown.
Declaration
Swift
var currentTime: TimeInterval { get }
Objective-C
@property (nonatomic, readonly) NSTimeInterval currentTime;
-
The main image to be displayed when the media content doesn’t contain video. Only available to
native ads.
Declaration
Swift
var mainImage: UIImage? { get set }
Objective-C
@property (nonatomic, nullable) UIImage *mainImage;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eGADMediaContent\u003c/code\u003e provides information about media content, such as video and images, associated with an ad.\u003c/p\u003e\n"],["\u003cp\u003eIt offers properties to control video playback, check for video content, and access video attributes like aspect ratio and duration.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access the main image for display when there's no video content, specifically for native ads.\u003c/p\u003e\n"],["\u003cp\u003eInteraction with \u003ccode\u003eGADMediaContent\u003c/code\u003e instances should occur on the main queue for thread safety.\u003c/p\u003e\n"]]],[],null,["# GoogleMobileAds Framework Reference\n\nGADMediaContent\n===============\n\n\n @interface GADMediaContent : NSObject\n\nProvides media content information. Interact with instances of this class on the main queue\nonly.\n- `\n ``\n ``\n `\n\n ### [videoController](#/c:objc(cs)GADMediaContent(py)videoController)\n\n `\n ` \n Controls the media content's video. \n\n #### Declaration\n\n Swift \n\n var videoController: VideoController { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) ../Classes/GADVideoController.html *videoController;\n\n- `\n ``\n ``\n `\n\n ### [hasVideoContent](#/c:objc(cs)GADMediaContent(py)hasVideoContent)\n\n `\n ` \n Indicates whether the media content has video content. \n\n #### Declaration\n\n Swift \n\n var hasVideoContent: Bool { get }\n\n Objective-C \n\n @property (nonatomic, readonly) BOOL hasVideoContent;\n\n- `\n ``\n ``\n `\n\n ### [aspectRatio](#/c:objc(cs)GADMediaContent(py)aspectRatio)\n\n `\n ` \n Media content aspect ratio (width/height). The value is 0 when there's no media content or the\n media content aspect ratio is unknown. \n\n #### Declaration\n\n Swift \n\n var aspectRatio: CGFloat { get }\n\n Objective-C \n\n @property (nonatomic, readonly) CGFloat aspectRatio;\n\n- `\n ``\n ``\n `\n\n ### [duration](#/c:objc(cs)GADMediaContent(py)duration)\n\n `\n ` \n The video's duration in seconds or 0 if there's no video or the duration is unknown. \n\n #### Declaration\n\n Swift \n\n var duration: TimeInterval { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSTimeInterval duration;\n\n- `\n ``\n ``\n `\n\n ### [currentTime](#/c:objc(cs)GADMediaContent(py)currentTime)\n\n `\n ` \n The video's current playback time in seconds or 0 if there's no video or the current playback\n time is unknown. \n\n #### Declaration\n\n Swift \n\n var currentTime: TimeInterval { get }\n\n Objective-C \n\n @property (nonatomic, readonly) NSTimeInterval currentTime;\n\n[NativeAd\n--------](#/NativeAd)\n\n- `\n ``\n ``\n `\n\n ### [mainImage](#/c:objc(cs)GADMediaContent(py)mainImage)\n\n `\n ` \n The main image to be displayed when the media content doesn't contain video. Only available to\n native ads. \n\n #### Declaration\n\n Swift \n\n var mainImage: UIImage? { get set }\n\n Objective-C \n\n @property (nonatomic, nullable) UIImage *mainImage;"]]