Improve MetadataType definition in @types/chromecast-caf-receiver (#35929)

* Improve MetadataType definition.

According to [documentation,
MetadataType](https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages#.MetadataType)
is a number, not a string.

* Remove import
This commit is contained in:
Sergio Arbeo 2019-06-04 22:09:36 +02:00 committed by Andrew Casey
parent 230fe446e2
commit 1bc579b8e7
2 changed files with 18 additions and 10 deletions

View File

@ -196,12 +196,14 @@ export type QueueType =
| "LIVE_TV"
| "MOVIE";
export type MetadataType =
| "GENERIC"
| "MOVIE"
| "TV_SHOW"
| "MUSIC_TRACK"
| "PHOTO";
export enum MetadataType {
GENERIC = 0,
MOVIE = 1,
TV_SHOW = 2,
MUSIC_TRACK = 3,
PHOTO = 4,
AUDIOBOOK_CHAPTER = 5
}
/**
* RefreshCredentials request data.

View File

@ -2,8 +2,10 @@ import { MediaMetadata } from "chromecast-caf-receiver/cast.framework.messages";
// The following test showcases how you can import individual types directly from the namespace:
const mediaMetadata = new MediaMetadata("GENERIC");
mediaMetadata.metadataType = "TV_SHOW";
const mediaMetadata = new MediaMetadata(
cast.framework.messages.MetadataType.GENERIC
);
mediaMetadata.metadataType = cast.framework.messages.MetadataType.TV_SHOW;
// The following tests showcase how you can globally access 'cast' types using
// the nested namespace style. This is the preferred method as it
@ -65,7 +67,9 @@ const lrd: cast.framework.messages.LoadRequestData = {
tracks: [],
textTrackStyle: {},
streamType: "BUFFERED",
metadata: { metadataType: "GENERIC" },
metadata: {
metadataType: cast.framework.messages.MetadataType.GENERIC
},
hlsSegmentFormat: "aac",
contentId: "id",
contentType: "type",
@ -100,7 +104,9 @@ const pData: cast.framework.ui.PlayerData = {
isPlayingBreak: false,
isSeeking: true,
// tslint:disable-next-line
metadata: new cast.framework.messages.MediaMetadata("GENERIC"),
metadata: new cast.framework.messages.MediaMetadata(
cast.framework.messages.MetadataType.GENERIC
),
nextSubtitle: "sub",
nextThumbnailUrl: "url",
nextTitle: "title",