Skip to content

Commit 907274e

Browse files
🤖 Merge PR DefinitelyTyped#73516 [Chromecast-CAF-Receiver] Adding dynamic ad break types by @JStaplesREDspace
1 parent 6c121b8 commit 907274e

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

‎types/chromecast-caf-receiver/cast.framework.breaks.d.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ export class BreakClipLoadInterceptorContext {
4343
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.breaks.BreakManager
4444
*/
4545
export interface BreakManager {
46+
/**
47+
* Adds dynamic break and break clips. The break clips will be associated with the break
48+
* ({@link Break.breakClipIds} and {@link Break.duration} will be updated according to the clips).
49+
* @param breakData The {@link Break} object to be added.
50+
* @param breakClips Array of non-null {@link BreakClip} objects.
51+
* @param broadCastMediaStatus Whether CAF should check if the current break status has changed.
52+
* This may not be desirable before playback begins, as the receiver may still need to add
53+
* more breaks (e.g., during load complete).
54+
* @returns `true` if break was added successfully.
55+
*/
56+
addBreak(breakData: Break, breakClips: BreakClip[], broadCastMediaStatus?: boolean): boolean;
57+
4658
/**
4759
* Get current media break by id.
4860
*/
@@ -74,6 +86,12 @@ export interface BreakManager {
7486
/** Returns true if watched breaks should be played. */
7587
getPlayWatchedBreak(): boolean;
7688

89+
/**
90+
* Removes a break and associated break clips.
91+
* @returns `true` if break was removed successfully.
92+
*/
93+
removeBreakById(breakId: string): boolean;
94+
7795
/**
7896
* Provide an interceptor to allow developer to insert more break clips or
7997
* modify current break clip before a break is started.

‎types/chromecast-caf-receiver/cast.framework.messages.d.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,6 +2556,12 @@ export class Break {
25562556
* Duration of break in sec.
25572557
*/
25582558
duration?: number | undefined;
2559+
/**
2560+
* Indicates whether the break is expanded on the timeline. The duration of expanded
2561+
* breaks is included in the total playback duration. A value of `true` indicates
2562+
* that the break is expanded. When omitted, the value is assumed to be `false`.
2563+
*/
2564+
expanded?: boolean;
25592565
/**
25602566
* Unique id of break.
25612567
*/

‎types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ const items = qBase.fetchItems(1, 3, 4);
6060
const breakSeekData = new cast.framework.breaks.BreakSeekData(0, 100, []);
6161
const breakClipLoadContext = new cast.framework.breaks.BreakClipLoadInterceptorContext(adBreak);
6262
const breakManager: BreakManager = {
63+
addBreak: () => true,
6364
getBreakById: () => adBreak,
6465
getBreakClipCurrentTimeSec: () => null,
6566
getBreakClipDurationSec: () => null,
6667
getBreakClipById: () => breakClip,
6768
getBreakClips: () => [breakClip],
6869
getBreaks: () => [adBreak],
6970
getPlayWatchedBreak: () => true,
71+
removeBreakById: () => true,
7072
setBreakClipLoadInterceptor: () => {},
7173
setBreakSeekInterceptor: () => {},
7274
setPlayWatchedBreak: () => {},

0 commit comments

Comments
 (0)