logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

player_view.ex (706B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Metadata.PlayerView do
  5. use Pleroma.Web, :view
  6. import Phoenix.HTML.Tag, only: [content_tag: 3, tag: 2]
  7. def render("player.html", %{"mediaType" => type, "href" => href}) do
  8. {tag_type, tag_attrs} =
  9. case type do
  10. "audio" <> _ -> {:audio, []}
  11. "video" <> _ -> {:video, [loop: true]}
  12. end
  13. content_tag(
  14. tag_type,
  15. [
  16. tag(:source, src: href, type: type),
  17. "Your browser does not support #{type} playback."
  18. ],
  19. [controls: true] ++ tag_attrs
  20. )
  21. end
  22. end