2019-07-10 05:13:23 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-01 11:11:47 +00:00
|
|
|
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
2019-07-10 05:13:23 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-02-19 16:39:42 +00:00
|
|
|
defmodule Pleroma.Web.Metadata.PlayerView do
|
|
|
|
use Pleroma.Web, :view
|
|
|
|
import Phoenix.HTML.Tag, only: [content_tag: 3, tag: 2]
|
|
|
|
|
|
|
|
def render("player.html", %{"mediaType" => type, "href" => href}) do
|
2019-02-19 17:56:57 +00:00
|
|
|
{tag_type, tag_attrs} =
|
2019-02-19 16:39:42 +00:00
|
|
|
case type do
|
2019-02-19 17:56:57 +00:00
|
|
|
"audio" <> _ -> {:audio, []}
|
|
|
|
"video" <> _ -> {:video, [loop: true]}
|
2019-02-19 16:39:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
content_tag(
|
|
|
|
tag_type,
|
|
|
|
[
|
|
|
|
tag(:source, src: href, type: type),
|
|
|
|
"Your browser does not support #{type} playback."
|
|
|
|
],
|
2019-02-19 17:56:57 +00:00
|
|
|
[controls: true] ++ tag_attrs
|
2019-02-19 16:39:42 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|