Fix url thingy

This commit is contained in:
Thomas Forgione 2021-06-09 18:59:20 +02:00
parent 4a79341245
commit 22fd24c13e
2 changed files with 11 additions and 10 deletions

View File

@ -31,14 +31,15 @@
}
});
var app = Elm.Main.init({
const app = Elm.Main.init({
node: document.getElementById('container'),
flags: "video/manifest.m3u8",
});
app.ports.initVideo.subscribe(function() {
app.ports.initVideo.subscribe(function(arg) {
const video = document.getElementById('video');
const hls = new Hls();
hls.loadSource('video/manifest.m3u8');
hls.loadSource(arg);
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
// Transform available levels into an array of integers (height values).

View File

@ -14,10 +14,10 @@ import Icons
import Json.Decode as Decode
main : Program Decode.Value Model Msg
main : Program String Model Msg
main =
Browser.application
{ init = \_ _ _ -> init
{ init = \url _ _ -> init url
, update = update
, view = view
, subscriptions = \_ -> nowHasQualities NowHasQualities
@ -55,10 +55,10 @@ type Msg
| NowHasQualities (List Int)
init : ( Model, Cmd Msg )
init =
init : String -> ( Model, Cmd Msg )
init url =
( Model
"video/manifest.m3u8"
url
False
0.0
1.0
@ -67,7 +67,7 @@ init =
False
False
[]
, initVideo ()
, initVideo url
)
@ -393,7 +393,7 @@ formatTime s =
hoursString ++ minutesString ++ ":" ++ secsString
port initVideo : () -> Cmd msg
port initVideo : String -> Cmd msg
port playPause : () -> Cmd msg