Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modal to copy direct link to recording #141

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 17 additions & 0 deletions web/b3desk/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,3 +1051,20 @@ def get_email_whitelist(

ENABLE_LASUITENUMERIQUE: Optional[bool] = False
"""Enable LaSuite numerique homepage style."""

VIDEO_STREAMING_LINKS: Optional[dict[str, str]] = {}
"""List of streaming service for video sharing."""

@field_validator("VIDEO_STREAMING_LINKS", mode="before")
def get_video_streaming_links(
cls,
video_streaming_links: Optional[dict[str, str]],
info: ValidationInfo,
) -> dict[str, str]:
if not video_streaming_links:
return {}

if isinstance(video_streaming_links, str):
return json.loads(video_streaming_links)

return video_streaming_links
59 changes: 55 additions & 4 deletions web/b3desk/templates/meeting/recordings.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ <h3 class="fr-h3">
{% trans %}Renommer l’enregistrement{% endtrans %}
</button>
</h3>
<span>
{% trans start_date=recording.start_date|dateformat, expiration_date=(recording.end_date+config["RECORDING_DURATION"])|dateformat %}
Enregistré le {{ start_date }} -
Expire le {{ expiration_date }}
{% endtrans %}
</span>
<div class="fr-table fr-table--bordered fr-table--layout-fixed">
<table>
<thead>
Expand All @@ -53,14 +55,19 @@ <h3 class="fr-h3">
</td>
<td style="vertical-align: middle">
<div class="fr-grid-row fr-grid-row--gutters btn-actions">
<a class="fr-btn fr-btn--primary fr-mx-1w" target="_blank" rel="noopener" href="{{ playback.url }}" title="Voir l'enregistrement"><span class="fr-icon-play-line"></span></a>
<button type="button" class="btn-copy fr-btn fr-btn--primary fr-mx-1w"" id="meeting-{{ meeting.id }}-moderator-copy" onclick="navigator.clipboard.writeText('{{ playback.url }}');" title="Copier le lien de l'enregistrement dans le presse-papiers">
<a class="fr-btn fr-btn--primary" target="_blank" rel="noopener" href="{{ playback.url }}" title="Voir l'enregistrement"><span class="fr-icon-play-line"></span></a>
<button type="button" class="btn-copy fr-btn fr-btn--primary fr-ml-1v" id="meeting-{{ meeting.id }}-moderator-copy" onclick="navigator.clipboard.writeText('{{ playback.url }}');" title="Copier le lien de l'enregistrement dans le presse-papiers">
<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>
<a class="fr-btn fr-btn--primary fr-ml-2w" target="_blank" rel="noopener" href="{{ recording.playbacks['video'].url }}" title="Voir l'enregistrement mp4"><span class="fr-icon-film-line"></span></a>
{% if recording.playbacks.video.get("direct_link") %}
<button class="fr-btn fr-btn--primary fr-ml-1v" data-fr-opened="false" aria-controls="share-video-{{ recording.recordID }}" title="Partager l'enregistrement mp4">
<span class="fr-icon-links-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-ml-2w" 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 +158,50 @@ <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>
<p>
Cet enregistrement est conservé temporairement sur ce service. Pour le mettre à disposition de manière pérenne, fournissez ce lien à des services dédiés à la diffusion
{%- if config["VIDEO_STREAMING_LINKS"] -%}
{%- for service, link in config["VIDEO_STREAMING_LINKS"].items() -%}
{{ " tels que " if loop.first else ", " if not loop.last else " ou " }}<a href="{{link}}">{{service}}</a>
{%- endfor -%}
{%- endif -%}
.
En cas de diffusion publique, veillez préalablement à obtenir l'autorisation des participants.
</p>
{% 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
Loading
Loading