commit 1688b36e3999d368284841b1b55cc539ab8ee81c Author: Muaz Ahmad Date: Tue Aug 22 15:44:32 2023 +0500 basic playlist loading diff --git a/hls-player.js b/hls-player.js new file mode 100644 index 0000000..2086af9 --- /dev/null +++ b/hls-player.js @@ -0,0 +1,23 @@ +var player = document.getElementById('vid1'); + +class PlaylistLoader { + constructor() { + this.playlist_src = '/list/' + window.location.pathname.slice(6); + this.last_segment = null; + this.refresh_interval = null; + this.new_segments = []; + } + fetch_playlist() { + var xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function() { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + console.log(xmlHttp.responseText); + } + } + xmlHttp.open("GET", this.playlist_src, true); + xmlHttp.send(null); + } +} + +var test = new PlaylistLoader(); +test.fetch_playlist()