basic playlist loading
This commit is contained in:
commit
1688b36e39
1 changed files with 23 additions and 0 deletions
23
hls-player.js
Normal file
23
hls-player.js
Normal 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()
|
Loading…
Reference in a new issue