Big play button only when not has started

This commit is contained in:
Thomas Forgione 2021-06-21 15:42:12 +02:00
parent b41c62e938
commit 082e7f0f92
2 changed files with 15 additions and 5 deletions

View File

@ -19,7 +19,8 @@ import Video.Quality as Quality exposing (Quality)
type alias Video = type alias Video =
{ url : String { hasStarted : Bool
, url : String
, id : String , id : String
, playing : Bool , playing : Bool
, position : Float , position : Float
@ -53,7 +54,8 @@ type alias Config =
fromConfig : Config -> ( Video, Cmd Msg ) fromConfig : Config -> ( Video, Cmd Msg )
fromConfig config = fromConfig config =
( { url = config.url ( { hasStarted = False
, url = config.url
, id = config.id , id = config.id
, playing = False , playing = False
, position = 0 , position = 0
@ -230,7 +232,7 @@ update msg model =
( { model | animationFrame = 0 }, Cmd.none ) ( { model | animationFrame = 0 }, Cmd.none )
NowPlaying -> NowPlaying ->
( { model | playing = True }, Cmd.none ) ( { model | playing = True, hasStarted = True }, Cmd.none )
NowPaused -> NowPaused ->
( { model | playing = False }, Cmd.none ) ( { model | playing = False }, Cmd.none )

View File

@ -260,8 +260,16 @@ overlay model =
:: Font.color (Element.rgb 1 1 1) :: Font.color (Element.rgb 1 1 1)
:: Events.overlay :: Events.overlay
) )
(case model.showIcon of (case ( not model.playing && not model.hasStarted, model.showIcon ) of
Just icon -> ( True, _ ) ->
Element.el
[ Element.centerX
, Element.centerY
, Element.scale 10
]
(Icons.play True)
( _, Just icon ) ->
animatedEl fadeOutZoom animatedEl fadeOutZoom
[ Background.color (Element.rgb 0 0 0) [ Background.color (Element.rgb 0 0 0)
, Border.rounded 100 , Border.rounded 100