Skip to content

Conversation

@elenachekhina
Copy link
Owner

@elenachekhina elenachekhina commented Aug 2, 2023

Задача:
Добавить возможность автору трансляции ставить проигрывание трека на паузу (и обратно) и синхронизировать эти действия со слушателями.

Copy link

@palkan palkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

station = current_user.live_station

Turbo::StreamsChannel.broadcast_stream_to station, content: "<turbo-stream attribute=\"data-player-command-value\" value=\"pause\" action=\"set_attribute\" targets=\".player\"><template></template></turbo-stream>"
# Turbo::StreamsChannel.broadcast_stream_to station, content: turbo_stream.set_attribute(".player", "data-player-command-value", "pause")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для единичного target нужен именно ID. Так что лучше добавить его и вернуть этот вариант)

<%= link_to "Live!", live_station_path, class: "player--title ml-2" %>
</div>
<div class="player--controls">
<span class="player-btn" data-action="click->player#play" data-turbo-command="PlayerCommand#continue">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отлично 👍 Пока больше никто не догадался совместить data-action и data-turbo-command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants