A minimal web player written in Elm, just for fun. The goals was a minimal web-app that can be hosted on my Minio (s3) next to the video content.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
minimal-webplayer/src/View.elm

68 lines
1.7 KiB

module View exposing (..)
import Browser exposing (Document)
import Dropdown
import Html
import Html.Attributes
import Msg
import Model exposing (Model)
import Video
view : Model -> Document Msg.Msg
view model =
{ title = "Minimal WebPlayer"
, body =
[ dropdown model.videos
, player model
, download model
, Html.footer []
[ Html.text "Handmade with love (and Vim and elm) ;)"
, Html.a
[ Html.Attributes.href "https://gitea.code-infection.com/efertone/minimal-webplayer"
, Html.Attributes.target "_blank"
]
[ Html.text "source" ]
]
]
}
dropdown : List Video.Video -> Html.Html Msg.Msg
dropdown videos =
if List.isEmpty videos then
Html.div [] [ Html.text "Please wait..." ]
else
Dropdown.view
{ options = List.map (\v -> { value = v.path, display = v.title }) videos
, selectEvent = Msg.VideoSelected
, default = { value = "", display = "Select one please ;)" }
}
player : Model -> Html.Html Msg.Msg
player model =
Video.makePlayer
{ path = model.selected
, extensions = model.extensions
, attrs =
[ Html.Attributes.width 960
, Html.Attributes.height 650
, Html.Attributes.controls True
]
}
download : Model -> Html.Html Msg.Msg
download model =
Video.downloadList
{ selected =
if not model.withDownload then
Nothing
else
model.selected
, extensions = model.extensions
, attrs = [ Html.Attributes.class "downloadList" ]
}