ArticleTemplates/assets/scss/modules/media/_audio-player.scss (209 lines of code) (raw):

// /*doc // --- // title: Audio player // name: audio-player // category: Media // --- // Play a piece of audio, i.e. a podcast. // // ```html_example // <div class="audio-player"> // <img class="audio-player__button--loading" src="" alt="Loading…"/> // // <a class="audio-player__button touchpoint touchpoint--primary" href="#audio.mp3"> // <span class="touchpoint__button play" data-icon="&#xe04b;" aria-hidden="true"></span> // <span class="touchpoint__button pause" data-icon="&#xe04D;" aria-hidden="true"></span> // <span class="touchpoint__label screen-readable">Play</span> // </a> // // <div class="audio-player__slider"> // <input class="audio-player__slider__played" type="text" id="audio-scrubber" value="3:00"/> // <input class="audio-player__slider__remaining" type="text" id="audio-scrubber-left" value="-12:00"/> // <div class="audio-player__slider__track"></div> // <div class="audio-player__slider__knob" role="slider" style="-webkit-transform: translate3d(0px, 0, 0);"></div> // </div> // </div> // ``` // */ .audio-player { background-color: color(brightness-20); padding: base-px(1); padding-left: 68px; position: relative; height: 68px; width: 100%; z-index: 2; } .audio-player__container_new .audio-player, .listen-to-article__container .audio-player { padding-left: 64px; padding-bottom: base-px(0.3); padding-top: base-px(0.7); height: 56px; } .listen-to-article__container .audio-player { background-color: inherit; } @keyframes pulseOut { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } } @include mq($from: col4) { .audio-player__container, .audio-player__container_new, .listen-to-article__container { background-color: darken(color(brightness-20), 5%); } .audio-player__wrapper { background-color: color(brightness-20); margin: 0 auto; width: 1200px; } .audio-player { margin-left: 240px; width: 620px; } } .audio-player__button { position: absolute; top: base-px(1); left: base-px(1); transform: scale(1); transition: all 300ms; z-index: 10; .loading & { transform: scale(0.5); transition: all 1ms; z-index: -1; } &.touchpoint--primary .touchpoint__button { color: color(brightness-7); background-color: color(tone-media); &:active { background-color: color(tone-media-accent); } } .touchpoint__button.pause { display: none; } &.pause { .touchpoint__button.pause { display: block; } .touchpoint__button.play { display: none; } } } .audio-player__container_new .audio-player__button, .listen-to-article__container .audio-player__button { top: base-px(0.7); } .audio-player__button--loading { position: absolute; top: base-px(1); left: base-px(1); width: 44px; height: 44px; visibility: hidden; .pulse { transform: scale(1); transition: transform 300ms ease-in-out; &:before, &:after, & { content: ''; display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 100%; background-color: color(tone-highlight); } &:before, &:after { opacity: 0; transform: scale(0); } .loading & { visibility: visible; transform: scale(0.5); &:before, &:after { animation: pulseOut 2s ease-out infinite; } &:after { animation-delay: 1s; } } } } .audio-player__container_new .audio-player__button--loading, .listen-to-article__container .audio-player__button--loading { top: base-px(0.7); } .audio-player__slider { outline: 0; height: 100%; width: 100%; position: relative; -webkit-user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-text-size-adjust: none; -webkit-touch-callout: none; } .audio-player__slider__played, .audio-player__slider__remaining { @include meta; color: color(brightness-100); opacity: 1; font-family: $guardian-sans; font-weight: normal; background: transparent; position: absolute; border: 0; padding: 0; margin: 0; margin-top: -3px; // Offset for fonts } .audio-player__slider__remaining { text-align: right; right: 0; } .audio-player__info__label, .audio-player__info__duration { @include meta; color: color(brightness-86); opacity: 1; font-family: $guardian-sans; background: transparent; border: 0; padding: 0; } .audio-player__info__label { font-weight: 600; font-size: 1.6rem; line-height: 1.6rem; padding-top: base-px(0.5); } .audio-player__info__duration { font-weight: normal; font-size: 1.5rem; line-height: 1.1rem; padding-top: base-px(0.5); } .audio-player__waveform { height: 32px; background-image: url('../img/audio-waveform.svg'); background-position: bottom; background-size: contain; background-repeat: repeat-x; margin-left: base-px(1); margin-right: base-px(1); } .audio-player__quadlines { height: 12px; width: 100%; opacity: .2; background-image: repeating-linear-gradient(currentColor, currentColor 1px, transparent 1px, transparent 3px); } .audio-player__slider__track { background-color: color(brightness-60); height: 2px; width: 100%; position: absolute; top: calc(50% + 9px); right: 0; left: 0; } .audio-player__slider__knob { background-color: color(tone-media-accent); margin-top: 24px; border-radius: 50%; padding: 0; height: 16px; width: 16px; position: absolute; } .listen-to-article__container { display: none; }