Skip to content

Commit

Permalink
feat: support ip camera streams
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Nov 12, 2020
1 parent 6e09088 commit a055bce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/cards/dashboard/CameraCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
title="Camera"
icon="$camera"
:collapsed="true">
<img :src="cameraUrl" class="webcam" :style="cameraTransforms" />

<img :src="cameraUrl" class="webcam" :style="cameraTransforms" v-if="streamType === 'mjpgstreamer'" />
<video :src="cameraUrl" autoplay class="webcam" :style="cameraTransforms" v-if="streamType === 'ipcamera'" />
</collapsable-card>
</template>

Expand All @@ -20,6 +22,10 @@ import DialogConfirm from '@/components/dialogs/dialogConfirm.vue'
}
})
export default class CameraCard extends Mixins(UtilsMixin) {
get streamType () {
return this.$store.state.config.fileConfig.camera.type
}
get cameraUrl (): string {
return this.$store.state.config.fileConfig.camera.url
}
Expand Down
15 changes: 15 additions & 0 deletions src/components/cards/settings/CameraSettingsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@
v-model="flipX">
</v-switch>
<v-switch
class="mb-4"
label="Flip vertically"
hide-details
v-model="flipY">
</v-switch>
<v-select
label="Stream type"
hide-details="auto"
:items="[{ text: 'mjpgstreamer', value: 'mjpgstreamer' }, { text: 'ip camera', value: 'ipcamera' }]"
v-model="streamType">
</v-select>
<v-text-field
class="mt-5"
filled
Expand Down Expand Up @@ -69,5 +76,13 @@ export default class CameraSettingsCard extends Mixins(UtilsMixin) {
set flipY (value: boolean) {
this.$store.dispatch('config/saveGeneric', { key: 'fileConfig.camera.flipY', value })
}
get streamType () {
return this.$store.state.config.fileConfig.camera.type
}
set streamType (value: string) {
this.$store.dispatch('config/saveGeneric', { key: 'fileConfig.camera.type', value })
}
}
</script>
1 change: 1 addition & 0 deletions src/store/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const state: ConfigState = {
},
camera: {
enabled: false,
type: 'mjpgstreamer',
url: '/webcam/?action=stream',
flipX: false,
flipY: false
Expand Down
1 change: 1 addition & 0 deletions src/store/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface AxisConfig {

export interface CameraConfig {
enabled: boolean;
type: 'mjpgstreamer' | 'ipcamera';
url: string;
flipX: boolean;
flipY: boolean;
Expand Down

0 comments on commit a055bce

Please sign in to comment.