hls-player-js/hls-player.js

23 lines
584 B
JavaScript

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