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

100 lines
2.7 KiB

module View exposing (..)
import Browser exposing (Document)
import Dropdown
import Html
import Html.Attributes
import Model exposing (Model)
import Msg
import Video
view : Model -> Document Msg.Msg
view model =
{ title = "Minimal WebPlayer"
, body =
[ dropdown model.videos
, player model
, download model
, text 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" ]
]
]
}
text : Model -> Html.Html Msg.Msg
text model =
if model.showExtraText then
Html.p
[ Html.Attributes.class "extra-text" ]
[ Html.strong [] [ Html.text model.extraText.title ]
, Html.span [] [ Html.text model.extraText.content ]
]
else
Html.span [] []
text2 : Html.Html Msg.Msg
text2 =
Html.p
[ Html.Attributes.class "extra-text" ]
[ Html.strong [] [ Html.text "Why are these available here?" ]
, Html.span []
[ Html.text
"""
I have no intention to make pirate copy of all these videos,"
but I think they are useful or interesting. The UI of cube365
is very slow and painful to use and all VODs are available only there.
The other reason is, it requires a cube365 registration which I don't
think is necessary, not only unnecessary, but annoying as well.
"""
]
]
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" ]
}