-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[interactive_media_ads] Adds support to define parameters that control the rendering of ads #8057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fc00df8
efc63c0
ca5c47d
70be676
d0e0de9
c10c14f
7f9a563
5b3e3ae
bae565f
e5abb39
3071bf5
bf2a118
aa443bc
832d86e
efa6b2d
63eabc3
b69a9bd
e7aaf61
4c8bc86
300a608
b2abcd1
3b79dd0
e80a923
1e58518
9d85bf8
d9b81e6
35e05c5
aea49fe
4b4bf9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'ui_element.dart'; | ||
|
|
||
| /// Defines parameters that control the rendering of ads. | ||
| class PlatformAdsRenderingSettings { | ||
| /// Constructs an [PlatformAdsRenderingSettings]. | ||
| PlatformAdsRenderingSettings({ | ||
| this.bitrate, | ||
| this.enablePreloading, | ||
| this.loadVideoTimeout, | ||
| this.mimeTypes, | ||
| this.playAdsAfterTime, | ||
| this.uiElements, | ||
| }); | ||
|
|
||
| /// Maximum recommended bitrate. | ||
| /// | ||
| /// The value is in kbit/s. | ||
| /// | ||
| /// The SDK will select media which has a bitrate below the specified max or | ||
| /// the closest bitrate if there is no media with a lower bitrate found. | ||
| /// | ||
| /// If null, the bitrate will be selected by the SDK, using the currently | ||
| /// detected network speed (cellular or Wi-Fi). | ||
| final int? bitrate; | ||
|
|
||
| /// If set, the SDK will instruct the player to load the creative in response | ||
| /// initializing the ads manager. | ||
| /// | ||
| /// This allows the player to preload the ad at any point before starting the | ||
| /// ads manager. | ||
| /// | ||
| /// If null, the platform will decide the default value. | ||
| final bool? enablePreloading; | ||
|
|
||
| /// Specifies a non-default amount of time to wait for media to load before | ||
| /// timing out, in milliseconds. | ||
| /// | ||
| /// This only applies to the IMA client-side SDK. Default time is 8000 ms. | ||
| final int? loadVideoTimeout; | ||
bparrishMines marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// The SDK will prioritize the media with MIME type on the list. | ||
| /// | ||
| /// If empty, the SDK will pick the media based on player capabilities. This | ||
| /// only refers to the mime types of videos to be selected for linear ads. | ||
| final List<String>? mimeTypes; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-nullable?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the documentation for iOS actually states what happens if it is empty. Android doesn't actually mention it: This is related to having a "don't set" option for optional native parameters.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an implementation detail though; if we want empty to mean "the SDK decides" as the docs currently say, then we should map an empty list to not setting on platforms that treat null as not setting. If we actually want to treat |
||
|
|
||
| /// For VMAP and ad rules playlists, only play ad breaks scheduled after this | ||
| /// time (in seconds). | ||
| /// | ||
| /// This setting is strictly after the specified time. For example, setting | ||
| /// `playAdsAfterTime` to 15 will ignore an ad break scheduled to play at 15s. | ||
| final double? playAdsAfterTime; | ||
bparrishMines marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// Sets the ad UI elements to be rendered by the IMA SDK. | ||
| /// | ||
| /// Some modifications to the uiElements list may have no effect for specific | ||
| /// ads. | ||
| final Set<UIElement>? uiElements; | ||
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| /// Describes an element of the ad UI, to be requested or rendered by the SDK. | ||
| enum UIElement { | ||
bparrishMines marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /// The ad attribution UI element, for example, "Ad". | ||
| adAttribution, | ||
|
|
||
| /// Ad attribution is required for a countdown timer to be displayed. | ||
| countdown, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ dev_dependencies: | |
| flutter_test: | ||
| sdk: flutter | ||
| mockito: ^5.4.4 | ||
| pigeon: ^22.5.0 | ||
| pigeon: ^22.6.0 | ||
|
|
||
| topics: | ||
| - ads | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This value defaults to
falseon Android andtrueon iOS. To prevent a breaking change, I made the value nullable to indicate the platform will handle the default. Same is true for the other fields.