Skip to content

Commit

Permalink
better error msg on live view when misconfigured
Browse files Browse the repository at this point in the history
Improves (but doesn't fix) #119 and #120.
  • Loading branch information
scottlamb committed Aug 13, 2021
1 parent 42cf77f commit b8b5038
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions design/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Example response:
"maxEndTime90k": 130985466591817,
"totalDuration90k": 96736169725,
"totalSampleFileBytes": 446774393937,
"record": true,
"days": {
"2016-05-01": {
"endTime90k": 131595516000000,
Expand Down
3 changes: 0 additions & 3 deletions guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions server/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions ui/src/Live/LiveCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions ui/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface Stream {
totalSampleFileBytes: number;
fsBytes: number;
days: Record<string, Day>;
record: boolean;
}

export interface Day {
Expand Down

0 comments on commit b8b5038

Please sign in to comment.