Skip to content

Commit 81565c9

Browse files
committed
Added type definition for ffmpeg-for-homebridge
1 parent 4f0f3b9 commit 81565c9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ffmpeg-for-homebridge.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module 'ffmpeg-for-homebridge' {
2+
const ffmpeg_for_homebridge: string;
3+
export = ffmpeg_for_homebridge;
4+
}

src/streamingDelegate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import {
2121
} from 'homebridge';
2222
import { spawn } from 'child_process';
2323
import { createSocket, Socket } from 'dgram';
24+
import ffmpegPath from 'ffmpeg-for-homebridge';
2425
import getPort from 'get-port';
2526
import os from 'os';
2627
import { networkInterfaceDefault } from 'systeminformation';
2728
import { CameraConfig, VideoConfig } from './configTypes';
2829
import { FfmpegProcess } from './ffmpeg';
2930
import { Logger } from './logger';
30-
const pathToFfmpeg = require('ffmpeg-for-homebridge'); // eslint-disable-line @typescript-eslint/no-var-requires
3131

3232
type SessionInfo = {
3333
address: string; // address of the HAP controller
@@ -80,7 +80,7 @@ export class StreamingDelegate implements CameraStreamingDelegate {
8080
this.hap = hap;
8181

8282
this.cameraName = cameraConfig.name;
83-
this.videoProcessor = videoProcessor || pathToFfmpeg || 'ffmpeg';
83+
this.videoProcessor = videoProcessor || ffmpegPath || 'ffmpeg';
8484
this.interfaceName = interfaceName;
8585

8686
api.on(APIEvent.SHUTDOWN, () => {

0 commit comments

Comments
 (0)