GoogleInteractiveMediaAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
IMAVideoDisplay
Declares a simple video display class used for ad playback.
-
Allows the publisher to send player events to the SDK.
-
Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is
relative to device volume, not absolute. Default value is 1.
Declaration
Swift
var volume: Float { get set }
Objective-C
@property (nonatomic) float volume;
-
Called to inform the VideoDisplay to load the passed URL with the subtitles for the stream.
Subtitles are available only for dynamic ad insertion VOD streams and can be ignored
for client side ads or dynamic ad insertion live streams.
Declaration
Swift
func loadStream(_ streamURL: URL, withSubtitles subtitles: [[String : String]])
Objective-C
- (void)loadStream:(nonnull NSURL *)streamURL
withSubtitles:
(nonnull NSArray<NSDictionary<NSString *, NSString *> *> *)subtitles;
Parameters
streamURL
|
|
subtitles
|
the subtitles for the stream. Each entry in the subtitles array is an
NSDictionary that corresponds to a language. Each dictionary will have a
language key with a two letter language string value, a language name
to specify the set of subtitles if multiple sets exist for the same language,
and one or more subtitle key/value pairs. Here’s an example NSDictionary for
English:
"language" -> "en"
"language_name" -> "English"
"webvtt" -> "https://somedomain.com/vtt/en.vtt"
"ttml" -> "https://somedomain.com/ttml/en.ttml"
|
-
Called to inform the VideoDisplay to play.
Declaration
Objective-C
- (void)play;
-
Called to inform the VideoDisplay to pause.
Declaration
Objective-C
- (void)pause;
-
Called to remove all video assets from the player.
Declaration
Objective-C
- (void)reset;
-
Called to inform that the stream needs to be seeked to the given time.
Declaration
Swift
func seekStream(toTime time: TimeInterval)
Objective-C
- (void)seekStreamToTime:(NSTimeInterval)time;
Parameters
time
|
the time to which the stream should be seeked
|
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\u003eIMAVideoDisplay\u003c/code\u003e is a protocol used for ad playback by implementing a simple video display.\u003c/p\u003e\n"],["\u003cp\u003eIt allows publishers to control ad playback through methods like play, pause, reset, and seeking.\u003c/p\u003e\n"],["\u003cp\u003eVolume can be set relative to the device volume, ranging from 0 (muted) to 1 (loudest).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eloadStream\u003c/code\u003e method is used to initialize the display with the ad stream URL and optional subtitles.\u003c/p\u003e\n"],["\u003cp\u003eA delegate property is provided for sending player events back to the SDK.\u003c/p\u003e\n"]]],["The `IMAVideoDisplay` protocol manages ad playback, enabling publishers to send player events. Key actions include setting and getting the ad volume (from 0 to 1), loading a stream via a URL and optional subtitles (dynamic VOD only), playing, pausing, resetting (removing video assets), and seeking the stream to a specific time. The delegate property allows for sending player events, and subtitles are passed as an array of dictionaries containing language information.\n"],null,["# GoogleInteractiveMediaAds Framework Reference\n\nIMAVideoDisplay\n===============\n\n @protocol IMAVideoDisplay \u003c../Protocols/IMAAdPlaybackInfo.html\u003e\n\nDeclares a simple video display class used for ad playback.\n- `\n ``\n ``\n `\n\n ### [delegate](#/c:objc(pl)IMAVideoDisplay(py)delegate)\n\n `\n ` \n Allows the publisher to send player events to the SDK. \n\n #### Declaration\n\n Swift \n\n weak var delegate: (any ../Protocols/IMAVideoDisplayDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/IMAVideoDisplayDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n ### [volume](#/c:objc(pl)IMAVideoDisplay(py)volume)\n\n `\n ` \n Set and get the volume for the current ad. From 0 (muted) to 1 (loudest). This volume is\n relative to device volume, not absolute. Default value is 1. \n\n #### Declaration\n\n Swift \n\n var volume: Float { get set }\n\n Objective-C \n\n @property (nonatomic) float volume;\n\n- `\n ``\n ``\n `\n\n ### [-loadStream:withSubtitles:](#/c:objc(pl)IMAVideoDisplay(im)loadStream:withSubtitles:)\n\n `\n ` \n Called to inform the VideoDisplay to load the passed URL with the subtitles for the stream.\n Subtitles are available only for dynamic ad insertion VOD streams and can be ignored\n for client side ads or dynamic ad insertion live streams. \n\n #### Declaration\n\n Swift \n\n func loadStream(_ streamURL: URL, withSubtitles subtitles: [[String : String]])\n\n Objective-C \n\n - (void)loadStream:(nonnull NSURL *)streamURL\n withSubtitles:\n (nonnull NSArray\u003cNSDictionary\u003cNSString *, NSString *\u003e *\u003e *)subtitles;\n\n #### Parameters\n\n |-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*streamURL*` ` | the URL of the stream |\n | ` `*subtitles*` ` | the subtitles for the stream. Each entry in the subtitles array is an *NSDictionary* that corresponds to a language. Each dictionary will have a *language* key with a two letter language string value, a *language name* to specify the set of subtitles if multiple sets exist for the same language, and one or more subtitle key/value pairs. Here's an example NSDictionary for English: \"language\" -\u003e \"en\" \"language_name\" -\u003e \"English\" \"webvtt\" -\u003e \"https://somedomain.com/vtt/en.vtt\" \"ttml\" -\u003e \"https://somedomain.com/ttml/en.ttml\" |\n\n- `\n ``\n ``\n `\n\n ### [-play](#/c:objc(pl)IMAVideoDisplay(im)play)\n\n `\n ` \n Called to inform the VideoDisplay to play. \n\n #### Declaration\n\n Swift \n\n func play()\n\n Objective-C \n\n - (void)play;\n\n- `\n ``\n ``\n `\n\n ### [-pause](#/c:objc(pl)IMAVideoDisplay(im)pause)\n\n `\n ` \n Called to inform the VideoDisplay to pause. \n\n #### Declaration\n\n Swift \n\n func pause()\n\n Objective-C \n\n - (void)pause;\n\n- `\n ``\n ``\n `\n\n ### [-reset](#/c:objc(pl)IMAVideoDisplay(im)reset)\n\n `\n ` \n Called to remove all video assets from the player. \n\n #### Declaration\n\n Swift \n\n func reset()\n\n Objective-C \n\n - (void)reset;\n\n- `\n ``\n ``\n `\n\n ### [-seekStreamToTime:](#/c:objc(pl)IMAVideoDisplay(im)seekStreamToTime:)\n\n `\n ` \n Called to inform that the stream needs to be seeked to the given time. \n\n #### Declaration\n\n Swift \n\n func seekStream(toTime time: TimeInterval)\n\n Objective-C \n\n - (void)seekStreamToTime:(NSTimeInterval)time;\n\n #### Parameters\n\n |--------------|-----------------------------------------------|\n | ` `*time*` ` | the time to which the stream should be seeked |"]]