diff --git a/packages/mux-video/src/base.ts b/packages/mux-video/src/base.ts index 1c9ac9e0..4db62420 100644 --- a/packages/mux-video/src/base.ts +++ b/packages/mux-video/src/base.ts @@ -696,6 +696,12 @@ export class MuxVideoBaseElement extends CustomVideoElement implements IMuxVideo } async addCuePoints(cuePoints: CuePoint[]) { + if (!this.nativeEl.currentSrc) { + console.warn( + 'addCuePoints() was called before the media element has loaded. ' + + 'Wait for the loadstart event before calling addCuePoints().' + ); + } return addCuePoints(this.nativeEl, cuePoints); } @@ -708,6 +714,12 @@ export class MuxVideoBaseElement extends CustomVideoElement implements IMuxVideo } async addChapters(chapters: Chapter[]) { + if (!this.nativeEl.currentSrc) { + console.warn( + 'addChapters() was called before the media element has loaded. ' + + 'Wait for the loadstart event before calling addChapters().' + ); + } return addChapters(this.nativeEl, chapters); }