diff --git a/core/frontend/src/components/video-manager/VideoDevice.vue b/core/frontend/src/components/video-manager/VideoDevice.vue index 6d8fe776dd..89f7dc8e90 100644 --- a/core/frontend/src/components/video-manager/VideoDevice.vue +++ b/core/frontend/src/components/video-manager/VideoDevice.vue @@ -15,7 +15,10 @@ mdi-circle - + + Video source is blocked + + No streams added to this video source @@ -43,12 +46,21 @@ mdi-plus Add stream +
@@ -104,6 +116,7 @@ import Vue, { PropType } from 'vue' import SpinningLogo from '@/components/common/SpinningLogo.vue' +import settings from '@/libs/settings' import video from '@/store/video' import { CreatedStream, Device, StreamStatus, @@ -160,7 +173,13 @@ export default Vue.extend({ (stream) => stream.video_and_stream.stream_information?.extended_configuration?.disable_thumbnails === true, ) }, + is_pirate_mode(): boolean { + return settings.is_pirate_mode + }, status_color(): string { + if (this.device.blocked) { + return 'warning' + } if (!this.are_video_streams_available) { return 'grey' } @@ -178,6 +197,14 @@ export default Vue.extend({ this.show_stream_creation_dialog = true }, + async toggleBlocked(): Promise { + if (this.device.blocked) { + await video.unblockSource(this.device.source) + } else { + await video.blockSource(this.device.source) + } + }, + async createNewStream(stream: CreatedStream): Promise { await video.createStream(stream) }, diff --git a/core/frontend/src/store/video.ts b/core/frontend/src/store/video.ts index 345c05489a..fe6a67b397 100644 --- a/core/frontend/src/store/video.ts +++ b/core/frontend/src/store/video.ts @@ -245,6 +245,42 @@ class VideoStore extends VuexModule { } } + @Action + async blockSource(source: string): Promise { + await back_axios({ + method: 'post', + url: `${this.API_URL}/block_source`, + timeout: 10000, + params: { source_string: source }, + }) + .then(() => { + this.fetchDevices() + this.fetchStreams() + }) + .catch((error) => { + const message = `Could not block video source: ${error.message}.` + notifier.pushError('VIDEO_SOURCE_BLOCK_FAIL', message) + }) + } + + @Action + async unblockSource(source: string): Promise { + await back_axios({ + method: 'post', + url: `${this.API_URL}/unblock_source`, + timeout: 10000, + params: { source_string: source }, + }) + .then(() => { + this.fetchDevices() + this.fetchStreams() + }) + .catch((error) => { + const message = `Could not unblock video source: ${error.message}.` + notifier.pushError('VIDEO_SOURCE_UNBLOCK_FAIL', message) + }) + } + @Action async resetSettings(): Promise { await back_axios({ diff --git a/core/frontend/src/types/video.ts b/core/frontend/src/types/video.ts index d9a73b4ca6..139470e8a8 100644 --- a/core/frontend/src/types/video.ts +++ b/core/frontend/src/types/video.ts @@ -98,6 +98,7 @@ export interface Device { source: string formats: Format[] controls: Control[] + blocked?: boolean } export enum VideoCaptureType {