Merge branch 'fix/twittercards' into 'develop'
[akkoma] / lib / pleroma / web / metadata / player_view.ex
1 defmodule Pleroma.Web.Metadata.PlayerView do
2 use Pleroma.Web, :view
3 import Phoenix.HTML.Tag, only: [content_tag: 3, tag: 2]
4
5 def render("player.html", %{"mediaType" => type, "href" => href}) do
6 {tag_type, tag_attrs} =
7 case type do
8 "audio" <> _ -> {:audio, []}
9 "video" <> _ -> {:video, [loop: true]}
10 end
11
12 content_tag(
13 tag_type,
14 [
15 tag(:source, src: href, type: type),
16 "Your browser does not support #{type} playback."
17 ],
18 [controls: true] ++ tag_attrs
19 )
20 end
21 end