Skip to content

Commit

Permalink
Add modal to copy direct link to recording
Browse files Browse the repository at this point in the history
  • Loading branch information
LoanR committed Jul 25, 2024
1 parent 4634c6b commit c0b14eb
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
19 changes: 18 additions & 1 deletion web/b3desk/models/bbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,26 @@ def get_recordings(self):
type = format.find("type").text
if type in ("presentation", "video"):
data["playbacks"][type] = {
"url": format.find("url").text,
"url": (media_url := format.find("url").text),
"images": images,
}
if type == "video":
try:
resp = requests.get(
direct_link := media_url + "video-0.m4v"
)
if resp.status_code == 200:
data["playbacks"][type]["direct_link"] = (
direct_link
)
except (
requests.exceptions.HTTPError,
requests.exceptions.ConnectionError,
):
current_app.logger.warning(
"No direct recording link for meeting %s",
self.meeting.meetingID,
)
result.append(data)
except Exception as exception:
current_app.logger.error(exception)
Expand Down
42 changes: 40 additions & 2 deletions web/b3desk/templates/meeting/recordings.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ <h3 class="fr-h3">
<span class="fr-icon-clipboard-line"></span>
</button>
{% if recording.playbacks.get("video") %}
<a class="fr-btn fr-btn--primary fr-mx-1w"" download target="_blank" rel="noopener" href="{{ recording.playbacks['video'].url }}" title="Voir l'enregistrement mp4 (fichier téléchargeable) et le chat">mp4</a>
{% if recording.playbacks.video.get("direct_link") %}
<button class="fr-btn fr-btn--primary fr-mx-1w" data-fr-opened="false" aria-controls="share-video-{{ recording.recordID }}" title="Partager l'enregistrement">
<span class="fr-icon-git-branch-line" aria-hidden="true"></span>
</button>
{% endif %}
{% endif %}
<button class="fr-btn fr-btn--secondary fr-fi-delete-line fr-mx-1w"" data-fr-opened="false" aria-controls="delete-video-{{ recording.recordID }}">
<button class="fr-btn fr-btn--secondary fr-fi-delete-line fr-mx-1w" data-fr-opened="false" aria-controls="delete-video-{{ recording.recordID }}">
{% trans meeting_name=meeting.name %}Supprimer video de {{ meeting_name }}{% endtrans %}
</button>
</div>
Expand Down Expand Up @@ -151,6 +155,40 @@ <h1 id="delete-video-{{ recording.recordID }}-title" class="fr-modal__title">
</div>
</dialog>

<!-- Partager la video -->
<dialog id="share-video-{{ recording.recordID }}" class="fr-modal" role="dialog" aria-labelledby="share-video-{{ recording.recordID }}-title">
<div class="fr-container fr-container--fluid fr-container-md">
<div class="fr-grid-row fr-grid-row--center">
<div class="fr-col-12 fr-col-md-8 fr-col-lg-6">
<div class="fr-modal__body">
<div class="fr-modal__header">
<button class="fr-btn--close fr-btn" aria-controls="share-video-{{ recording.recordID }}" title="Fermer">
Fermer
</button>
</div>
<div class="fr-modal__content">
<h1 id="share-video-{{ recording.recordID }}-title" class="fr-modal__title">
<span class="" aria-hidden="true"></span>
Partager l'enregistrement de "<em>{{ recording_name }}</em>"
</h1>
{% if recording.playbacks.get("video") %}
{% if recording.playbacks.video.get("direct_link") %}
<div class="fr-grid-row fr-grid-row--center">
<input class="fr-input fr-col-9" type="text" readonly value="{{ recording.playbacks.video.direct_link }}">
<button type="button" class="fr-btn fr-btn--sm fr-btn--primary fr-col-3" id="meeting-{{ meeting.id }}-moderator-copy" onclick="navigator.clipboard.writeText('{{ recording.playbacks.video.direct_link }}');" title="Copier le lien de l'enregistrement dans le presse-papiers">
<span class="fr-icon-clipboard-line"></span> 
Copier
</button>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</div>
</dialog>

{% endfor %}
</div>
<div class="fr-mt-4w">
Expand Down

0 comments on commit c0b14eb

Please sign in to comment.