diff --git a/lib/grasstube/video.ex b/lib/grasstube/video.ex index b469b49..7eedd00 100644 --- a/lib/grasstube/video.ex +++ b/lib/grasstube/video.ex @@ -203,7 +203,9 @@ defmodule Grasstube.VideoAgent do def autopaused?(pid), do: Agent.get(pid, & &1.autopaused) - def autopause?(pid) do + def autopause?(pid), do: Agent.get(pid, & &1.autopause) + + def can_autopause?(pid) do Agent.get( pid, &(&1.autopause and &1.current_video != :nothing and &1.current_video.type == "default") diff --git a/lib/grasstube_web/live/video_live.ex b/lib/grasstube_web/live/video_live.ex index 1832ca2..5bd65c0 100644 --- a/lib/grasstube_web/live/video_live.ex +++ b/lib/grasstube_web/live/video_live.ex @@ -134,7 +134,7 @@ defmodule GrasstubeWeb.VideoLive do buffered: buffered }) - if VideoAgent.autopause?(socket.assigns.video) do + if VideoAgent.can_autopause?(socket.assigns.video) do if buffered > 0 do Presence.list(socket.assigns.topic) |> Enum.map(&elem(&1, 1))