-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ryanhagerty
committed
Apr 29, 2022
1 parent
f38c4be
commit aea667f
Showing
7 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.audio-player__player { | ||
width: 100%; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/components/components/audio-player/audio-player.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import audioPlayer from './audio-player.twig'; | ||
import audioData from './audio-player.yml'; | ||
|
||
export default { | ||
title: 'Components/Media/Audio Player', | ||
}; | ||
|
||
export const AudioPlayer = () => audioPlayer(audioData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{# | ||
/** | ||
* Available Variables: | ||
* audio_content - An array with the audio file(s) to be played. This is an array | ||
to support multiple formats. | ||
* preload - Determines if the audio file should be loaded on page load. This is the | ||
audio equivilant of lazy load. Defaults to 'none'. | ||
* autoplay - Whether the audio should automatically play. Defaults to false. | ||
* loop - Plays the audio in a loop. Defaults to false. | ||
* muted - Mutes audio. Defaults to false. | ||
* no_download - Disallows users from downloading the audio file. | ||
*/ | ||
#} | ||
|
||
{% set audio_player__base_class = 'audio-player' %} | ||
{% set audio_player__modifiers = audio_player__modifiers|default([]) %} | ||
{% set additional_attributes = additional_attributes|default() %} | ||
|
||
<div {{ bem(audio_player__base_class, audio_player__blockname, audio_player__modifiers)}} {{ add_attributes(additional_attributes) }}> | ||
<audio {{ bem('player', [], audio_player__base_class) }} controls | ||
preload="{{preload|default('none')}}" | ||
{{ (autoplay) ? 'autoplay' : ''}} | ||
{{ (loop) ? 'loop' : ''}} | ||
{{ (muted) ? 'muted' : ''}} | ||
{% if no_download %} controlsList="nodownload"{% endif %}> | ||
{% for audio_file in audio_content %} | ||
<source src="{{ audio_file }}" type="audio/{{ audio_file|split('.')|last }}"> | ||
{% endfor %} | ||
<p>Your browser doesn't support HTML5 audio.</p> | ||
{% if not no_download %} | ||
<p>Here is a <a href={{ audio_content|first }}>link to the audio</a> instead.</p> | ||
{% endif %} | ||
</audio> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# ball audio file by marini24 under CC 3.0 | ||
audio_content: | ||
- './ball.mp3' | ||
- './ball.ogg' |
Binary file not shown.
Binary file not shown.