Skip to content

Commit

Permalink
restore window object where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
SivanA-Kaltura committed Jan 7, 2024
1 parent 2aedc85 commit c0728f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/track/text-track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function getActiveCues(textTrackCueList: TextTrackCueList): Array<VTTCue> {
//Normalize cues to be of type of VTT model
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if ((VTTCue && cue instanceof VTTCue) || (DataCue && cue instanceof window.DataCue)) {
if ((VTTCue && cue instanceof VTTCue) || (window.DataCue && cue instanceof window.DataCue)) {
normalizedCues.push(cue);
} else if (TextTrackCue && cue instanceof TextTrackCue) {
try {
Expand All @@ -110,4 +110,4 @@ function getActiveCues(textTrackCueList: TextTrackCueList): Array<VTTCue> {
return normalizedCues;
}

export {getActiveCues , TextTrack as PKTextTrack};
export { getActiveCues, TextTrack as PKTextTrack };
12 changes: 6 additions & 6 deletions src/utils/resize-watcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FakeEvent } from '../event/fake-event';
import { FakeEventTarget } from '../event/fake-event-target';
import {CustomEventType} from '../event/event-type';
import { CustomEventType } from '../event/event-type';

/**
* A Factory class to create a resize observer for the player.
Expand Down Expand Up @@ -31,16 +31,16 @@ class ResizeWatcher extends FakeEventTarget {
* @returns {void}
*/
public init(el: HTMLElement): void {
if (this._observer) return
if (this._observer) return;
this._el = el;
ResizeObserver ? this._createNativeObserver() : this._createIframeObserver();
window.ResizeObserver ? this._createNativeObserver() : this._createIframeObserver();
if (this._el instanceof HTMLElement && this._observer) {
(this._observer as ResizeObserver | IFrameObserver).observe(this._el);
}
}

private _createNativeObserver(): void {
this._observer = new ResizeObserver(entries => {
this._observer = new ResizeObserver((entries) => {
entries.forEach(() => {
this._triggerResize();
});
Expand All @@ -65,7 +65,7 @@ const IFRAME_CLASS_NAME: string = 'playkit-size-iframe';
* @param {Function} callback - the function to be called when a resize event is detected.
*/
class IFrameObserver {
private _observersStore: {[id: number]: HTMLIFrameElement} = {};
private _observersStore: { [id: number]: HTMLIFrameElement } = {};
private _onChangeCallback: () => void;

constructor(callback: () => void) {
Expand Down Expand Up @@ -112,4 +112,4 @@ class IFrameObserver {
}
}

export {ResizeWatcher};
export { ResizeWatcher };

0 comments on commit c0728f4

Please sign in to comment.