Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mux-video, mux-video-react, mux-audio, mux-audio-react, mux-player, mux-player-react): Expose element name and version via exports and statics for web components. #1017

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/mux-audio-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export type Props = Omit<
> &
MuxMediaProps;

const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-audio-react';
export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-audio-react';

const MuxAudio = React.forwardRef<HTMLAudioElement | undefined, Partial<Props>>((props, ref) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
12 changes: 10 additions & 2 deletions packages/mux-audio/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ export const Attributes = {

const AttributeNameValues = Object.values(Attributes);

const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-audio';
export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-audio';

class MuxAudioElement extends CustomAudioElement implements Partial<MuxMediaProps> {
static get NAME() {
return playerSoftwareName;
}

static get VERSION() {
return playerSoftwareVersion;
}

static get observedAttributes() {
return [...AttributeNameValues, ...(CustomAudioElement.observedAttributes ?? [])];
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mux-player-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ const usePlayer = (
return [remainingProps];
};

const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-player-react';
export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-player-react';

const MuxPlayer = React.forwardRef<
MuxPlayerRefAttributes,
Expand Down
13 changes: 11 additions & 2 deletions packages/mux-player/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ function getMetadataFromAttrs(el: MuxPlayerElement) {
const MuxVideoAttributeNames = Object.values(MuxVideoAttributes);
const VideoAttributeNames = Object.values(VideoAttributes);
const PlayerAttributeNames = Object.values(PlayerAttributes);
const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-player';

export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-player';

const initialState = {
dialog: undefined,
Expand Down Expand Up @@ -295,6 +296,14 @@ class MuxPlayerElement extends VideoApiElement implements MuxPlayerElement {
},
};

static get NAME() {
return playerSoftwareName;
}

static get VERSION() {
return playerSoftwareVersion;
}

static get observedAttributes() {
return [
...(VideoApiElement.observedAttributes ?? []),
Expand Down
4 changes: 2 additions & 2 deletions packages/mux-video-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export type Props = Omit<
> &
MuxMediaProps;

const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-video-react';
export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-video-react';

const MuxVideo = React.forwardRef<HTMLVideoElement | undefined, Partial<Props>>((props, ref) => {
const {
Expand Down
12 changes: 10 additions & 2 deletions packages/mux-video/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ export const Attributes = {

const AttributeNameValues = Object.values(Attributes);

const playerSoftwareVersion = getPlayerVersion();
const playerSoftwareName = 'mux-video';
export const playerSoftwareVersion = getPlayerVersion();
export const playerSoftwareName = 'mux-video';

class MuxVideoBaseElement extends CustomVideoElement implements Partial<MuxMediaProps> {
static get NAME() {
return playerSoftwareName;
}

static get VERSION() {
return playerSoftwareVersion;
}

static get observedAttributes() {
return [...AttributeNameValues, ...(CustomVideoElement.observedAttributes ?? [])];
}
Expand Down
Loading