psvideo: fallback to HLS if direct fails (#364)
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/563/head
parent
56dd81e747
commit
674a5da53c
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
This file is manually updated. Please file an issue if something is missing.
|
This file is manually updated. Please file an issue if something is missing.
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- **Feature**: "Direct" video playback will now fall back to HLS (transcoding) if playback fails (e.g. due to lack of browser support).
|
||||||
|
|
||||||
## v4.13.0 (2023-04-03)
|
## v4.13.0 (2023-04-03)
|
||||||
|
|
||||||
- **Feature**: Use GPS location data for timezone calculation.
|
- **Feature**: Use GPS location data for timezone calculation.
|
||||||
|
|
|
@ -193,21 +193,36 @@ class VideoContentSetup {
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Fallbacks
|
||||||
|
let directFailed = false;
|
||||||
|
let hlsFailed = false;
|
||||||
|
|
||||||
vjs.on("error", () => {
|
vjs.on("error", () => {
|
||||||
if (vjs.src(undefined).includes("m3u8")) {
|
if (vjs.src(undefined).includes("m3u8")) {
|
||||||
// HLS could not be streamed
|
hlsFailed = true;
|
||||||
console.error("Video.js: HLS stream could not be opened.");
|
console.warn("PsVideo: HLS stream could not be opened.");
|
||||||
|
|
||||||
if (getCurrentUser()?.isAdmin) {
|
if (getCurrentUser()?.isAdmin) {
|
||||||
showError(t("memories", "Transcoding failed, check Nextcloud logs."));
|
showError(t("memories", "Transcoding failed, check Nextcloud logs."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!directFailed) {
|
||||||
|
console.warn("PsVideo: Trying direct video stream");
|
||||||
vjs.src({
|
vjs.src({
|
||||||
src: content.data.src,
|
src: content.data.src,
|
||||||
type: "video/mp4",
|
type: "video/mp4",
|
||||||
});
|
});
|
||||||
this.updateRotation(content, 0);
|
this.updateRotation(content, 0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
directFailed = true;
|
||||||
|
console.warn("PsVideo: Direct video stream could not be opened.");
|
||||||
|
|
||||||
|
if (!hlsFailed && !config_noTranscode) {
|
||||||
|
console.warn("PsVideo: Trying HLS stream");
|
||||||
|
vjs.src(this.getHLSsrc(content));
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
Loading…
Reference in New Issue