mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Fix chrome.cast.media class implementations
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
export default class EditTracksInfoRequest {
|
export default class EditTracksInfoRequest {
|
||||||
constructor (opt_activeTrackIds = null, opt_textTrackStyle = null) {
|
constructor (opt_activeTrackIds = null, opt_textTrackStyle = null) {
|
||||||
this.activeTrackIds = opt_activeTrackIds;
|
this.activeTrackIds = opt_activeTrackIds;
|
||||||
|
this.requestId = 0;
|
||||||
this.textTrackStyle = opt_textTrackStyle;
|
this.textTrackStyle = opt_textTrackStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { MetadataType } from "../enums";
|
||||||
|
|
||||||
export default class GenericMediaMetadata {
|
export default class GenericMediaMetadata {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.images = [];
|
this.images = null;
|
||||||
this.metadataType = null;
|
this.metadataType = MetadataType.GENERIC;
|
||||||
this.releaseDate = null;
|
this.releaseDate = null;
|
||||||
|
this.releaseYear = null;
|
||||||
this.subtitle = null;
|
this.subtitle = null;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
this.type = MetadataType.GENERIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
export default class GetStatusRequest {
|
export default class GetStatusRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
castConsole.info('GetStatusRequest');
|
this.customData = null;
|
||||||
this.customData = {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
export default class LoadRequest {
|
export default class LoadRequest {
|
||||||
constructor (mediaInfo) {
|
constructor (mediaInfo) {
|
||||||
this.activeTrackIds = [];
|
this.activeTrackIds = null;
|
||||||
this.autoplay = false;
|
this.autoplay = true;
|
||||||
this.currentTime = 0;
|
this.currentTime = null;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.media = mediaInfo;
|
this.media = mediaInfo;
|
||||||
|
this.requestId = 0;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "LOAD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,26 +19,21 @@ export default class Media {
|
|||||||
constructor (sessionId, mediaSessionId, _internalSessionId) {
|
constructor (sessionId, mediaSessionId, _internalSessionId) {
|
||||||
this._id = uuid();
|
this._id = uuid();
|
||||||
|
|
||||||
this.activeTrackIds = [];
|
this.activeTrackIds = null;
|
||||||
this.currentItemId = 1;
|
this.currentItemId = null;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.currentTime = 0;
|
this.currentTime = 0;
|
||||||
this.idleReason = null;
|
this.idleReason = null;
|
||||||
this.items = [];
|
this.items = null;
|
||||||
this.loadingItemId = null;
|
this.loadingItemId = null;
|
||||||
this.media = null;
|
this.media = null;
|
||||||
this.mediaSessionId = mediaSessionId;
|
this.mediaSessionId = mediaSessionId;
|
||||||
this.playbackRate = 1;
|
this.playbackRate = 1;
|
||||||
this.playerState = PlayerState.PAUSED;
|
this.playerState = PlayerState.IDLE;
|
||||||
this.preloadedItemId = null;
|
this.preloadedItemId = null;
|
||||||
this.RepeatMode = RepeatMode.OFF;
|
this.repeatMode = RepeatMode.OFF;
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
this.supportedMediaCommands = [
|
this.supportedMediaCommands = [];
|
||||||
MediaCommand.PAUSE
|
|
||||||
, MediaCommand.SEEK
|
|
||||||
, MediaCommand.STREAM_VOLUME
|
|
||||||
, MediaCommand.STREAM_MUTE
|
|
||||||
];
|
|
||||||
this.volume = new Volume();
|
this.volume = new Volume();
|
||||||
|
|
||||||
this._sendMessage("bridge:bridgemedia/initialize", {
|
this._sendMessage("bridge:bridgemedia/initialize", {
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ export default class MediaInfo {
|
|||||||
constructor (contentId, contentType) {
|
constructor (contentId, contentType) {
|
||||||
this.contentId = contentId;
|
this.contentId = contentId;
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.duration = null;
|
this.duration = null;
|
||||||
this.metadata = null;
|
this.metadata = null;
|
||||||
this.streamType = StreamType.BUFFERED;
|
this.streamType = StreamType.BUFFERED;
|
||||||
this.textTrackStyle = null;
|
this.textTrackStyle = null;
|
||||||
this.tracks = [];
|
this.tracks = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { MetadataType } from "../enums";
|
||||||
|
|
||||||
export default class MovieMediaMetadata {
|
export default class MovieMediaMetadata {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.images = [];
|
this.images = null;
|
||||||
this.metadataType = null;
|
this.metadataType = MetadataType.MOVIE;
|
||||||
this.releaseDate = null;
|
this.releaseDate = null;
|
||||||
|
this.releaseYear = null;
|
||||||
this.studio = null;
|
this.studio = null;
|
||||||
this.subtitle = null;
|
this.subtitle = null;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
this.type = MetadataType.MOVIE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { MetadataType } from "../enums";
|
||||||
|
|
||||||
export default class MusicTrackMediaMetadata {
|
export default class MusicTrackMediaMetadata {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.albumArtist = null;
|
this.albumArtist = null;
|
||||||
this.albumName = null;
|
this.albumName = null;
|
||||||
this.artist = null;
|
this.artist = null;
|
||||||
|
this.artistName = null;
|
||||||
this.composer = null;
|
this.composer = null;
|
||||||
this.discNumber = null;
|
this.discNumber = null;
|
||||||
this.images = [];
|
this.images = null;
|
||||||
this.metadataType = this.type = 3;
|
this.metadataType = MetadataType.MUSIC_TRACK;
|
||||||
this.releaseDate = null;
|
this.releaseDate = null;
|
||||||
|
this.releaseYear = null;
|
||||||
this.songName = null;
|
this.songName = null;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
this.trackNumber = null;
|
this.trackNumber = null;
|
||||||
|
this.type = MetadataType.MUSIC_TRACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
export default class PauseRequest {
|
export default class PauseRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { MetadataType } from "../enums";
|
||||||
|
|
||||||
export default class PhotoMediaMetadata {
|
export default class PhotoMediaMetadata {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.artist = null;
|
this.artist = null;
|
||||||
this.creationDateTime = null;
|
this.creationDateTime = null;
|
||||||
this.height = null;
|
this.height = null;
|
||||||
this.images = [];
|
this.images = null;
|
||||||
this.latitude = null;
|
this.latitude = null;
|
||||||
this.location = null;
|
this.location = null;
|
||||||
this.longitude = null;
|
this.longitude = null;
|
||||||
this.metadataType = null;
|
this.metadataType = MetadataType.PHOTO;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
this.type = MetadataType.PHOTO;
|
||||||
this.width = null;
|
this.width = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
export default class PlayRequest {
|
export default class PlayRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
export default class QueueInsertItemsRequest {
|
export default class QueueInsertItemsRequest {
|
||||||
constructor (itemsToInsert) {
|
constructor (itemsToInsert) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.insertBefore = null;
|
this.insertBefore = null;
|
||||||
this.items = itemsToInsert;
|
this.items = itemsToInsert;
|
||||||
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "QUEUE_INSERT";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
export default class QueueItem {
|
export default class QueueItem {
|
||||||
constructor (mediaInfo) {
|
constructor (mediaInfo) {
|
||||||
this.activeTrackIds = [];
|
this.activeTrackIds = null;
|
||||||
this.autoplay = false;
|
this.autoplay = true;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.itemId = null;
|
this.itemId = null;
|
||||||
this.media = mediaInfo;
|
this.media = mediaInfo;
|
||||||
this.preloadTime = 10;
|
this.playbackDuration = null;
|
||||||
|
this.preloadTime = 0;
|
||||||
this.startTime = 0;
|
this.startTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import { RepeatMode } from "../enums";
|
|||||||
|
|
||||||
export default class QueueLoadRequest {
|
export default class QueueLoadRequest {
|
||||||
constructor (items) {
|
constructor (items) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.repeatMode = RepeatMode.OFF;
|
this.repeatMode = RepeatMode.OFF;
|
||||||
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
this.startIndex = 0;
|
this.startIndex = 0;
|
||||||
|
this.type = "QUEUE_LOAD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
export default class QueueRemoveItemsRequest {
|
export default class QueueRemoveItemsRequest {
|
||||||
constructor (itemIdsToRemove) {
|
constructor (itemIdsToRemove) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.itemIds = itemIdsToRemove;
|
this.itemIds = itemIdsToRemove;
|
||||||
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "QUEUE_REMOVE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
export default class QueueReorderItemsRequest {
|
export default class QueueReorderItemsRequest {
|
||||||
constructor (itemIdsToReorder) {
|
constructor (itemIdsToReorder) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.type = "QUEUE_REORDER";
|
|
||||||
this.insertBefore = null;
|
this.insertBefore = null;
|
||||||
this.itemIds = itemIdsToReorder;
|
this.itemIds = itemIdsToReorder;
|
||||||
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "QUEUE_REORDER";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
export default class QueueSetPropertiesRequest {
|
export default class QueueSetPropertiesRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.type = "QUEUE_UPDATE";
|
this.customData = null;
|
||||||
this.customData = {};
|
|
||||||
this.repeatMode = null;
|
this.repeatMode = null;
|
||||||
this.sessionId = null;
|
|
||||||
this.requestId = null;
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "QUEUE_UPDATE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
export default class QueueUpdateItemsRequest {
|
export default class QueueUpdateItemsRequest {
|
||||||
constructor () {
|
constructor (itemsToUpdate) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.items = [];
|
this.items = itemsToUpdate;
|
||||||
|
this.requestId = null;
|
||||||
|
this.sessionId = null;
|
||||||
|
this.type = "QUEUE_UPDATE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
export default class SeekRequest {
|
export default class SeekRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.currentTime = null;
|
this.currentTime = null;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.resumeState = null;
|
this.resumeState = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
export default class StopRequest {
|
export default class StopRequest {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
export default class TextTrackStyle {
|
export default class TextTrackStyle {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.backgroundColor = null;
|
this.backgroundColor = null;
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.edgeColor = null;
|
this.edgeColor = null;
|
||||||
this.edgeType = null;
|
this.edgeType = null;
|
||||||
this.fontFamily = null;
|
this.fontFamily = null;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
export default class Track {
|
export default class Track {
|
||||||
constructor (trackId, trackType) {
|
constructor (trackId, trackType) {
|
||||||
this.customData = {};
|
this.customData = null;
|
||||||
this.language = null;
|
this.language = null;
|
||||||
this.name = null;
|
this.name = null;
|
||||||
this.subtype = null;
|
this.subtype = null;
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
import { MetadataType } from "../enums";
|
||||||
|
|
||||||
export default class TvShowMediaMetadata {
|
export default class TvShowMediaMetadata {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.episode = null;
|
this.episode = null;
|
||||||
this.images = [];
|
this.episodeNumber = null;
|
||||||
this.metadataType = null;
|
this.episodeTitle = null;
|
||||||
|
this.images = null;
|
||||||
|
this.metadataType = MetadataType.TV_SHOW;
|
||||||
this.originalAirdate = null;
|
this.originalAirdate = null;
|
||||||
|
this.releaseYear = null;
|
||||||
this.season = null;
|
this.season = null;
|
||||||
|
this.seasonNumber = null;
|
||||||
this.seriesTitle = null;
|
this.seriesTitle = null;
|
||||||
this.title = null;
|
this.title = null;
|
||||||
|
this.type = MetadataType.TV_SHOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
export default class VolumeRequest {
|
export default class VolumeRequest {
|
||||||
constructor (volume) {
|
constructor (volume) {
|
||||||
|
this.customData = null;
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
this.customData = {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ describe("chrome.cast.media.Media", () => {
|
|||||||
|
|
||||||
expect(media.activeTrackIds).toBe(null);
|
expect(media.activeTrackIds).toBe(null);
|
||||||
expect(media.currentItemId).toBe(null);
|
expect(media.currentItemId).toBe(null);
|
||||||
|
expect(media.currentTime).toBe(0);
|
||||||
expect(media.customData).toBe(null);
|
expect(media.customData).toBe(null);
|
||||||
expect(media.idleReason).toBe(null);
|
expect(media.idleReason).toBe(null);
|
||||||
expect(media.items).toBe(null);
|
expect(media.items).toBe(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user