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

feat: export control bars part for styling #773

Merged
merged 5 commits into from
Sep 20, 2023
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
2 changes: 1 addition & 1 deletion packages/mux-player/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const content = (props: MuxTemplateProps) => html`
defaultshowremainingtime="${props.defaultShowRemainingTime ?? false}"
hideduration="${props.hideDuration ?? false}"
title="${props.title ?? false}"
exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, controller, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display"
exportparts="top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, controller, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display, control-bar"
>
<mux-video
slot="media"
Expand Down
16 changes: 8 additions & 8 deletions packages/mux-player/src/themes/2023/2023.html
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,10 @@

<template if="streamtype == 'on-demand'">
<template if="breakpointsm">
<media-control-bar slot="top-chrome">{{>TitleDisplay}} </media-control-bar>
<media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar>
</template>
{{>TimeRange}}
<media-control-bar part="bottom">
<media-control-bar part="control-bar bottom">
<template if="breakpointsm">
{{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}}
</template>
Expand All @@ -901,12 +901,12 @@
</template>

<template if="streamtype == 'live'">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
<template if="breakpointsm"> {{>TitleDisplay}} </template>
</media-control-bar>
<template if="targetlivewindow > 0">{{>TimeRange}}</template>
<media-control-bar part="bottom">
<media-control-bar part="control-bar bottom">
<template if="breakpointsm">
{{>PlayButton}}
<template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
Expand All @@ -923,9 +923,9 @@
<template if="audio">
<template if="streamtype == 'on-demand'">
<template if="title">
<media-control-bar>{{>TitleDisplay}}</media-control-bar>
<media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
</template>
<media-control-bar part="bottom">
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
<template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
{{>MuteButton}}
Expand All @@ -939,9 +939,9 @@

<template if="streamtype == 'live'">
<template if="title">
<media-control-bar>{{>TitleDisplay}}</media-control-bar>
<media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
</template>
<media-control-bar part="bottom">
<media-control-bar part="control-bar bottom">
<template if="breakpointsm">
{{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}} {{>VolumeRange}}
<template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>
Expand Down
46 changes: 23 additions & 23 deletions packages/mux-player/src/themes/classic/classic.html
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@

<template if="streamtype == 'on-demand'">
<template if="title">
<media-control-bar>{{>TitleDisplay}}</media-control-bar>
<media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
</template>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>SeekBackwardButton}}
{{>SeekForwardButton}}
Expand All @@ -510,9 +510,9 @@

<template if="targetlivewindow > 0">
<template if="title">
<media-control-bar>{{>TitleDisplay}}</media-control-bar>
<media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
</template>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>LiveButton section="bottom"}}
{{>SeekBackwardButton}}
Expand All @@ -530,9 +530,9 @@

<template if="!targetlivewindow">
<template if="title">
<media-control-bar>{{>TitleDisplay}}</media-control-bar>
<media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>
</template>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>LiveButton section="bottom"}}
{{>MuteButton}}
Expand All @@ -553,7 +553,7 @@

<template if="!breakpointsm">
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
<div class="spacer"></div>
Expand All @@ -564,7 +564,7 @@

<template if="breakpointsm">
<template if="!breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>TitleDisplay}}
</media-control-bar>
<div slot="centered-chrome" class="center-controls">
Expand All @@ -573,7 +573,7 @@
{{>SeekForwardButton section="center"}}
</div>
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>TimeDisplay}}
{{>MuteButton}}
Expand All @@ -592,14 +592,14 @@
</template>

<template if="breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>TitleDisplay}}
</media-control-bar>
<div slot="centered-chrome" class="center-controls">
{{>PlayButton section="center"}}
</div>
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>SeekBackwardButton}}
{{>SeekForwardButton}}
Expand All @@ -625,10 +625,10 @@
<template if="!targetlivewindow">

<template if="!breakpointsm">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
</media-control-bar>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
<div class="spacer"></div>
Expand All @@ -639,14 +639,14 @@

<template if="breakpointsm">
<template if="!breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
{{>TitleDisplay}}
</media-control-bar>
<div slot="centered-chrome" class="center-controls">
{{>PlayButton section="center"}}
</div>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
{{>VolumeRange}}
Expand All @@ -663,14 +663,14 @@
</template>

<template if="breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
{{>TitleDisplay}}
</media-control-bar>
<div slot="centered-chrome" class="center-controls">
{{>PlayButton section="center"}}
</div>
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
{{>VolumeRange}}
Expand All @@ -689,11 +689,11 @@
<template if="targetlivewindow > 0">

<template if="!breakpointsm">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
</media-control-bar>
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
<div class="spacer"></div>
Expand All @@ -704,7 +704,7 @@

<template if="breakpointsm">
<template if="!breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
{{>TitleDisplay}}
</media-control-bar>
Expand All @@ -714,7 +714,7 @@
{{>SeekForwardButton section="center"}}
</div>
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>MuteButton}}
{{>VolumeRange}}
Expand All @@ -731,15 +731,15 @@
</template>

<template if="breakpointmd">
<media-control-bar slot="top-chrome">
<media-control-bar part="control-bar top" slot="top-chrome">
{{>LiveButton}}
{{>TitleDisplay}}
</media-control-bar>
<div slot="centered-chrome" class="center-controls">
{{>PlayButton section="center"}}
</div>
{{>TimeRange}}
<media-control-bar>
<media-control-bar part="control-bar bottom">
{{>PlayButton}}
{{>SeekBackwardButton}}
{{>SeekForwardButton}}
Expand Down
2 changes: 1 addition & 1 deletion packages/mux-player/test/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const minify = (html) => html.trim().replace(/>\s+</g, '><');
describe('<mux-player> template render', () => {
const div = document.createElement('div');

const exportParts = `top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, controller, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display`;
const exportParts = `top, center, bottom, layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer, controller, poster, live, play, button, seek-backward, seek-forward, mute, captions, airplay, pip, fullscreen, cast, playback-rate, volume, range, time, display, control-bar`;

it('default template without props', function () {
render(content({}), div);
Expand Down