From 0201bcd4a945c74d06b466d61f15d49d4215d64e Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Sat, 29 May 2021 15:38:59 +0200 Subject: [PATCH] First attempt with plyr --- index.html | 119 ++++++++++++++++++++++++++++++++++---------------- src/Core.elm | 20 +++------ src/Views.elm | 26 ++--------- 3 files changed, 91 insertions(+), 74 deletions(-) diff --git a/index.html b/index.html index ddf5113..7b7a965 100644 --- a/index.html +++ b/index.html @@ -5,14 +5,90 @@ - + +
- + + diff --git a/src/Core.elm b/src/Core.elm index 3c7b327..3a50eba 100644 --- a/src/Core.elm +++ b/src/Core.elm @@ -231,28 +231,18 @@ update msg model = _ -> Nothing - ( page, cmd ) = + page = case ( playlist, video ) of ( Just p, Just v ) -> - ( Video p v Nothing - , Ports.registerVideo ( Twitch.videoId v, "videos/" ++ p.url ++ v.url, time ) - ) + Video p v Nothing ( Just p, Nothing ) -> - ( Playlist p Nothing, Cmd.none ) + Playlist p Nothing _ -> - ( Home Nothing, Cmd.none ) - - extraCmd = - case page of - Video _ _ _ -> - Cmd.none - - _ -> - Ports.eraseVideo () + Home Nothing in - ( { model | page = page }, Cmd.batch [ cmd, extraCmd ] ) + ( { model | page = page }, Cmd.none ) UrlRequested u -> case u of diff --git a/src/Views.elm b/src/Views.elm index 192a94b..42df04d 100644 --- a/src/Views.elm +++ b/src/Views.elm @@ -381,28 +381,10 @@ videoView darkMode device zone currentDate time hover playlist video = , Element.alignTop , Element.height Element.fill ] - [ Keyed.el - [ Element.width Element.fill - , Element.height (Element.px 0) - , Element.htmlAttribute (Html.Attributes.style "padding-top" "56.25%") - , Element.htmlAttribute (Html.Attributes.style "position" "relative") - ] - ( video.url - , Element.html - (Html.video - [ Html.Attributes.id (Twitch.videoId video) - , Html.Attributes.class "video-js" - , Html.Attributes.class "vjs-default-skin" - , Html.Attributes.class "wf" - , Html.Attributes.property "data-setup" (Encode.string "{\"fluid\": true}") - , Html.Attributes.style "position" "absolute" - , Html.Attributes.style "top" "0" - , Html.Attributes.style "height" "100%" - , Html.Attributes.controls True - , Html.Attributes.autoplay True - ] - [] - ) + [ Element.html + (Html.node "plyr-video" + [ Html.Attributes.attribute "src" ("videos/" ++ playlist.url ++ video.url ++ "manifest.m3u8") ] + [] ) , Element.paragraph [ Font.size Consts.homeFontSize