mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Improvements for chromecast-caf-receiver package. (#35703)
* Add cast.framework.events.category namespace * Make cast.framework.messages.Command its own namespace * Update HlsSegmentFormat values and add missing ones. * Add cast global * Add a few tests * Lint * Bump version
This commit is contained in:
committed by
Sheetal Nandi
parent
32db7fc4ed
commit
ca6a7fe49a
@@ -0,0 +1,20 @@
|
||||
import { EventType } from "./cast.framework.events";
|
||||
|
||||
export as namespace category;
|
||||
|
||||
/**
|
||||
* Includes high-level events. These events fire less frequently and are the most likely to be useful for debugging.
|
||||
*/
|
||||
export const CORE: EventType[];
|
||||
/**
|
||||
* Includes low-level events. These events fire somewhat frequently, and usually indicate clip-level loading / ready statuses.
|
||||
*/
|
||||
export const DEBUG: EventType[];
|
||||
/**
|
||||
* Includes low-level events that trigger frequently.
|
||||
*/
|
||||
export const FINE: EventType[];
|
||||
/**
|
||||
* Includes all events that represent a request made to the receiver.
|
||||
*/
|
||||
export const REQUEST: EventType[];
|
||||
@@ -4,8 +4,11 @@ import {
|
||||
Track,
|
||||
MediaStatus
|
||||
} from "./cast.framework.messages";
|
||||
import * as category from "./cast.framework.events.category";
|
||||
|
||||
export as namespace events
|
||||
export import category = category;
|
||||
|
||||
export as namespace events;
|
||||
export type EventType =
|
||||
| "ALL"
|
||||
| "ABORT"
|
||||
@@ -146,11 +149,7 @@ export class SegmentDownloadedEvent extends Event {
|
||||
* Event data for all events that represent requests made to the receiver.
|
||||
*/
|
||||
export class RequestEvent extends Event {
|
||||
constructor(
|
||||
type: EventType,
|
||||
requestData?: RequestData,
|
||||
senderId?: string
|
||||
);
|
||||
constructor(type: EventType, requestData?: RequestData, senderId?: string);
|
||||
|
||||
/**
|
||||
* The data that was sent with the request.
|
||||
|
||||
+38
-23
@@ -1,6 +1,6 @@
|
||||
import { Event, DetailedErrorCode } from "./cast.framework.events";
|
||||
|
||||
export as namespace messages
|
||||
export as namespace messages;
|
||||
export type UserAction =
|
||||
| "LIKE"
|
||||
| "DISLIKE"
|
||||
@@ -51,16 +51,27 @@ export type TextTrackEdgeType =
|
||||
| "RAISED"
|
||||
| "DEPRESSED";
|
||||
|
||||
export type Command =
|
||||
| "PAUSE"
|
||||
| "SEEK"
|
||||
| "STREAM_VOLUME"
|
||||
| "STREAM_MUTE"
|
||||
| "ALL_BASIC_MEDIA"
|
||||
| "QUEUE_NEXT"
|
||||
| "QUEUE_PREV"
|
||||
| "QUEUE_SHUFFLE"
|
||||
| "SKIP_AD";
|
||||
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;
|
||||
}
|
||||
|
||||
export type SeekResumeState = "PLAYBACK_START" | "PLAYBACK_PAUSE";
|
||||
|
||||
@@ -109,9 +120,16 @@ export type RepeatMode =
|
||||
|
||||
export type IdleReason = "CANCELLED" | "INTERRUPTED" | "FINISHED" | "ERROR";
|
||||
|
||||
export type HlsSegmentFormat = "AAC" | "AC3" | "MP3" | "TS" | "TS_AAC";
|
||||
export type HlsSegmentFormat =
|
||||
| "aac"
|
||||
| "ac3"
|
||||
| "e_ac3"
|
||||
| "fmp4"
|
||||
| "mp3"
|
||||
| "ts"
|
||||
| "ts_aac";
|
||||
|
||||
export type HdrType = "SDR" | "HDR" | "DV";
|
||||
export type HdrType = "sdr" | "hdr" | "dv";
|
||||
|
||||
export type PlayStringId =
|
||||
| "FREE_TRIAL_ABOUT_TO_EXPIRE"
|
||||
@@ -1420,12 +1438,12 @@ export interface MediaInformation {
|
||||
* The media metadata.
|
||||
*/
|
||||
metadata?:
|
||||
| MediaMetadata
|
||||
| GenericMediaMetadata
|
||||
| MovieMediaMetadata
|
||||
| MusicTrackMediaMetadata
|
||||
| PhotoMediaMetadata
|
||||
| TvShowMediaMetadata;
|
||||
| MediaMetadata
|
||||
| GenericMediaMetadata
|
||||
| MovieMediaMetadata
|
||||
| MusicTrackMediaMetadata
|
||||
| PhotoMediaMetadata
|
||||
| TvShowMediaMetadata;
|
||||
|
||||
/**
|
||||
* The stream type.
|
||||
@@ -1671,10 +1689,7 @@ export class FetchItemsRequestData extends RequestData {
|
||||
* Extended media status information
|
||||
*/
|
||||
export class ExtendedMediaStatus {
|
||||
constructor(
|
||||
playerState: MediaInformation,
|
||||
opt_media?: MediaInformation
|
||||
);
|
||||
constructor(playerState: MediaInformation, opt_media?: MediaInformation);
|
||||
|
||||
media: MediaInformation;
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ const rEvent = new cast.framework.events.RequestEvent("BITRATE_CHANGED", {
|
||||
// tslint:disable-next-line
|
||||
const pManager = new cast.framework.PlayerManager();
|
||||
pManager.addEventListener("STALLED", () => {});
|
||||
pManager.addEventListener(cast.framework.events.category.CORE, () => {});
|
||||
pManager.addEventListener(cast.framework.events.category.DEBUG, () => {});
|
||||
pManager.addEventListener(cast.framework.events.category.FINE, () => {});
|
||||
pManager.addEventListener(cast.framework.events.category.REQUEST, () => {});
|
||||
// tslint:disable-next-line
|
||||
const ttManager = new cast.framework.TextTracksManager();
|
||||
// tslint:disable-next-line
|
||||
@@ -62,7 +66,7 @@ const lrd: cast.framework.messages.LoadRequestData = {
|
||||
textTrackStyle: {},
|
||||
streamType: "BUFFERED",
|
||||
metadata: { metadataType: "GENERIC" },
|
||||
hlsSegmentFormat: "AAC",
|
||||
hlsSegmentFormat: "aac",
|
||||
contentId: "id",
|
||||
contentType: "type",
|
||||
breakClips: [breakClip],
|
||||
@@ -110,3 +114,8 @@ const pData: cast.framework.ui.PlayerData = {
|
||||
// tslint:disable-next-line
|
||||
const binder = new cast.framework.ui.PlayerDataBinder(pData);
|
||||
binder.addEventListener("ANY_CHANGE", e => {});
|
||||
// tslint:disable-next-line
|
||||
const supportedCommands: number =
|
||||
cast.framework.messages.Command.ALL_BASIC_MEDIA |
|
||||
cast.framework.messages.Command.QUEUE_NEXT |
|
||||
cast.framework.messages.Command.QUEUE_PREV;
|
||||
|
||||
+5
-3
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/googlecast
|
||||
// Definitions by: Craig Bruce <https://github.com/craigrbruce>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
/// <reference path="./cast.framework.d.ts" />
|
||||
/// <reference path="./cast.framework.breaks.d.ts" />
|
||||
@@ -12,13 +12,15 @@
|
||||
/// <reference path="./cast.framework.ui.d.ts" />
|
||||
|
||||
import * as framework from "./cast.framework";
|
||||
import { PlayerDataChangedEvent } from './cast.framework.ui';
|
||||
import { Event } from './cast.framework.events';
|
||||
import { PlayerDataChangedEvent } from "./cast.framework.ui";
|
||||
import { Event } from "./cast.framework.events";
|
||||
|
||||
export as namespace cast;
|
||||
export { framework };
|
||||
|
||||
declare global {
|
||||
const cast: { framework: typeof framework };
|
||||
|
||||
type EventHandler = (event: Event) => void;
|
||||
type PlayerDataChangedEventHandler = (
|
||||
event: PlayerDataChangedEvent
|
||||
|
||||
Reference in New Issue
Block a user