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