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-02-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-04 UTC."],[[["`GADMediaContent` provides information about media content, such as video and images, associated with an ad."],["It offers properties to control video playback, check for video content, and access video attributes like aspect ratio and duration."],["Developers can access the main image for display when video content is not present, specifically for native ads."],["All interactions with `GADMediaContent` instances should be performed on the main queue."]]],["GADMediaContent provides information about media content, accessible only on the main queue. It offers a `videoController` for managing video playback. Key properties include `hasVideoContent` indicating video presence, `aspectRatio` for dimensions, `duration` for video length, and `currentTime` for playback position. For native ads, `mainImage` is available when there's no video. These attributes are used to determine video properties and manage associated media content.\n"]]