Merge branch 'master' of https://github.com/gabek/owncast
This commit is contained in:
@@ -33,21 +33,24 @@ async function setupApp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getStatus() {
|
async function getStatus() {
|
||||||
let url = "/status";
|
const url = "/status";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
const status = await response.json(); // read response body and parse as JSON
|
const status = await response.json();
|
||||||
|
|
||||||
if (!app.isOnline && status.online) {
|
if (!app.isOnline && status.online) {
|
||||||
// The stream was offline, but now it's online. Force start of playback after an arbitrary
|
// The stream was offline, but now it's online. Force start of playback after an arbitrary
|
||||||
// delay to make sure the stream has actual data ready to go.
|
// delay to make sure the stream has actual data ready to go.
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var player = videojs('video');
|
try {
|
||||||
player.pause()
|
const player = videojs('video');
|
||||||
player.src(player.src()); // Reload the same video
|
player.src(player.src()); // Reload the same video
|
||||||
player.load();
|
player.load();
|
||||||
player.play();
|
player.play();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
}, 3000)
|
}, 3000)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -113,7 +116,12 @@ function setupWebsocket() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupApp()
|
setupApp()
|
||||||
getStatus()
|
|
||||||
setupWebsocket()
|
// Wait until the player is setup before we start polling status
|
||||||
setInterval(getStatus, 5000)
|
videojs.hookOnce('setup', function (player) {
|
||||||
|
getStatus();
|
||||||
|
setInterval(getStatus, 5000);
|
||||||
|
});
|
||||||
|
|
||||||
|
setupWebsocket()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user