diff --git a/client/src/Player.ts b/client/src/Player.ts index 424ff8a..77aaffa 100644 --- a/client/src/Player.ts +++ b/client/src/Player.ts @@ -3,7 +3,6 @@ import {InterjectionPlayer} from "./interjection/Player"; import {BufferControl} from "./live/BufferCtrl"; import {MseWrapper} from "./live/MseWrapper"; import {API} from "live-video-streamer-common"; -import {assertType} from "@ckitching/typescript-is"; import {EventDispatcher} from "./EventDispatcher"; /** @@ -324,7 +323,6 @@ export class Player extends EventDispatcher(j); this.onJsonObject(j); break; case API.ControlChunkType.userJsonObject: @@ -356,8 +354,7 @@ export class Player extends EventDispatcher(channelIndex); + const channelIndex = await channelIndexResponse.json() as API.ChannelIndex; if (!first && JSON.stringify(this.channelIndex) !== JSON.stringify(this.channelIndex)) { // The channel index has changed. diff --git a/client/src/interjection/Player.ts b/client/src/interjection/Player.ts index 7973ada..9d54f15 100644 --- a/client/src/interjection/Player.ts +++ b/client/src/interjection/Player.ts @@ -2,7 +2,6 @@ import {MseWrapper} from "./MseWrapper"; import {Interjection, InterjectionSelection} from "./Selection"; import {waitForPts} from "../Util" import {API, sleep} from "live-video-streamer-common"; -import {assertType} from "@ckitching/typescript-is"; import {EventDispatcher} from "../EventDispatcher"; import {PlayerErrorEvent} from "../Player"; @@ -102,7 +101,6 @@ export class InterjectionPlayer extends EventDispatcher => { // Download the interjection set metadata. const j = await this.download(`${this.request.setUrl}/interjection-set.json`, "json", "set metadata"); - assertType(j); this.interjectionSet = j; // Select and show the first selection of interjections. @@ -286,7 +284,6 @@ export class InterjectionPlayer extends EventDispatcher(interjectionMetadata); /* Enqueue the downloading of the interjection's streams. */ const numSegments = Math.ceil(interjectionMetadata.contentDuration / interjectionMetadata.segmentDuration); diff --git a/client/src/live/MseWrapper.ts b/client/src/live/MseWrapper.ts index 377a8c5..9163b25 100644 --- a/client/src/live/MseWrapper.ts +++ b/client/src/live/MseWrapper.ts @@ -1,6 +1,5 @@ import {TimestampInfo} from "./Deinterleave"; import {API, waitForEvent} from "live-video-streamer-common"; -import {assertType} from "@ckitching/typescript-is"; import {SegmentDownloader, ReceivedInfo} from "./SegmentDownloader"; import {getMediaSource} from "../MediaSource"; import {getFullMimeType, Stream, StreamStartEvent} from "../Stream"; @@ -174,17 +173,11 @@ export class MseWrapper extends EventDispatcher } } - private async setupStreams(manifest: string, videoInfo: any, videoInit: ArrayBuffer, audioInfo: any = null, + private async setupStreams(manifest: string, videoInfo: API.SegmentIndexDescriptor, videoInit: ArrayBuffer, audioInfo: any = null, audioInit: ArrayBuffer | null = null): Promise { /* Clean up whatever already existed. */ this.cleanup(); - /* Validate. */ - assertType(videoInfo); - if (audioInfo !== null) { - assertType(audioInfo); - } - /* Create afresh. */ this.videoMediaSource = getMediaSource(); this.video.src = URL.createObjectURL(this.videoMediaSource); diff --git a/client/src/live/SegmentDownloader.ts b/client/src/live/SegmentDownloader.ts index 258bd63..0553d42 100644 --- a/client/src/live/SegmentDownloader.ts +++ b/client/src/live/SegmentDownloader.ts @@ -1,7 +1,6 @@ import {API, assertNonNull} from "live-video-streamer-common"; import {Deinterleaver} from "./Deinterleave"; import {Stream} from "../Stream"; -import {assertType} from "@ckitching/typescript-is"; import {MseControlChunkEvent, MseEventMap, MseReceivedEvent, MseTimestampEvent} from "./MseWrapper"; import {EventDispatcher} from "../EventDispatcher"; import {PlayerErrorEvent} from "../Player"; @@ -71,8 +70,7 @@ export class SegmentDownloader extends EventDispatcher(newInfo); + const newInfo = await response.json(); this.setSegmentDownloadSchedule(newInfo); } catch (ex: any) { const e = ex as Error;