2019-07-09 23:13:23 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2022-02-25 23:11:42 -07:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2019-07-09 23:13:23 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-02-19 09:39:42 -07: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 10:56:57 -07:00
|
|
|
{tag_type, tag_attrs} =
|
2019-02-19 09:39:42 -07:00
|
|
|
case type do
|
2019-02-19 10:56:57 -07:00
|
|
|
"audio" <> _ -> {:audio, []}
|
|
|
|
"video" <> _ -> {:video, [loop: true]}
|
2019-02-19 09:39:42 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
content_tag(
|
|
|
|
tag_type,
|
|
|
|
[
|
|
|
|
tag(:source, src: href, type: type),
|
|
|
|
"Your browser does not support #{type} playback."
|
|
|
|
],
|
2019-02-19 10:56:57 -07:00
|
|
|
[controls: true] ++ tag_attrs
|
2019-02-19 09:39:42 -07:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|