New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mux/mux-player

Package Overview
Dependencies
Maintainers
2
Versions
601
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mux/mux-player - npm Package Compare versions

Comparing version 0.1.0-canary.10-030fdc6 to 0.1.0-canary.10-0563c30

src/media-theme-mux/icons/cast-enter.svg

16

CHANGELOG.md

@@ -6,2 +6,18 @@ # Change Log

# [0.1.0-beta.24](https://github.com/muxinc/elements/compare/@mux/mux-player@0.1.0-beta.23...@mux/mux-player@0.1.0-beta.24) (2022-07-21)
### Bug Fixes
- add Mux flavor cast icon & fix xs size bug ([#299](https://github.com/muxinc/elements/issues/299)) ([8374ff1](https://github.com/muxinc/elements/commit/8374ff17e294cbe3ad899749ab0361b78ffe0274))
- **mux-player:** Clean up how metadata is set from mux-player to underlying mux-video element. Force upgrades and init when setting metadata. ([d3b2347](https://github.com/muxinc/elements/commit/d3b2347b1d4d7ebbbd882879f69e9d082f12dd80))
- upgrade MC to v0.8.0 and adjust time range styles ([#294](https://github.com/muxinc/elements/issues/294)) ([030fdc6](https://github.com/muxinc/elements/commit/030fdc649517a538fc89c5b3d9edca42e58634ef))
- upgrade MC v0.8.1 ([#298](https://github.com/muxinc/elements/issues/298)) ([fc4a74c](https://github.com/muxinc/elements/commit/fc4a74cfaadf90ee8d4ed89751755d56e77df79e))
### Features
- add ability to choose a Media Theme via attribute ([#269](https://github.com/muxinc/elements/issues/269)) ([77d0386](https://github.com/muxinc/elements/commit/77d0386606d5ecccb7c322ce487c9287d16374fd))
- add defaultMuted, defaultPlaybackRate props ([#252](https://github.com/muxinc/elements/issues/252)) ([1a72165](https://github.com/muxinc/elements/commit/1a7216545cba27b34bc743cf5dd6225d4dcae738))
- **mux-player:** Add textTracks prop alongside add/remove tracks methods. ([c041a72](https://github.com/muxinc/elements/commit/c041a72ce414fc52fcd90e22cc7730ef2e349c31))
- **playback-core, mux-player:** Add support to removeTextTrack. Remove all identified tracks on hls destroy. Add methods to mux-player. ([d090b06](https://github.com/muxinc/elements/commit/d090b060a8b8b3772e74762176af9881299bf894))
# [0.1.0-beta.23](https://github.com/muxinc/elements/compare/@mux/mux-player@0.1.0-beta.22...@mux/mux-player@0.1.0-beta.23) (2022-07-11)

@@ -8,0 +24,0 @@

2

dist/types-ts3.4/media-theme-mux/icons.d.ts
export declare const Airplay: () => import("@github/template-parts").TemplateInstance;
export declare const CaptionsOff: () => import("@github/template-parts").TemplateInstance;
export declare const CaptionsOn: () => import("@github/template-parts").TemplateInstance;
export declare const CastEnter: () => import("@github/template-parts").TemplateInstance;
export declare const CastExit: () => import("@github/template-parts").TemplateInstance;
export declare const FullscreenEnter: () => import("@github/template-parts").TemplateInstance;

@@ -5,0 +7,0 @@ export declare const FullscreenExit: () => import("@github/template-parts").TemplateInstance;

@@ -11,2 +11,21 @@ import { MediaTheme } from 'media-chrome';

};
export declare const parts: {
mediaChrome: string;
centerPlay: string;
centerSeekBackward: string;
centerSeekForward: string;
play: string;
seekBackward: string;
seekForward: string;
mute: string;
captions: string;
airplay: string;
pip: string;
fullscreen: string;
cast: string;
playbackRate: string;
volumeRange: string;
timeRange: string;
timeDisplay: string;
};
export default class MediaThemeMux extends MediaTheme {

@@ -13,0 +32,0 @@ static readonly observedAttributes: string[];

1

dist/types-ts3.4/template.d.ts

@@ -1,2 +0,1 @@

import './media-theme-mux/media-theme-mux';
import './dialog';

@@ -3,0 +2,0 @@ import { MuxTemplateProps } from './types';

@@ -46,2 +46,3 @@ import MuxVideoElement from '@mux/mux-video';

playbackRate: number;
defaultPlaybackRate: number;
crossOrigin: string | null;

@@ -51,2 +52,3 @@ autoplay: boolean;

muted: boolean;
defaultMuted: boolean;
playsInline: boolean;

@@ -53,0 +55,0 @@ preload: string | null;

export declare const Airplay: () => import("@github/template-parts").TemplateInstance;
export declare const CaptionsOff: () => import("@github/template-parts").TemplateInstance;
export declare const CaptionsOn: () => import("@github/template-parts").TemplateInstance;
export declare const CastEnter: () => import("@github/template-parts").TemplateInstance;
export declare const CastExit: () => import("@github/template-parts").TemplateInstance;
export declare const FullscreenEnter: () => import("@github/template-parts").TemplateInstance;

@@ -5,0 +7,0 @@ export declare const FullscreenExit: () => import("@github/template-parts").TemplateInstance;

@@ -11,2 +11,21 @@ import { MediaTheme } from 'media-chrome';

};
export declare const parts: {
mediaChrome: string;
centerPlay: string;
centerSeekBackward: string;
centerSeekForward: string;
play: string;
seekBackward: string;
seekForward: string;
mute: string;
captions: string;
airplay: string;
pip: string;
fullscreen: string;
cast: string;
playbackRate: string;
volumeRange: string;
timeRange: string;
timeDisplay: string;
};
export default class MediaThemeMux extends MediaTheme {

@@ -13,0 +32,0 @@ static get observedAttributes(): string[];

@@ -1,2 +0,1 @@

import './media-theme-mux/media-theme-mux';
import './dialog';

@@ -3,0 +2,0 @@ import type { MuxTemplateProps } from './types';

@@ -51,2 +51,4 @@ import type MuxVideoElement from '@mux/mux-video';

set playbackRate(val: number);
get defaultPlaybackRate(): number;
set defaultPlaybackRate(val: number);
get crossOrigin(): string | null;

@@ -60,2 +62,4 @@ set crossOrigin(val: string | null);

set muted(val: boolean);
get defaultMuted(): boolean;
set defaultMuted(val: boolean);
get playsInline(): boolean;

@@ -62,0 +66,0 @@ set playsInline(val: boolean);

{
"name": "@mux/mux-player",
"version": "0.1.0-canary.10-030fdc6",
"version": "0.1.0-canary.10-0563c30",
"description": "An open source Mux player web component that Just Works™",

@@ -54,5 +54,5 @@ "main": "./dist/index.cjs.js",

"@github/template-parts": "^0.5.3",
"@mux/mux-video": "0.8.1",
"@mux/playback-core": "0.8.0",
"media-chrome": "0.8.0"
"@mux/mux-video": "0.8.2",
"@mux/playback-core": "0.9.0",
"media-chrome": "0.8.1"
},

@@ -59,0 +59,0 @@ "devDependencies": {

@@ -81,3 +81,2 @@ <p align="center">

stream-type="on-demand"
controls
></mux-player>

@@ -99,3 +98,2 @@ </body>

metadata-viewer-user-id="user-id-1234"
controls
>

@@ -136,3 +134,2 @@ </mux-player>

prefer-mse
controls
>

@@ -168,3 +165,3 @@ </mux-player>

| `autoplay` | `boolean` | Toggles whether or not media should auto-play when initially loaded | false |
| `playback-rate` | `number` | Applies a multiplier to the media's playback rate, either speeding it up or slowing it down. | `1` |
| `playbackrate` | `number` | Applies a multiplier to the media's playback rate, either speeding it up or slowing it down. | `1` |
| `loop` | `boolean` | Automatically loop playback of your media when it finishes. | `false` |

@@ -186,10 +183,11 @@ | `poster` | `string` (URL) | Assigns a poster image URL. Will use the automatically generated poster based on your playback-id by default. | Derived |

| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `autoplay` | A `Boolean` that reflects the autoplay HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption. | `false` |
| `autoplay` | A `Boolean` that reflects the `autoplay` HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption. | `false` |
| `buffered` <sub><sup>Read only</sup></sub> | Returns a `TimeRanges` object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered property is accessed. | `undefined` |
| `controls` | Is a Boolean that reflects the controls HTML attribute, indicating whether user interface items for controlling the resource should be displayed. | `false` |
| `crossOrigin` | A DOMString indicating the CORS setting for this media element. | `null` |
| `currentTime` | A double-precision floating-point value indicating the current playback time in seconds; if the media has not started to play and has not been seeked, this value is the media's initial playback time. Setting this value seeks the media to the new time. The time is specified relative to the media's timeline. | `0` |
| `defaultMuted` | Is a `Boolean` that reflects the `muted` HTML attribute, determines whether audio is muted by default. `true` if the audio output should be muted by default and `false` otherwise. | `false` |
| `defaultPlaybackRate` | Is a double that reflects the `playbackrate` HTML attribute, it indicates the default playback rate for the media. | `1` |
| `duration` <sub><sup>Read only</sup></sub> | A read-only double-precision floating-point value indicating the total duration of the media in seconds. If no media data is available, the returned value is `NaN`. If the media is of indefinite length (such as streamed live media, a WebRTC call's media, or similar), the value is `+Infinity`. | `NaN` |
| `ended` <sub><sup>Read only</sup></sub> | Returns a `Boolean` that indicates whether the media element has finished playing. | `false` |
| `loop` | A `Boolean` that reflects the loop HTML attribute, which indicates whether the media element should start over when it reaches the end. | `false` |
| `loop` | A `Boolean` that reflects the `loop` HTML attribute, which indicates whether the media element should start over when it reaches the end. | `false` |
| `metadata` | The metadata property can be used to set the Mux Data metadata properties in an easy way. Take a look at the [metadata guide](https://docs.mux.com/guides/data/make-your-data-actionable-with-metadata) to view an exhaustive list of available values. | `{}` |

@@ -200,4 +198,4 @@ | `muted` | Is a `Boolean` that determines whether audio is muted. `true` if the audio is muted and `false` otherwise. | `false` |

| `playsInline` | A Boolean attribute indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen. | `false` |
| `preload` | Is a `DOMString` that reflects the preload HTML attribute, indicating what data should be preloaded, if any. Possible values are: `none`, `metadata`, `auto`. | `undefined` |
| `src` | Is a `String` that reflects the src HTML attribute, which contains the URL of a media resource to use. | `undefined` |
| `preload` | Is a `DOMString` that reflects the `preload` HTML attribute, indicating what data should be preloaded, if any. Possible values are: `none`, `metadata`, `auto`. | `undefined` |
| `src` | Is a `String` that reflects the `src` HTML attribute, which contains the URL of a media resource to use. | `undefined` |
| `startTime` | `Number` that specifies where in the media's timeline you want playback to start (in seconds). | `0` |

@@ -204,0 +202,0 @@ | `thumbnailTime` | `Number` offset (in seconds) for the poster image you want to show before loading media. If no `thumbnailTime` is specified, `startTime` will be used by default. NOTE: This feature currently cannot be used with `tokens.thumbnail`. | `0` |

@@ -849,3 +849,11 @@ // import playback-core here to make sure that the polyfill is loaded

set metadata(val: Readonly<Metadata> | undefined) {
if (this.media) this.media.metadata = val;
if (!this.#isInit) {
this.#init();
}
// NOTE: This condition should never be met. If it is, there is a bug (CJP)
if (!this.media) {
logger.error('underlying media element missing when trying to set metadata. metadata will not be set.');
return;
}
this.media.metadata = val;
}

@@ -852,0 +860,0 @@

@@ -6,2 +6,4 @@ // @ts-nocheck

import captionsOnIcon from './icons/captions-on.svg';
import castEnter from './icons/cast-enter.svg';
import castExit from './icons/cast-exit.svg';
import fullscreenEnter from './icons/fullscreen-enter.svg';

@@ -23,2 +25,4 @@ import fullscreenExit from './icons/fullscreen-exit.svg';

export const CaptionsOn = () => createTemplateInstance(captionsOnIcon);
export const CastEnter = () => createTemplateInstance(castEnter);
export const CastExit = () => createTemplateInstance(castExit);
export const FullscreenEnter = () => createTemplateInstance(fullscreenEnter);

@@ -25,0 +29,0 @@ export const FullscreenExit = () => createTemplateInstance(fullscreenExit);

@@ -25,2 +25,22 @@ import { MediaTheme } from 'media-chrome';

export const parts = {
mediaChrome: 'layer media-layer poster-layer vertical-layer centered-layer',
centerPlay: 'center play button',
centerSeekBackward: 'center seek-backward button',
centerSeekForward: 'center seek-forward button',
play: 'play button',
seekBackward: 'seek-backward button',
seekForward: 'seek-forward button',
mute: 'mute button',
captions: 'captions button',
airplay: 'airplay button',
pip: 'pip button',
fullscreen: 'fullscreen button',
cast: 'cast button',
playbackRate: 'playbackrate button',
volumeRange: 'volume range',
timeRange: 'time range',
timeDisplay: 'time display',
};
export default class MediaThemeMux extends MediaTheme {

@@ -57,3 +77,7 @@ static get observedAttributes() {

</style>
<media-controller audio="${props.audio || false}" class="size-${props.playerSize}">
<media-controller
audio="${props.audio || false}"
class="size-${props.playerSize}"
exportparts="${parts.mediaChrome.split(' ').join(', ')}"
>
<slot name="media" slot="media"></slot>

@@ -132,4 +156,4 @@ <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>

// prettier-ignore
const MediaPlayButton = () => html`
<media-play-button>
const MediaPlayButton = ({ part = parts.play } = {}) => html`
<media-play-button part="${part}">
${icons.Play()}

@@ -141,5 +165,6 @@ ${icons.Pause()}

// prettier-ignore
const MediaSeekBackwardButton = (props: Partial<ThemeMuxTemplateProps>) => html`
<media-seek-backward-button seek-offset="${props.backwardSeekOffset}">
${icons.SeekBackward({ value: props.backwardSeekOffset })}
type SeekBackwardButtonProps = { backwardSeekOffset: string, part?: string };
const MediaSeekBackwardButton = ({ backwardSeekOffset, part = parts.seekBackward }: SeekBackwardButtonProps) => html`
<media-seek-backward-button seek-offset="${backwardSeekOffset}" part="${part}">
${icons.SeekBackward({ value: backwardSeekOffset })}
</media-seek-backward-button>

@@ -149,5 +174,6 @@ `;

// prettier-ignore
const MediaSeekForwardButton = (props: Partial<ThemeMuxTemplateProps>) => html`
<media-seek-forward-button seek-offset="${props.forwardSeekOffset}">
${icons.SeekForward({ value: props.forwardSeekOffset })}
type SeekForwardButtonProps = { forwardSeekOffset: string, part?: string };
const MediaSeekForwardButton = ({ forwardSeekOffset, part = parts.seekForward }: SeekForwardButtonProps) => html`
<media-seek-forward-button seek-offset="${forwardSeekOffset}" part="${part}">
${icons.SeekForward({ value: forwardSeekOffset })}
</media-seek-forward-button>

@@ -158,3 +184,3 @@ `;

const MediaMuteButton = () => html`
<media-mute-button>
<media-mute-button part="${parts.mute}">
${icons.VolumeHigh()}

@@ -169,3 +195,3 @@ ${icons.VolumeMedium()}

const MediaCaptionsButton = (props: ThemeMuxTemplateProps) => html`
<media-captions-button default-showing="${!props.defaultHiddenCaptions}" >
<media-captions-button default-showing="${!props.defaultHiddenCaptions}" part="${parts.captions}">
${icons.CaptionsOff()}

@@ -177,3 +203,3 @@ ${icons.CaptionsOn()}

const MediaAirplayButton = () => html`
<media-airplay-button>
<media-airplay-button part="${parts.airplay}">
${icons.Airplay()}

@@ -184,3 +210,3 @@ </media-airplay-button>`;

const MediaPipButton = () => html`
<media-pip-button>
<media-pip-button part="${parts.pip}">
${icons.PipEnter()}

@@ -192,3 +218,3 @@ ${icons.PipExit()}

const MediaFullscreenButton = () => html`
<media-fullscreen-button>
<media-fullscreen-button part="${parts.fullscreen}">
${icons.FullscreenEnter()}

@@ -198,15 +224,46 @@ ${icons.FullscreenExit()}

// prettier-ignore
const MediaCastButton = () => html`
<media-cast-button part="${parts.cast}">
${icons.CastEnter()}
${icons.CastExit()}
</media-cast-button>`;
// prettier-ignore
const MediaPlaybackRateButton = () => html`
<media-playback-rate-button part="${parts.playbackRate}">
</media-playback-rate-button>`;
// prettier-ignore
const MediaVolumeRange = () => html`
<media-volume-range part="${parts.volumeRange}">
</media-volume-range>`;
// prettier-ignore
const MediaTimeRange = () => html`
<media-time-range part="${parts.timeRange}">
</media-time-range>`;
// prettier-ignore
const TimeDisplay = () => html`
<mxp-time-display part="${parts.timeDisplay}">
</mxp-time-display>`;
// prettier-ignore
export const AudioVodChrome = (props: ThemeMuxTemplateProps) => html`
<media-control-bar>
${MediaPlayButton()} ${MediaSeekBackwardButton(props)} ${MediaSeekForwardButton(props)}
<mxp-time-display></mxp-time-display>
<media-time-range></media-time-range>
${MediaPlayButton()}
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
${TimeDisplay()}
${MediaTimeRange()}
${MediaMuteButton()}
<media-volume-range></media-volume-range>
<media-playback-rate-button></media-playback-rate-button>
${MediaVolumeRange()}
${MediaPlaybackRateButton()}
${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
</media-control-bar>
`;
// prettier-ignore
export const AudioDvrChrome = (props: ThemeMuxTemplateProps) => html`

@@ -216,13 +273,15 @@ <media-control-bar>

<slot name="seek-to-live-button"></slot>
${MediaSeekBackwardButton(props)} ${MediaSeekForwardButton(props)}
<mxp-time-display></mxp-time-display>
<media-time-range></media-time-range>
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
${TimeDisplay()}
${MediaTimeRange()}
${MediaMuteButton()}
<media-volume-range></media-volume-range>
<media-playback-rate-button></media-playback-rate-button>
${MediaVolumeRange()}
${MediaPlaybackRateButton()}
${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
</media-control-bar>
`;
// prettier-ignore
export const AudioLiveChrome = () => html`

@@ -233,5 +292,5 @@ <media-control-bar>

${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
</media-control-bar>

@@ -246,7 +305,7 @@ `;

${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}
</media-control-bar>
<div slot="centered-chrome" class="mxp-center-controls">
${MediaPlayButton()}
${MediaPlayButton({ part: parts.centerPlay })}
</div>

@@ -265,17 +324,17 @@ <media-control-bar>

${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}
</media-control-bar>
<div slot="centered-chrome" class="mxp-center-controls">
${MediaSeekBackwardButton(props)}
${MediaPlayButton()}
${MediaSeekForwardButton(props)}
${MediaSeekBackwardButton({ ...props, part: parts.centerSeekBackward } as SeekBackwardButtonProps)}
${MediaPlayButton({ part: parts.centerPlay })}
${MediaSeekForwardButton({ ...props, part: parts.centerSeekForward } as SeekForwardButtonProps)}
</div>
<media-time-range></media-time-range>
${MediaTimeRange()}
<media-control-bar>
<mxp-time-display></mxp-time-display>
${TimeDisplay()}
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<div class="mxp-spacer"></div>
<media-playback-rate-button></media-playback-rate-button>
${MediaPlaybackRateButton()}
${MediaFullscreenButton()}

@@ -289,17 +348,17 @@ <div class="mxp-padding-2"></div>

<div slot="centered-chrome" class="mxp-center-controls">
${MediaPlayButton()}
${MediaPlayButton({ part: parts.centerPlay })}
</div>
<media-time-range></media-time-range>
${MediaTimeRange()}
<media-control-bar>
${MediaPlayButton()}
${MediaSeekBackwardButton(props)}
${MediaSeekForwardButton(props)}
<mxp-time-display></mxp-time-display>
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
${TimeDisplay()}
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<div class="mxp-spacer"></div>
<media-playback-rate-button></media-playback-rate-button>
${MediaPlaybackRateButton()}
${MediaCaptionsButton(props)}
${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}

@@ -321,11 +380,11 @@ ${MediaFullscreenButton()}

${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}
</media-control-bar>
<div slot="centered-chrome" class="mxp-center-controls">
${MediaPlayButton()}
${MediaPlayButton({ part: parts.centerPlay })}
</div>
<media-control-bar>
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<div class="mxp-spacer"></div>

@@ -342,11 +401,11 @@ ${MediaFullscreenButton()}

<div slot="centered-chrome" class="mxp-center-controls">
${MediaPlayButton()}
${MediaPlayButton({ part: parts.centerPlay })}
</div>
<media-control-bar>
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<div class="mxp-spacer"></div>
${MediaCaptionsButton(props)}
${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}

@@ -365,14 +424,14 @@ ${MediaFullscreenButton()}

${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}
</media-control-bar>
<div slot="centered-chrome" class="mxp-center-controls">
${MediaSeekBackwardButton(props)}
${MediaPlayButton()}
${MediaSeekForwardButton(props)}
${MediaSeekBackwardButton({ ...props, part: parts.centerSeekBackward } as SeekBackwardButtonProps)}
${MediaPlayButton({ part: parts.centerPlay })}
${MediaSeekForwardButton({ ...props, part: parts.centerSeekForward } as SeekForwardButtonProps)}
</div>
<media-time-range></media-time-range>
${MediaTimeRange()}
<media-control-bar>
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<slot name="seek-to-live-button"></slot>

@@ -388,11 +447,11 @@ <div class="mxp-spacer"></div>

<div slot="centered-chrome" class="mxp-center-controls">
${MediaPlayButton()}
${MediaPlayButton({ part: parts.centerPlay })}
</div>
<media-time-range></media-time-range>
${MediaTimeRange()}
<media-control-bar>
${MediaPlayButton()}
${MediaSeekBackwardButton(props)}
${MediaSeekForwardButton(props)}
${MediaSeekBackwardButton(props as SeekBackwardButtonProps)}
${MediaSeekForwardButton(props as SeekForwardButtonProps)}
${MediaMuteButton()}
<media-volume-range></media-volume-range>
${MediaVolumeRange()}
<slot name="seek-to-live-button"></slot>

@@ -402,3 +461,3 @@ <div class="mxp-spacer"></div>

${MediaAirplayButton()}
<media-cast-button></media-cast-button>
${MediaCastButton()}
${MediaPipButton()}

@@ -405,0 +464,0 @@ ${MediaFullscreenButton()}

@@ -1,2 +0,2 @@

import './media-theme-mux/media-theme-mux';
import { parts } from './media-theme-mux/media-theme-mux';
import './dialog';

@@ -24,2 +24,5 @@ import {

const flatCSSParts = Object.values(parts).flatMap((group) => group.split(' '));
const forwardUniqueCSSParts = [...new Set(flatCSSParts)].join(', ');
export const content = (props: MuxTemplateProps) => html`

@@ -40,2 +43,3 @@ <${unsafeStatic(castThemeName(props.theme) ?? 'media-theme-mux')}

backward-seek-offset="${props.backwardSeekOffset}"
exportparts="seek-live, ${forwardUniqueCSSParts}"
>

@@ -53,5 +57,5 @@ <mux-video

start-time="${props.startTime != null ? props.startTime : false}"
metadata-video-id="${props.metadataVideoId ?? props.metadata?.video_id ?? false}"
metadata-video-title="${props.metadataVideoTitle ?? props.metadata?.video_title ?? false}"
metadata-viewer-user-id="${props.metadataViewerUserId ?? props.metadata?.viewer_user_id ?? false}"
metadata-video-id="${props.metadataVideoId ?? false}"
metadata-video-title="${props.metadataVideoTitle ?? false}"
metadata-viewer-user-id="${props.metadataViewerUserId ?? false}"
beacon-collection-domain="${props.beaconCollectionDomain ?? false}"

@@ -108,2 +112,4 @@ player-software-name="${props.playerSoftwareName}"

slot="seek-to-live-button"
part="seek-live button"
class="mxp-seek-to-live-button"
aria-disabled="${props.inLiveWindow}"

@@ -117,3 +123,2 @@ onclick="${function (this: HTMLButtonElement, evt: Event) {

}}"
class="mxp-seek-to-live-button"
>

@@ -120,0 +125,0 @@ Live

import { VideoEvents } from '@mux/mux-video';
import type MuxVideoElement from '@mux/mux-video';
import * as logger from './logger';
import { toNumberOrUndefined } from './utils';

@@ -102,2 +103,3 @@ export type CastOptions = {

this.media.muted = newValue != null;
this.media.defaultMuted = newValue != null;
}

@@ -117,2 +119,3 @@ return;

this.media.playbackRate = val;
this.media.defaultPlaybackRate = val;
}

@@ -222,2 +225,15 @@ return;

get defaultPlaybackRate() {
return toNumberOrUndefined(this.getAttribute(CustomVideoAttributes.PLAYBACKRATE)) ?? 1;
}
set defaultPlaybackRate(val) {
if (val != null) {
this.setAttribute(CustomVideoAttributes.PLAYBACKRATE, `${val}`);
} else {
// Remove boolean attribute if false, 0, '', null, undefined.
this.removeAttribute(CustomVideoAttributes.PLAYBACKRATE);
}
}
get crossOrigin() {

@@ -258,6 +274,16 @@ return getVideoAttribute(this, AllowedVideoAttributes.CROSSORIGIN);

get muted() {
return this.media?.muted ?? false;
}
set muted(val) {
if (this.media) {
this.media.muted = Boolean(val);
}
}
get defaultMuted() {
return getVideoAttribute(this, AllowedVideoAttributes.MUTED) != null;
}
set muted(val) {
set defaultMuted(val) {
if (val) {

@@ -264,0 +290,0 @@ this.setAttribute(AllowedVideoAttributes.MUTED, '');

@@ -286,2 +286,6 @@ import { fixture, assert, aTimeout, waitUntil } from '@open-wc/testing';

assert(player.defaultMuted, 'player.defaultMuted is true');
assert(muxVideo.defaultMuted, 'muxVideo.defaultMuted is true');
assert(nativeVideo.defaultMuted, 'nativeVideo.defaultMuted is true');
player.removeAttribute('muted');

@@ -293,2 +297,6 @@

assert(!player.defaultMuted, 'player.defaultMuted is false');
assert(!muxVideo.defaultMuted, 'muxVideo.defaultMuted is false');
assert(!nativeVideo.defaultMuted, 'nativeVideo.defaultMuted is false');
player.setAttribute('muted', '');

@@ -299,2 +307,6 @@

assert(nativeVideo.muted, 'nativeVideo.muted is true');
assert(player.defaultMuted, 'player.defaultMuted is true');
assert(muxVideo.defaultMuted, 'muxVideo.defaultMuted is true');
assert(nativeVideo.defaultMuted, 'nativeVideo.defaultMuted is true');
});

@@ -348,2 +360,24 @@

it('defaultPlaybackRate property behaves like expected', async function () {
const player = await fixture(`<mux-player
playback-id="DS00Spx1CV902MCtPj5WknGlR102V5HFkDe"
stream-type="on-demand"
></mux-player>`);
assert.equal(player.defaultPlaybackRate, 1);
const muxVideo = player.media;
const nativeVideo = muxVideo.shadowRoot.querySelector('video');
assert.equal(player.defaultPlaybackRate, 1, 'player.defaultPlaybackRate is 1');
assert.equal(muxVideo.defaultPlaybackRate, 1, 'muxVideo.defaultPlaybackRate is 1');
assert.equal(nativeVideo.defaultPlaybackRate, 1, 'nativeVideo.defaultPlaybackRate is 1');
player.defaultPlaybackRate = 0.7;
assert.equal(player.defaultPlaybackRate, 0.7, 'player.defaultPlaybackRate is 0.7');
assert.equal(muxVideo.defaultPlaybackRate, 0.7, 'muxVideo.defaultPlaybackRate is 0.7');
assert.equal(nativeVideo.defaultPlaybackRate, 0.7, 'nativeVideo.defaultPlaybackRate is 0.7');
});
it("signing tokens generate correct asset URL's", async function () {

@@ -350,0 +384,0 @@ // tokens expire in 10 years

@@ -10,2 +10,4 @@ import { assert } from '@open-wc/testing';

const exportParts = `seek-live, layer, media-layer, poster-layer, vertical-layer, centered-layer, center, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playbackrate, volume, range, time, display`;
it('default template without props', function () {

@@ -15,3 +17,3 @@ render(content({}), div);

minify(div.innerHTML),
'<media-theme-mux class="size-" stream-type="" player-size="" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version=""></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>'
`<media-theme-mux class="size-" stream-type="" player-size="" default-hidden-captions="" forward-seek-offset="" backward-seek-offset="" exportparts="${exportParts}"><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version=""></mux-video><button slot="seek-to-live-button" part="seek-live button" class="mxp-seek-to-live-button" aria-disabled="">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>`
);

@@ -34,3 +36,3 @@ });

minify(div.innerHTML),
'<media-theme-mux class="size-extra-small" stream-type="on-demand" player-size="extra-small" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>'
`<media-theme-mux class="size-extra-small" stream-type="on-demand" player-size="extra-small" default-hidden-captions="" forward-seek-offset="" backward-seek-offset="" exportparts="${exportParts}"><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" part="seek-live button" class="mxp-seek-to-live-button" aria-disabled="">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>`
);

@@ -51,3 +53,3 @@ });

minify(div.innerHTML),
'<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>'
`<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" default-hidden-captions="" forward-seek-offset="" backward-seek-offset="" exportparts="${exportParts}"><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" part="seek-live button" class="mxp-seek-to-live-button" aria-disabled="">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><p></p></mxp-dialog></media-theme-mux>`
);

@@ -71,5 +73,5 @@ });

minify(div.innerHTML),
'<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" default-hidden-captions="" forward-seek-offset="" backward-seek-offset=""><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" aria-disabled="" class="mxp-seek-to-live-button">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>'
`<media-theme-mux class="size-large" stream-type="on-demand" player-size="large" default-hidden-captions="" forward-seek-offset="" backward-seek-offset="" exportparts="${exportParts}"><mux-video slot="media" crossorigin="" playsinline="" player-software-name="" player-software-version="" stream-type="on-demand"></mux-video><button slot="seek-to-live-button" part="seek-live button" class="mxp-seek-to-live-button" aria-disabled="">\n Live\n </button><mxp-dialog no-auto-hide="" open=""><h3>Errr</h3><p></p></mxp-dialog></media-theme-mux>`
);
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc