AI-generated Key Takeaways
-
GADMediaContent provides media content information and should be interacted with only on the main queue.
-
You can control the media content's video using the videoController property.
-
The hasVideoContent property indicates if the media content includes video.
-
Properties like aspectRatio, duration, and currentTime provide details about the media content or video playback.
-
For native ads, the mainImage property allows setting an image when there is no video content.
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 }
Objective-C
@property (nonatomic, readonly, nonnull) GADVideoController *videoController;
-
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;