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.
|
||||
|
||||
## 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)
|
||||
|
||||
- **Feature**: Use GPS location data for timezone calculation.
|
||||
|
|
|
@ -193,20 +193,35 @@ class VideoContentSetup {
|
|||
},
|
||||
}));
|
||||
|
||||
// Fallbacks
|
||||
let directFailed = false;
|
||||
let hlsFailed = false;
|
||||
|
||||
vjs.on("error", () => {
|
||||
if (vjs.src(undefined).includes("m3u8")) {
|
||||
// HLS could not be streamed
|
||||
console.error("Video.js: HLS stream could not be opened.");
|
||||
hlsFailed = true;
|
||||
console.warn("PsVideo: HLS stream could not be opened.");
|
||||
|
||||
if (getCurrentUser()?.isAdmin) {
|
||||
showError(t("memories", "Transcoding failed, check Nextcloud logs."));
|
||||
}
|
||||
|
||||
vjs.src({
|
||||
src: content.data.src,
|
||||
type: "video/mp4",
|
||||
});
|
||||
this.updateRotation(content, 0);
|
||||
if (!directFailed) {
|
||||
console.warn("PsVideo: Trying direct video stream");
|
||||
vjs.src({
|
||||
src: content.data.src,
|
||||
type: "video/mp4",
|
||||
});
|
||||
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));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue