Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
fix stream callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandawg93 committed Mar 3, 2021
1 parent 3b41483 commit ad99d29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ export class NestAccessory {
name: string,
serviceType: ServiceType,
_key: keyof Properties,
cb: (value: CharacteristicValue) => void,
cb: (value: CharacteristicValue) => Promise<void>,
): void {
const service = this.createService(serviceType, name);
this.log.debug(`Creating switch for ${this.accessory.displayName} ${name}.`);
service
.setCharacteristic(this.hap.Characteristic.On, this.camera.info.properties[_key])
.getCharacteristic(this.hap.Characteristic.On)
.on(CharacteristicEventTypes.SET, async (value: CharacteristicValue, callback: CharacteristicSetCallback) => {
.on(CharacteristicEventTypes.SET, (value: CharacteristicValue, callback: CharacteristicSetCallback) => {
cb(value);
this.log.info(`Setting ${this.accessory.displayName} ${name} to ${value ? 'on' : 'off'}`);
callback();
})
.on(CharacteristicEventTypes.GET, async (callback: CharacteristicGetCallback) => {
.on(CharacteristicEventTypes.GET, (callback: CharacteristicGetCallback) => {
callback(undefined, this.camera.info.properties[_key]);
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/ffmpeg.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import execa from 'execa';
import { Logging, StreamRequestCallback } from 'homebridge';
import { Logging } from 'homebridge';
import { StreamingDelegate } from './streaming-delegate';
import { Readable, Writable } from 'stream';
import pathToFfmpeg from 'ffmpeg-for-homebridge';
Expand Down Expand Up @@ -47,11 +47,11 @@ export class FfmpegProcess {
title: string,
command: Array<string>,
log: Logging,
callback: StreamRequestCallback | undefined,
delegate: StreamingDelegate,
sessionId: string,
ffmpegDebugOutput: boolean,
customFfmpeg?: string,
callback?: (error?: Error | undefined) => void,
) {
let started = false;
const controller = delegate.controller;
Expand Down
6 changes: 3 additions & 3 deletions src/streaming-delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,13 @@ export class StreamingDelegate implements CameraStreamingDelegate {
'VIDEO',
videoffmpegCommand,
this.log,
callback,
this,
sessionId,
false,
this.customFfmpeg,
(error) => {
callback(error);
},
);

let ffmpegAudio: FfmpegProcess | undefined;
Expand All @@ -384,7 +386,6 @@ export class StreamingDelegate implements CameraStreamingDelegate {
'AUDIO',
audioffmpegCommand,
this.log,
undefined,
this,
sessionId,
false,
Expand All @@ -399,7 +400,6 @@ export class StreamingDelegate implements CameraStreamingDelegate {
'RETURN AUDIO',
returnAudioffmpegCommand,
this.log,
undefined,
this,
sessionId,
false,
Expand Down

0 comments on commit ad99d29

Please sign in to comment.