<div {{ attributes.defaults(stimulus_controller('player')) }}
id="player" class="player-container">
<div class="container d-flex">
{% if this.sound %}
<div class="player">
{% if this.sound.player.name == 'spotify' %}
<div class="player-sound-image">
<img
class="img-fluid"
src="{{ vich_uploader_asset(this.sound, 'imageFile')|imagine_filter('sound_cover') }}"
alt="image cover of {{ this.sound.title }}">
</div>
{% endif %}
{% if this.sound.player.name == 'youtube' %}
<div class="player-sound-video"
data-live-id="{{ this.sound.id }}"
data-file="{{ this.sound.file }}"
{{ stimulus_target('player', 'video') }}>
<div {{ stimulus_target('player', 'videoPlayer') }}></div>
</div>
{% endif %}
<div class="player-sound">
<div class="player-sound-details">
<h2 class="player-sound-details-artist">{{ this.sound.artist.name }}</h2>
<p class="player-sound-details-title">{{ this.sound.title }}</p>
</div>
<div class="player-sound-commands">
<button class="player-btn"
{{ stimulus_action('player', 'togglePlay') }}
{{ stimulus_target('player', 'playPauseButton') }} >
<i class="fas fa-play-circle"></i>
</button>
<button class="player-btn {{ this.isFirst() ? 'opacity-25' }}"
data-action="live#action"
data-action-name="prevTrack"
{{ this.isFirst() ? 'disabled="disabled"' }}
>
<i class="fas fa-backward-step"></i>
</button>
<button class="player-btn {{ this.isLast() ? 'opacity-25' }}"
data-action="live#action"
data-action-name="nextTrack"
{{ this.isLast() ? 'disabled="disabled"' }}
>
<i class="fas fa-forward-step"></i>
</button>
{% if app.user %}
{{ component('bookmark', {
sound: this.sound,
'data-live-id': this.sound.id
}) }}
{% endif %}
{# @todo add to bookmark & manage playlist #}
{# <button class="player-btn">#}
{# <i class="far fa-list-music"></i>#}
{# </button>#}
</div>
</div>
</div>
<div class="player-instrument">
{% include 'instrument/_instrument-picture.html.twig' with {instrument: this.sound.instrument} %}
<div class="player-instrument-details">
<h2 class="player-instrument-details-title">{{ this.sound.instrument.name }} <small>- {{ this.sound.instrument.company.name }}</small></h2>
<p class="player-instrument-details-summary">{{ this.sound.instrument.summary }}</p>
<a href="{{ path('app_instrument_show', {'slug': this.sound.instrument.slug}) }}"
data-turbo-frame="body"
class="btn btn-primary btn-sm mt-auto">{{ 'Afficher'|trans }}</a>
</div>
</div>
{% endif %}
<div class="ms-2">
<button
{{ stimulus_action('player', 'collapse') }}
{{ stimulus_target('player', 'collapseButton') }}
class="btn btn-primary btn-sm">
<i class="fas fa-caret-down"></i>
</button>
<button
{{ stimulus_action('player', 'expand') }}
{{ stimulus_target('player', 'expandButton') }}
class="btn btn-primary btn-sm">
<i class="fas fa-caret-up"></i>
</button>
</div>
</div>
</div>