add animated placeholder to player
This commit is contained in:
parent
278cee753a
commit
b0164d7a10
28
src/assets/scss/5-modules/placeholder.scss
Normal file
28
src/assets/scss/5-modules/placeholder.scss
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* ----------------------------------------------------------- */
|
||||||
|
/* == Animated placeholder module */
|
||||||
|
/* ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
@keyframes placeHolderShimmer {
|
||||||
|
0% {
|
||||||
|
background-position: -500px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
background-position: 500px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
position: relative;
|
||||||
|
min-height: 1em;
|
||||||
|
background: #f2f2f2;
|
||||||
|
background: linear-gradient(to right, #eee 8%, rgb(223, 223, 223) 18%, #eee 33%);
|
||||||
|
background-size: 100rem 10.4rem;
|
||||||
|
color: transparent;
|
||||||
|
animation-name: placeHolderShimmer;
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-bottom: calc(100% / (16/9));
|
padding-bottom: calc(100% / (16/9));
|
||||||
border-radius: .4rem .4rem 0 0;
|
border-radius: .4rem .4rem 0 0;
|
||||||
|
background-color: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.playerBig__player > iframe {
|
.playerBig__player > iframe {
|
||||||
|
@ -101,3 +101,7 @@
|
|||||||
color: $color-grey-1;
|
color: $color-grey-1;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.playerProgress__timecodeItem {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
display: box;
|
display: box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: .8rem;
|
margin-bottom: .8rem;
|
||||||
|
width: 100%;
|
||||||
color: $color-secondary;
|
color: $color-secondary;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@ -40,6 +41,7 @@
|
|||||||
|
|
||||||
.playerTrack__referer {
|
.playerTrack__referer {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
width: 100%;
|
||||||
color: $color-grey-1;
|
color: $color-grey-1;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
// == modules */
|
// == modules */
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
|
||||||
|
@import "5-modules/placeholder";
|
||||||
@import "5-modules/player-big";
|
@import "5-modules/player-big";
|
||||||
@import "5-modules/player-progress";
|
@import "5-modules/player-progress";
|
||||||
@import "5-modules/player-track";
|
@import "5-modules/player-track";
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
<Header></Header>
|
<Header></Header>
|
||||||
|
|
||||||
<section class="viewer">
|
<section class="viewer">
|
||||||
{#if $current}
|
|
||||||
<Viewer></Viewer>
|
<Viewer></Viewer>
|
||||||
<Controls></Controls>
|
<Controls></Controls>
|
||||||
{/if}
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="queue">
|
<section class="queue">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<div class="playerBig">
|
<div class="playerBig">
|
||||||
<div class="playerBig__player">
|
<div class="playerBig__player" class:placeholder={!ready}>
|
||||||
|
{#if $current}
|
||||||
<YoutubePlayer
|
<YoutubePlayer
|
||||||
id={$current ? $current.media.credentials.id : null}
|
id={$current ? $current.media.credentials.id : null}
|
||||||
class="playerBig__iframe"
|
class="playerBig__iframe"
|
||||||
@ -13,30 +14,27 @@
|
|||||||
bind:duration
|
bind:duration
|
||||||
bind:seek={seek}
|
bind:seek={seek}
|
||||||
></YoutubePlayer>
|
></YoutubePlayer>
|
||||||
|
{/if}
|
||||||
<div class="playerBig__overlay" on:click={() => $paused = !$paused}></div>
|
<div class="playerBig__overlay" on:click={() => $paused = !$paused}></div>
|
||||||
<button class="playerBig__reduce">Reduce<IconReduce></IconReduce></button>
|
<button class="playerBig__reduce">Reduce<IconReduce></IconReduce></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !ready}
|
|
||||||
LOADING TRACK
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<Progress
|
<Progress
|
||||||
duration={duration}
|
duration={duration}
|
||||||
currentTime={currentTime}
|
currentTime={currentTime}
|
||||||
|
ready={ready}
|
||||||
on:input={event => updateCurrentTime(event.target.value, false)}
|
on:input={event => updateCurrentTime(event.target.value, false)}
|
||||||
on:change={event => updateCurrentTime(event.target.value, true)}
|
on:change={event => updateCurrentTime(event.target.value, true)}
|
||||||
></Progress>
|
></Progress>
|
||||||
|
|
||||||
<div class="playerTrack">
|
<div class="playerTrack">
|
||||||
<div class="playerTrack__infos">
|
<div class="playerTrack__infos">
|
||||||
<div class="playerTrack__name">{$current.title}</div>
|
<div class="playerTrack__name" class:placeholder={!$current}>{#if $current}{$current.title}{/if}</div>
|
||||||
<div class="playerTrack__referer">
|
<div class="playerTrack__referer" class:placeholder={!$current}>
|
||||||
share by <span class="playerTrack__username">{$current.referer.username}</span>
|
{#if $current}shared by <span class="playerTrack__username">{$current.referer.username}</span>{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="playerTrack__fav" aria-label="Fav"><IconHeart></IconHeart></button>
|
<button class="playerTrack__fav" class:hidden={!$current} aria-label="Fav"><IconHeart></IconHeart></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="playerProgress__timecode">
|
<div class="playerProgress__timecode">
|
||||||
<div class="playerProgress__timecodeItem">{currentTimeText}</div>
|
<div class="playerProgress__timecodeItem" class:placeholder={!ready}>{currentTimeText}</div>
|
||||||
<div class="playerProgress__timecodeItem">{durationText}</div>
|
<div class="playerProgress__timecodeItem" class:placeholder={!ready}>{durationText}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
export let duration
|
export let duration
|
||||||
export let currentTime
|
export let currentTime
|
||||||
|
export let ready
|
||||||
|
|
||||||
$: value = currentTime != null ? currentTime : 0
|
$: value = currentTime != null ? currentTime : 0
|
||||||
$: max = duration != null ? duration : 100
|
$: max = duration != null ? duration : 100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user