better error msg on live view when misconfigured

Improves (but doesn't fix) #119 and #120.
This commit is contained in:
Scott Lamb 2021-08-13 12:02:42 -07:00
parent 42cf77f0d6
commit b8b5038f71
6 changed files with 15 additions and 4 deletions

View File

@ -14,7 +14,8 @@ Each release is tagged in Git and on the Docker repository
workaround, so anamorphic videos looked correct on Chrome but slightly
stretched on Firefox. Now both live streams and playback are fully correct
on all browsers.
* UI: better error message on browsers where live view is unsupported.
* UI: better error messages on live view when browser is unsupported,
`sub` stream is unconfigured, or `sub` stream is not set to record.
* upgrade to retina v0.1.0, which uses `SET_PARAMETERS` rather than
`GET_PARAMETERS` as a RTSP keepalive. GW Security cameras would ignored
the latter, causing Moonfire NVR to drop the connection every minute.

View File

@ -177,6 +177,7 @@ Example response:
"maxEndTime90k": 130985466591817,
"totalDuration90k": 96736169725,
"totalSampleFileBytes": 446774393937,
"record": true,
"days": {
"2016-05-01": {
"endTime90k": 131595516000000,

View File

@ -399,9 +399,6 @@ here are some things to check:
guide](schema.md) prior to 29 Feb 2020, look at [this
update](https://github.com/scottlamb/moonfire-nvr/commit/92266612b5c9163eb6096c580ba751280a403648#diff-e8bdd96dda101a25a541a6629675ea46bd6eaf670c6417c76662db5397c50c19)
to those instructions.
* The live view currently only uses the `sub` stream. If you configure only
a `main` stream on your cameras, you will see this error consistently.
[#119](https://github.com/scottlamb/moonfire-nvr/issues/119)
### Errors in kernel logs

View File

@ -83,6 +83,7 @@ pub struct Stream<'a> {
pub total_duration_90k: Duration,
pub total_sample_file_bytes: i64,
pub fs_bytes: i64,
pub record: bool,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(serialize_with = "Stream::serialize_days")]
@ -243,6 +244,7 @@ impl<'a> Stream<'a> {
total_duration_90k: s.duration,
total_sample_file_bytes: s.sample_file_bytes,
fs_bytes: s.fs_bytes,
record: s.record,
days: if include_days { Some(s.days()) } else { None },
config: match include_config {
false => None,

View File

@ -80,6 +80,15 @@ class LiveCameraDriver {
if (this.ws !== undefined) {
return;
}
const subStream = this.camera.streams.sub;
if (subStream === undefined || !subStream.record) {
this.error(
"Must have sub stream set to record; see " +
"https://github.com/scottlamb/moonfire-nvr/issues/119 and " +
"https://github.com/scottlamb/moonfire-nvr/issues/120"
);
return;
}
console.log(`${this.camera.shortName}: starting stream: ${reason}`);
const loc = window.location;
const proto = loc.protocol === "https:" ? "wss" : "ws";

View File

@ -31,6 +31,7 @@ export interface Stream {
totalSampleFileBytes: number;
fsBytes: number;
days: Record<string, Day>;
record: boolean;
}
export interface Day {