Skip to content

Commit

Permalink
Merge branch 'main' of github.com:koush/scrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 22, 2023
2 parents 771bbd8 + 418724f commit 5dc1af7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/ring/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/ring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
"got": "11.8.6",
"socket.io-client": "^2.5.0"
},
"version": "0.0.105"
"version": "0.0.106"
}
20 changes: 14 additions & 6 deletions plugins/ring/src/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,17 +731,25 @@ export class RingCameraDevice extends ScryptedDeviceBase implements DeviceProvid
}

async getVideoClip(videoId: string): Promise<MediaObject> {
if (this.videoClips.has(videoId)) {
return mediaManager.createMediaObjectFromUrl(this.videoClips.get(videoId).resources.video.href);
if (!this.videoClips.has(videoId)) {
throw new Error('Failed to get video clip.');
}
throw new Error('Failed to get video clip.')
return mediaManager.createMediaObjectFromUrl(this.videoClips.get(videoId).resources.video.href);
}

async getVideoClipThumbnail(thumbnailId: string): Promise<MediaObject> {
if (this.videoClips.has(thumbnailId)) {
return mediaManager.createMediaObjectFromUrl(this.videoClips.get(thumbnailId).resources.thumbnail.href);
if (!this.videoClips.has(thumbnailId)) {
throw new Error('Failed to get video clip thumbnail.');
}
throw new Error('Failed to get video clip thumbnail.')
const ffmpegInput: FFmpegInput = {
inputArguments: [
'-f', 'h264',
'-i', this.videoClips.get(thumbnailId).resources.thumbnail.href,
]
};
const input = await mediaManager.createFFmpegMediaObject(ffmpegInput);
const jpeg = await mediaManager.convertMediaObjectToBuffer(input, 'image/jpeg');
return await mediaManager.createMediaObject(jpeg, 'image/jpeg');
}

async removeVideoClips(...videoClipIds: string[]): Promise<void> {
Expand Down

0 comments on commit 5dc1af7

Please sign in to comment.