AdBreakInfo.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Builder
(long playbackPositionInMs)
Inherited Method Summary
From class java.lang.Object
Public Constructors
public
Builder
(long
playbackPositionInMs)
Parameters
playbackPositionInMs
The content’s playback position in milliseconds at which the ad will begin
playing. This is a required field.
Public Methods
public AdBreakInfo.Builder
setDurationInMs
(long
durationInMs)
Sets this break content’s duration in milliseconds.
Sets the ad break's ID. This is a required field.
public AdBreakInfo.Builder
setIsEmbedded
(boolean
isEmbedded)
Set to true
if this break doesn't have a URL and is part of the
content.
public AdBreakInfo.Builder
setIsWatched
(boolean
isWatched)
Set to true
if this break has been watched.
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 2024-10-31 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 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eAdBreakInfo.Builder\u003c/code\u003e helps construct \u003ccode\u003eAdBreakInfo\u003c/code\u003e objects, defining advertisement breaks within media content.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to set essential ad break properties like ID, duration, playback position, and associated clip IDs.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify whether an ad break is embedded within the main content or a separate entity.\u003c/p\u003e\n"],["\u003cp\u003eThe builder also allows marking an ad break as watched, aiding in playback management.\u003c/p\u003e\n"],["\u003cp\u003eUsing the \u003ccode\u003ebuild()\u003c/code\u003e method, a finalized \u003ccode\u003eAdBreakInfo\u003c/code\u003e instance is created based on the provided configurations.\u003c/p\u003e\n"]]],[],null,["# AdBreakInfo.Builder\n\npublic static class **AdBreakInfo.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nA builder for [AdBreakInfo](/android/reference/com/google/android/gms/cast/AdBreakInfo). \n\n### Public Constructor Summary\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#Builder(long))(long playbackPositionInMs) Construct a [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder). |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AdBreakInfo](/android/reference/com/google/android/gms/cast/AdBreakInfo) | [build](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#build())() Builds an [AdBreakInfo](/android/reference/com/google/android/gms/cast/AdBreakInfo) instance. |\n| [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder) | [setBreakClipIds](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#setBreakClipIds(java.lang.String[]))([String\\[\\]](//developer.android.com/reference/java/lang/String.html) breakClipIds) Set an unmodifiable list of ad break clip IDs in this break. |\n| [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder) | [setDurationInMs](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#setDurationInMs(long))(long durationInMs) Sets this break content's duration in milliseconds. |\n| [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder) | [setId](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#setId(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) id) Sets the ad break's ID. |\n| [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder) | [setIsEmbedded](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#setIsEmbedded(boolean))(boolean isEmbedded) Set to `true` if this break doesn't have a URL and is part of the content. |\n| [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder) | [setIsWatched](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder#setIsWatched(boolean))(boolean isWatched) Set to `true` if this break has been watched. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** (long playbackPositionInMs)\n\nConstruct a [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder). \n\n##### Parameters\n\n| playbackPositionInMs | The content's playback position in milliseconds at which the ad will begin playing. This is a required field. |\n|----------------------|---------------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [AdBreakInfo](/android/reference/com/google/android/gms/cast/AdBreakInfo)\n**build** ()\n\nBuilds an [AdBreakInfo](/android/reference/com/google/android/gms/cast/AdBreakInfo)\ninstance. \n\n#### public [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder)\n**setBreakClipIds** ([String\\[\\]](//developer.android.com/reference/java/lang/String.html) breakClipIds)\n\nSet an unmodifiable list of ad break clip IDs in this break. The list of matching\n[AdBreakClipInfo](/android/reference/com/google/android/gms/cast/AdBreakClipInfo)\nobjects can be obtained by calling [MediaInfo.getAdBreakClips()](/android/reference/com/google/android/gms/cast/MediaInfo#getAdBreakClips()).\nThis is a required field. \n\n#### public [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder)\n**setDurationInMs** (long durationInMs)\n\nSets this break content's duration in milliseconds. \n\n#### public [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder)\n**setId** ([String](//developer.android.com/reference/java/lang/String.html) id)\n\nSets the ad break's ID. This is a required field. \n\n#### public [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder)\n**setIsEmbedded** (boolean isEmbedded)\n\nSet to `true` if this break doesn't have a URL and is part of the\ncontent. \n\n#### public [AdBreakInfo.Builder](/android/reference/com/google/android/gms/cast/AdBreakInfo.Builder)\n**setIsWatched** (boolean isWatched)\n\nSet to `true` if this break has been watched."]]