basic playlist loading

This commit is contained in:
Muaz Ahmad 2023-08-22 15:44:32 +05:00
commit 1688b36e39

23
hls-player.js Normal file
View file

@ -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()