Skip to content

Commit

Permalink
fix: media-tracks types not polluting global
Browse files Browse the repository at this point in the history
HTMLMediaElement
  • Loading branch information
luwes committed Dec 18, 2023
1 parent 5d45a8f commit dfb06a4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/mux-player/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"forceConsistentCasingInFileNames": true,
"typeRoots": ["node_modules/@types", "../../types/media-chrome.d.ts"]
},
"include": ["src/**/*", "../../types/media-chrome.d.ts"]
"include": ["src/**/*", "../../types/media-chrome.d.ts", "../../node_modules/media-tracks/dist/global.d.ts"]
}
2 changes: 1 addition & 1 deletion packages/mux-video/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@mux/playback-core": "0.22.0",
"castable-video": "~1.0.5",
"custom-media-element": "~1.1.3",
"media-tracks": "~0.2.4"
"media-tracks": "~0.3.0"
},
"devDependencies": {
"@mux/test-esm-exports": "0.1.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/mux-video/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import type {
PlaybackCore,
PlaybackEngine,
Autoplay,
MediaTracks,
ExtensionMimeTypeMap,
ValueOf,
MaxResolutionValue,
Expand Down Expand Up @@ -525,7 +524,7 @@ class MuxVideoBaseElement extends CustomVideoElement implements Partial<MuxMedia
}

load() {
this.#core = initialize(this as Partial<MuxMediaProps> & MediaTracks, this.nativeEl, this.#core);
this.#core = initialize(this as Partial<MuxMediaProps>, this.nativeEl, this.#core);
}

unload() {
Expand Down
8 changes: 0 additions & 8 deletions packages/playback-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/// <reference path="../dist/types/mux-embed.d.ts" />
import type { Options } from 'mux-embed';
import type { MediaError } from './errors';
import type { VideoTrack, AudioTrack, VideoTrackList, AudioTrackList } from 'media-tracks';
import type { HlsConfig } from 'hls.js';
import type Hls from 'hls.js';

Expand Down Expand Up @@ -178,13 +177,6 @@ export type MuxMediaPropTypes = {
_hlsConfig?: Partial<HlsConfig>;
};

export interface MediaTracks {
videoTracks: VideoTrackList;
audioTracks: AudioTrackList;
addAudioTrack(kind: string, label?: string, language?: string): AudioTrack;
addVideoTrack(kind: string, label?: string, language?: string): VideoTrack;
}

export type HTMLMediaElementProps = Partial<Pick<HTMLMediaElement, 'src' | 'preload' | 'error' | 'seekable'>>;

export type MuxMediaProps = HTMLMediaElementProps & MuxMediaPropTypes;
Expand Down
2 changes: 1 addition & 1 deletion packages/playback-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"forceConsistentCasingInFileNames": true,
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/*"]
"include": ["src/**/*", "../../node_modules/media-tracks/dist/global.d.ts"]
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10541,10 +10541,10 @@ media-chrome@~2.0.1:
resolved "https://registry.yarnpkg.com/media-chrome/-/media-chrome-2.0.1.tgz#f7d6af2c82fb80d7f82ed50a86fad2216c66ceee"
integrity sha512-6hoC5OY993t4o/YKYXn7YoWUAKG1UFAhnDXNN6kRRa5mnuL+Cwct/2Md16S4jjmTSmN5XjhEWwfCVM5NLHavOA==

media-tracks@~0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/media-tracks/-/media-tracks-0.2.4.tgz#aee3bd69bdc8f246b44af5245f7b0a68d4c94540"
integrity sha512-P/TbDCYTFH5gxpQ6r99iabXOwjsFwzKRgK7wiwo64Ii6nHXYhHtwEP7A7ufmEKxkNCoHc4j3Z2hvs+lXL4wPeQ==
media-tracks@~0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-tracks/-/media-tracks-0.3.0.tgz#0f16a611268ceb1139800634be97c58ce9d7e45c"
integrity sha512-kicD8eOFwe6nD7jn7iM/0yuLzWuo6abWHURYwY7NhxL1dBif+lt0on4rLTs6VhKwAEE/BjT3wr+0vn1w8SBpag==

media-typer@0.3.0:
version "0.3.0"
Expand Down

0 comments on commit dfb06a4

Please sign in to comment.