fetch playlist on timer
This commit is contained in:
parent
4be364ce2e
commit
f4c54fc43c
1 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@ class PlaylistLoader {
|
|||
this.last_segment = null;
|
||||
this.refresh_interval = null;
|
||||
this.new_segments = [];
|
||||
this.fetch_playlist();
|
||||
}
|
||||
|
||||
fetch_playlist() {
|
||||
|
@ -13,6 +14,7 @@ class PlaylistLoader {
|
|||
xmlHttp.onreadystatechange = ( function() {
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||
this.parse_playlist(xmlHttp.responseText);
|
||||
setTimeout(this.fetch_playlist.bind(this), this.refresh_interval * 1000);
|
||||
}
|
||||
} ).bind(this)
|
||||
xmlHttp.open("GET", this.playlist_src, true);
|
||||
|
@ -44,4 +46,3 @@ class PlaylistLoader {
|
|||
}
|
||||
|
||||
var test = new PlaylistLoader();
|
||||
test.fetch_playlist()
|
||||
|
|
Loading…
Reference in a new issue