chromecast-caf-receiver: All cast.framework.messages union types converted to enums to match SDK (#40166)

* Convert MessageType to enum

* Convert all messages to enums

* Add documentation links

* Bumping major version for breaking changes
This commit is contained in:
Brandon Risell
2019-11-05 13:54:05 -08:00
committed by Nathan Shively-Sanders
parent 5149044884
commit d490331e00
4 changed files with 417 additions and 159 deletions
+8 -5
View File
@@ -645,14 +645,17 @@ export class PlayerManager {
/**
* Provide an interceptor of incoming and outgoing messages.
* The interceptor can update the request data; and return updated data; a promise of
* updated data if need to get more data from the server; or null if the request should not be handled.
* Note that if load message interceptor is provided; and no interceptor is provided for preload -
* the load interceptor will be called for preload messages.
* The interceptor can update the request data and return updated data,
* a promise of updated data if need to get more data from the server,
* or null if the request should not be handled.
* If the load message interceptor is provided and no interceptor is provided for preload, the load interceptor will be called for preload messages.
*/
setMessageInterceptor(
type: messages.MessageType,
interceptor: (requestData: messages.RequestData) => Promise<any>,
interceptor:
| ((requestData: messages.RequestData) => messages.RequestData)
| ((requestData: messages.RequestData) => Promise<any>)
| null,
): void;
/**
+391 -144
View File
@@ -1,147 +1,258 @@
import { Event, DetailedErrorCode } from './cast.framework.events';
export as namespace messages;
export type UserAction = 'LIKE' | 'DISLIKE' | 'FOLLOW' | 'UNFOLLOW' | 'FLAG' | 'SKIP_AD';
export type UserActionContext =
| 'UNKNOWN_CONTEXT'
| 'ALBUM'
| 'ARTIST'
| 'PLAYLIST'
| 'EPISODE'
| 'SERIES'
| 'MOVIE'
| 'CHANNEL'
| 'TEAM'
| 'PLAYER'
| 'COACH';
export type TextTrackType = 'SUBTITLES' | 'CAPTIONS' | 'DESCRIPTIONS' | 'CHAPTERS' | 'METADATA';
export type TextTrackWindowType = 'NONE' | 'NORMAL' | 'ROUNDED_CORNERS';
export type TrackType = 'TEXT' | 'AUDIO' | 'VIDEO';
export type TextTrackFontGenericFamily =
| 'SANS_SERIF'
| 'MONOSPACED_SANS_SERIF'
| 'SERIF'
| 'MONOSPACED_SERIF'
| 'CASUAL'
| 'CURSIVE'
| 'SMALL_CAPITALS';
export type TextTrackFontStyle = 'NORMAL' | 'BOLD' | 'BOLD_ITALIC' | 'ITALIC';
export type TextTrackEdgeType = 'NONE' | 'OUTLINE' | 'DROP_SHADOW' | 'RAISED' | 'DEPRESSED';
export namespace Command {
const ALL_BASIC_MEDIA: number;
const DISLIKE: number;
const EDIT_TRACKS: number;
const FOLLOW: number;
const LIKE: number;
const PAUSE: number;
const PLAYBACK_RATE: number;
const QUEUE_NEXT: number;
const QUEUE_PREV: number;
const QUEUE_REPEAT: number;
const QUEUE_REPEAT_ALL: number;
const QUEUE_REPEAT_ONE: number;
const QUEUE_SHUFFLE: number;
const SEEK: number;
const SKIP_AD: number;
const STREAM_MUTE: number;
const STREAM_TRANSFER: number;
const STREAM_VOLUME: number;
const UNFOLLOW: number;
/**
* Possible caption mimetype of text track.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.CaptionMimeType}
*/
export enum CaptionMimeType {
CEA608 = 'text/cea608',
TTML = 'application/ttml+xml',
TTML_MP4 = 'application/mp4',
VTT = 'text/vtt',
}
export type SeekResumeState = 'PLAYBACK_START' | 'PLAYBACK_PAUSE';
export type StreamingProtocolType = 'UNKNOWN' | 'MPEG_DASH' | 'HLS' | 'SMOOTH_STREAMING';
export type StreamType = 'BUFFERED' | 'LIVE' | 'NONE';
export type FocusState = 'IN_FOCUS' | 'NOT_IN_FOCUS';
export type ExtendedPlayerState = 'LOADING';
export type ErrorType = 'INVALID_PLAYER_STATE' | 'LOAD_FAILED' | 'LOAD_CANCELLED' | 'INVALID_REQUEST' | 'ERROR';
export type ErrorReason =
| 'INVALID_COMMAND'
| 'INVALID_PARAMS'
| 'INVALID_MEDIA_SESSION_ID'
| 'SKIP_LIMIT_REACHED'
| 'NOT_SUPPORTED'
| 'LANGUAGE_NOT_SUPPORTED'
| 'END_OF_QUEUE'
| 'APP_ERROR'
| 'AUTHENTICATION_EXPIRED'
| 'PREMIUM_ACCOUNT_REQUIRED'
| 'CONCURRENT_STREAM_LIMIT'
| 'PARENTAL_CONTROL_RESTRICTED'
| 'NOT_AVAILABLE_IN_REGION'
| 'CONTENT_ALREADY_PLAYING'
| 'INVALID_REQUEST'
| 'GENERIC_LOAD_ERROR';
export enum RepeatMode {
REPEAT_ALL = 'REPEAT_ALL',
REPEAT_ALL_AND_SHUFFLE = 'REPEAT_ALL_AND_SHUFFLE',
REPEAT_OFF = 'REPEAT_OFF',
REPEAT_SINGLE = 'REPEAT_SINGLE',
/**
* Commands supported by {@link framework.messages.MediaStatus.supportedMediaCommands}.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.Command}
*/
export enum Command {
PAUSE = 1,
SEEK = 2,
STREAM_VOLUME = 4,
STREAM_MUTE = 8,
QUEUE_NEXT = 64,
QUEUE_PREV = 128,
QUEUE_SHUFFLE = 256,
SKIP_AD = 512,
QUEUE_REPEAT_ALL = 1024,
QUEUE_REPEAT_ONE = 2048,
QUEUE_REPEAT = 3072,
EDIT_TRACKS = 4096,
PLAYBACK_RATE = 8192,
ALL_BASIC_MEDIA = 12303,
LIKE = 16384,
DISLIKE = 32768,
FOLLOW = 65536,
UNFOLLOW = 131072,
STREAM_TRANSFER = 262144,
}
export type IdleReason = 'CANCELLED' | 'INTERRUPTED' | 'FINISHED' | 'ERROR';
/**
* Possible types of container metadata.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.ContainerType}
*/
export enum ContainerType {
GENERIC_CONTAINER = 0,
AUDIOBOOK_CONTAINER = 1,
}
export type HlsSegmentFormat = 'aac' | 'ac3' | 'e_ac3' | 'fmp4' | 'mp3' | 'ts' | 'ts_aac';
/**
* Provides content filtering mode.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.ContentFilteringMode}
*/
export enum ContentFilteringMode {
FILTER_EXPLICIT = 'FILTER_EXPLICIT',
}
export type HdrType = 'sdr' | 'hdr' | 'dv';
/**
* Represents media error message reasons.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.ErrorReason}
*/
export enum ErrorReason {
APP_ERROR = 'APP_ERROR',
AUTHENTICATION_EXPIRED = 'AUTHENTICATION_EXPIRED',
CONCURRENT_STREAM_LIMIT = 'CONCURRENT_STREAM_LIMIT',
CONTENT_ALREADY_PLAYING = 'CONTENT_ALREADY_PLAYING',
CONTENT_FILTERED = 'CONTENT_FILTERED',
DUPLICATE_REQUEST_ID = 'DUPLICATE_REQUEST_ID',
END_OF_QUEUE = 'END_OF_QUEUE',
GENERIC_LOAD_ERROR = 'GENERIC_LOAD_ERROR',
INVALID_COMMAND = 'INVALID_COMMAND',
INVALID_MEDIA_SESSION_ID = 'INVALID_MEDIA_SESSION_ID',
INVALID_PARAMS = 'INVALID_PARAMS',
INVALID_REQUEST = 'INVALID_REQUEST',
LANGUAGE_NOT_SUPPORTED = 'LANGUAGE_NOT_SUPPORTED',
NOT_AVAILABLE_IN_REGION = 'NOT_AVAILABLE_IN_REGION',
NOT_SUPPORTED = 'NOT_SUPPORTED',
PARENTAL_CONTROL_RESTRICTED = 'PARENTAL_CONTROL_RESTRICTED',
PREMIUM_ACCOUNT_REQUIRED = 'PREMIUM_ACCOUNT_REQUIRED',
SKIP_LIMIT_REACHED = 'SKIP_LIMIT_REACHED',
VIDEO_DEVICE_REQUIRED = 'VIDEO_DEVICE_REQUIRED',
}
export type PlayStringId = 'FREE_TRIAL_ABOUT_TO_EXPIRE' | 'SUBSCRIPTION_ABOUT_TO_EXPIRE' | 'STREAM_HIJACKED';
/**
* Represents media error message types.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.ErrorType}
*/
export enum ErrorType {
ERROR = 'ERROR',
INVALID_PLAYER_STATE = 'INVALID_PLAYER_STATE',
INVALID_REQUEST = 'INVALID_REQUEST',
LOAD_CANCELLED = 'LOAD_CANCELLED',
LOAD_FAILED = 'LOAD_FAILED',
}
export type GetStatusOptions = 'NO_METADATA' | 'NO_QUEUE_ITEMS';
/**
* Extended player state information.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.ExtendedPlayerState}
*/
export enum ExtendedPlayerState {
LOADING = 'LOADING',
}
export type MessageType =
| 'MEDIA_STATUS'
| 'CLOUD_STATUS'
| 'QUEUE_CHANGE'
| 'QUEUE_ITEMS'
| 'QUEUE_ITEM_IDS'
| 'GET_STATUS'
| 'LOAD'
| 'PAUSE'
| 'STOP'
| 'PLAY'
| 'SKIP_AD'
| 'PLAY_AGAIN'
| 'SEEK'
| 'SET_PLAYBACK_RATE'
| 'SET_VOLUME'
| 'EDIT_TRACKS_INFO'
| 'EDIT_AUDIO_TRACKS'
| 'PRECACHE'
| 'PRELOAD'
| 'QUEUE_LOAD'
| 'QUEUE_INSERT'
| 'QUEUE_UPDATE'
| 'QUEUE_REMOVE'
| 'QUEUE_REORDER'
| 'QUEUE_NEXT'
| 'QUEUE_PREV'
| 'QUEUE_GET_ITEM_RANGE'
| 'QUEUE_GET_ITEMS'
| 'QUEUE_GET_ITEM_IDS'
| 'QUEUE_SHUFFLE'
| 'SET_CREDENTIALS'
| 'LOAD_BY_ENTITY'
| 'USER_ACTION'
| 'DISPLAY_STATUS'
| 'FOCUS_STATE'
| 'CUSTOM_COMMAND';
/**
* Focus states.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.FocusState}
*/
export enum FocusState {
IN_FOCUS = 'IN_FOCUS',
NOT_IN_FOCUS = 'NOT_IN_FOCUS',
}
/**
* The Get Status flag options determine the amount of data that must be included in the media status response.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.GetStatusOptions}
*/
export enum GetStatusOptions {
NO_METADATA = 1,
NO_QUEUE_ITEMS = 2,
}
/**
* Represents video High Dynamic Range (HDR) types.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.HdrType}
*/
export enum HdrType {
DV = 'dv',
HDR = 'hdr',
SDR = 'sdr',
}
/**
* Format of an HLS audio segment.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.HlsSegmentFormat}
*/
export enum HlsSegmentFormat {
AAC = 'aac',
AC3 = 'ac3',
E_AC3 = 'e_ac3',
FMP4 = 'fmp4',
MP3 = 'mp3',
TS = 'ts',
TS_AAC = 'ts_aac',
}
/**
* Format of an HLS audio segment.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.HlsSegmentFormat}
*/
export enum HlsVideoSegmentFormat {
FMP4 = 'fmp4',
MPEG2_TS = 'mpeg2_ts',
}
/**
* The reason for the player to be in IDLE state.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.IdleReason}
*/
export enum IdleReason {
CANCELLED = 'CANCELLED',
ERROR = 'ERROR',
FINISHED = 'FINISHED',
INTERRUPTED = 'INTERRUPTED',
}
/**
* The media category.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.MediaCategory}
*/
export enum MediaCategory {
AUDIO = 'AUDIO',
IMAGE = 'IMAGE',
VIDEO = 'VIDEO',
}
/**
* Represents media message types.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.MessageType}
*/
export enum MessageType {
CLOUD_STATUS = 'CLOUD_STATUS',
CUSTOM_COMMAND = 'CUSTOM_COMMAND',
CUSTOM_STATE = 'CUSTOM_STATE',
DISPLAY_STATUS = 'DISPLAY_STATUS',
EDIT_AUDIO_TRACKS = 'EDIT_AUDIO_TRACKS',
EDIT_TRACKS_INFO = 'EDIT_TRACKS_INFO',
EXECUTE_ACTION_SCRIPT = 'EXECUTE_ACTION_SCRIPT',
FOCUS_STATE = 'FOCUS_STATE',
GET_STATUS = 'GET_STATUS',
LOAD = 'LOAD',
LOAD_BY_ENTITY = 'LOAD_BY_ENTITY',
MEDIA_STATUS = 'MEDIA_STATUS',
PAUSE = 'PAUSE',
PLAY = 'PLAY',
PLAY_AGAIN = 'PLAY_AGAIN',
PLAY_STRING = 'PLAY_STRING',
PRECACHE = 'PRECACHE',
PRELOAD = 'PRELOAD',
QUEUE_CHANGE = 'QUEUE_CHANGE',
QUEUE_GET_ITEMS = 'QUEUE_GET_ITEMS',
QUEUE_GET_ITEM_IDS = 'QUEUE_GET_ITEM_IDS',
QUEUE_GET_ITEM_RANGE = 'QUEUE_GET_ITEM_RANGE',
QUEUE_INSERT = 'QUEUE_INSERT',
QUEUE_ITEMS = 'QUEUE_ITEMS',
QUEUE_ITEM_IDS = 'QUEUE_ITEM_IDS',
QUEUE_LOAD = 'QUEUE_LOAD',
QUEUE_NEXT = 'QUEUE_NEXT',
QUEUE_PREV = 'QUEUE_PREV',
QUEUE_REMOVE = 'QUEUE_REMOVE',
QUEUE_REORDER = 'QUEUE_REORDER',
QUEUE_SHUFFLE = 'QUEUE_SHUFFLE',
QUEUE_UPDATE = 'QUEUE_UPDATE',
REFRESH_CREDENTIALS = 'REFRESH_CREDENTIALS',
RESUME_SESSION = 'RESUME_SESSION',
SEEK = 'SEEK',
SESSION_STATE = 'SESSION_STATE',
SET_CREDENTIALS = 'SET_CREDENTIALS',
SET_PLAYBACK_RATE = 'SET_PLAYBACK_RATE',
SET_VOLUME = 'SET_VOLUME',
SHOW_REMOTE_CONTROL_OVERLAY = 'SHOW_REMOTE_CONTROL_OVERLAY',
SKIP_AD = 'SKIP_AD',
STOP = 'STOP',
STORE_SESSION = 'STORE_SESSION',
USER_ACTION = 'USER_ACTION',
}
/**
* Possible types of media metadata.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.MetadataType}
*/
export enum MetadataType {
GENERIC = 0,
MOVIE = 1,
TV_SHOW = 2,
MUSIC_TRACK = 3,
PHOTO = 4,
AUDIOBOOK_CHAPTER = 5,
}
/**
* Represents the player state.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.PlayerState}
*/
export enum PlayStringId {
FREE_TRIAL_ABOUT_TO_EXPIRE = 'FREE_TRIAL_ABOUT_TO_EXPIRE',
PLAYING_ALTERNATE_MIX = 'PLAYING_ALTERNATE_MIX',
STREAM_HIJACKED = 'STREAM_HIJACKED',
SUBSCRIPTION_ABOUT_TO_EXPIRE = 'SUBSCRIPTION_ABOUT_TO_EXPIRE',
}
/**
* Represents the player state.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.PlayerState}
*/
export enum PlayerState {
BUFFERING = 'BUFFERING',
IDLE = 'IDLE',
@@ -149,8 +260,22 @@ export enum PlayerState {
PLAYING = 'PLAYING',
}
export type QueueChangeType = 'INSERT' | 'REMOVE' | 'ITEMS_CHANGE' | 'UPDATE' | 'NO_CHANGE';
/**
* Queue change types used by QUEUE_CHANGE outgoing message.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.QueueChangeType}
*/
export enum QueueChangeType {
INSERT = 'INSERT',
ITEMS_CHANGE = 'ITEMS_CHANGE',
NO_CHANGE = 'NO_CHANGE',
REMOVE = 'REMOVE',
UPDATE = 'UPDATE',
}
/**
* Types of media container/queue.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.QueueType}
*/
export enum QueueType {
ALBUM = 'ALBUM',
AUDIOBOOK = 'AUDIOBOOK',
@@ -163,26 +288,148 @@ export enum QueueType {
VIDEO_PLAYLIST = 'VIDEO_PLAYLIST',
}
export enum ContainerType {
GENERIC_CONTAINER = 0,
AUDIOBOOK_CONTAINER = 1,
/**
* Behavior of the queue when all items have been played.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.RepeatMode}
*/
export enum RepeatMode {
REPEAT_ALL = 'REPEAT_ALL',
REPEAT_ALL_AND_SHUFFLE = 'REPEAT_ALL_AND_SHUFFLE',
REPEAT_OFF = 'REPEAT_OFF',
REPEAT_SINGLE = 'REPEAT_SINGLE',
}
export enum MetadataType {
GENERIC = 0,
MOVIE = 1,
TV_SHOW = 2,
MUSIC_TRACK = 3,
PHOTO = 4,
AUDIOBOOK_CHAPTER = 5,
/**
* Represents the playback state after a SEEK request.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.SeekResumeState}
*/
export enum SeekResumeState {
PLAYBACK_PAUSE = 'PLAYBACK_PAUSE',
PLAYBACK_START = 'PLAYBACK_START',
}
export enum MediaCategory {
/**
* The streaming protocol types.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.StreamingProtocolType}
*/
export enum StreamingProtocolType {
UNKNOWN = 0,
MPEG_DASH = 1,
HLS = 2,
SMOOTH_STREAMING = 3,
}
/**
* Represents the stream types.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.StreamType}
*/
export enum StreamType {
BUFFERED = 'BUFFERED',
LIVE = 'LIVE',
NONE = 'NONE',
}
/**
* Possible text track edge type.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TextTrackEdgeType}
*/
export enum TextTrackEdgeType {
DEPRESSED = 'DEPRESSED',
DROP_SHADOW = 'DROP_SHADOW',
NONE = 'NONE',
OUTLINE = 'OUTLINE',
RAISED = 'RAISED',
}
/**
* Text track font generic family.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TextTrackFontGenericFamily}
*/
export enum TextTrackFontGenericFamily {
CASUAL = 'CASUAL',
CURSIVE = 'CURSIVE',
MONOSPACED_SANS_SERIF = 'MONOSPACED_SANS_SERIF',
MONOSPACED_SERIF = 'MONOSPACED_SERIF',
SANS_SERIF = 'SANS_SERIF',
SERIF = 'SERIF',
SMALL_CAPITALS = 'SMALL_CAPITALS',
}
/**
* Possible text track font style.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TextTrackFontStyle}
*/
export enum TextTrackFontStyle {
BOLD = 'BOLD',
BOLD_ITALIC = 'BOLD_ITALIC',
ITALIC = 'ITALIC',
NORMAL = 'NORMAL',
}
/**
* Possible text track type (follows the HTML5 text track type definitions).
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TextTrackType}
*/
export enum TextTrackType {
CAPTIONS = 'CAPTIONS',
CHAPTERS = 'CHAPTERS',
DESCRIPTIONS = 'DESCRIPTIONS',
METADATA = 'METADATA',
SUBTITLES = 'SUBTITLES',
}
/**
* Text track window type.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TextTrackWindowType}
*/
export enum TextTrackWindowType {
NONE = 'NONE',
NORMAL = 'NORMAL',
ROUNDED_CORNERS = 'ROUNDED_CORNERS',
}
/**
* Possible media track type.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.TrackType}
*/
export enum TrackType {
AUDIO = 'AUDIO',
IMAGE = 'IMAGE',
TEXT = 'TEXT',
VIDEO = 'VIDEO',
}
/**
* User actions.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.UserAction}
*/
export enum UserAction {
DISLIKE = 'DISLIKE',
FLAG = 'FLAG',
FOLLOW = 'FOLLOW',
LIKE = 'LIKE',
SKIP_AD = 'SKIP_AD',
UNFOLLOW = 'UNFOLLOW',
}
/**
* Context information for the user action.
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.UserActionContext}
*/
export enum UserActionContext {
ALBUM = 'ALBUM',
ARTIST = 'ARTIST',
CHANNEL = 'CHANNEL',
COACH = 'COACH',
EPISODE = 'EPISODE',
MOVIE = 'MOVIE',
PLAYER = 'PLAYER',
PLAYLIST = 'PLAYLIST',
SERIES = 'SERIES',
TEAM = 'TEAM',
TRACK = 'TRACK',
UNKNOWN_CONTEXT = 'UNKNOWN_CONTEXT',
}
/**
* RefreshCredentials request data.
*/
@@ -893,7 +1140,7 @@ export class QueueData {
repeatMode?: RepeatMode,
items?: QueueItem[],
startIndex?: number,
startTime?: number
startTime?: number,
);
/**
@@ -1,5 +1,4 @@
import { MediaMetadata } from 'chromecast-caf-receiver/cast.framework.messages';
import { CastReceiverContext } from 'chromecast-caf-receiver/cast.framework';
import { MediaMetadata, LoadRequestData, StreamType, HlsSegmentFormat, Track, TrackType } from 'chromecast-caf-receiver/cast.framework.messages';
import { DetailedErrorCode, EventType } from 'chromecast-caf-receiver/cast.framework.events';
// The following test showcases how you can import individual types directly from the namespace:
@@ -17,7 +16,7 @@ breaksEvent.breakId = 'some-break-id';
breaksEvent.breakClipId = 'some-break-clip-id';
// tslint:disable-next-line
const track = new cast.framework.messages.Track(1, 'TEXT');
const track = new cast.framework.messages.Track(1, TrackType.TEXT);
// tslint:disable-next-line
const breakClip = new cast.framework.messages.BreakClip('id');
// tslint:disable-next-line
@@ -34,9 +33,8 @@ pManager.addEventListener(cast.framework.events.category.DEBUG, () => {});
pManager.addEventListener(cast.framework.events.category.FINE, () => {});
pManager.addEventListener(cast.framework.events.category.REQUEST, () => {});
pManager.addEventListener(
EventType.MEDIA_FINISHED,
(event: cast.framework.events.MediaFinishedEvent) =>
`${event.currentMediaTime} ${event.endedReason}`,
EventType.MEDIA_FINISHED,
(event: cast.framework.events.MediaFinishedEvent) => `${event.currentMediaTime} ${event.endedReason}`,
);
// tslint:disable-next-line
const ttManager = new cast.framework.TextTracksManager();
@@ -69,11 +67,11 @@ lrd.activeTrackIds = [1, 2];
lrd.media = {
tracks: [],
textTrackStyle: {},
streamType: 'BUFFERED',
streamType: StreamType.BUFFERED,
metadata: {
metadataType: cast.framework.messages.MetadataType.GENERIC,
},
hlsSegmentFormat: 'aac',
hlsSegmentFormat: HlsSegmentFormat.AAC,
contentId: 'id',
contentType: 'type',
breakClips: [breakClip],
@@ -134,4 +132,14 @@ cast.framework.CastReceiverContext.getInstance().addEventListener(
() => '¡hola!',
);
const loadingError = new cast.framework.events.ErrorEvent(DetailedErrorCode.LOAD_FAILED, "Loading failed!");
const loadingError = new cast.framework.events.ErrorEvent(DetailedErrorCode.LOAD_FAILED, 'Loading failed!');
cast.framework.CastReceiverContext.getInstance()
.getPlayerManager()
.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, () => new Promise((resolve, reject) => {}));
cast.framework.CastReceiverContext.getInstance()
.getPlayerManager()
.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, () => new LoadRequestData());
cast.framework.CastReceiverContext.getInstance()
.getPlayerManager()
.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, null);
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for non-npm package chromecast-caf-receiver 3.x
// Type definitions for non-npm package chromecast-caf-receiver 4.0
// Project: https://github.com/googlecast
// Definitions by: Sergio Arbeo <https://github.com/Serabe>
// Craig Bruce <https://github.com/craigrbruce>