From 79fb345af7300ec21520d2ac82bb33ca060d2ed9 Mon Sep 17 00:00:00 2001 From: Marc Berchtold Date: Sun, 9 Sep 2018 14:16:15 +0200 Subject: [PATCH] Readded click media functionality --- .../src/app/media/media.component.html | 1 + frontend-app/src/app/media/media.component.ts | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/frontend-app/src/app/media/media.component.html b/frontend-app/src/app/media/media.component.html index 04b8c5a..d23ada2 100644 --- a/frontend-app/src/app/media/media.component.html +++ b/frontend-app/src/app/media/media.component.html @@ -25,6 +25,7 @@
placement="bottom" [ngbTooltip]="media?.name" [dndDraggable]="{mediaTypeName: mediaType.name, clientName: client.name, mediaName: media.name}" + (click)="playMedia(mediaType.name, client.name, media.name)" > x.clientname === clientName); } + playMedia(folderName: string, clientName: string, fileName: string) { + const uid = this.getClientByClientname(clientName).uid; + const mediaId = `${this.selectedRoom}/${clientName}/${folderName}/${fileName}`; + switch (folderName) { + case 'videos': + this.mqttService.mqttModule.mqttClient.publish(`ar-signage/${this.selectedRoom}/${uid}/media`, JSON.stringify({ + value: { + type: 'video', + content: mediaId, + } + }), {retain: true}); + break; + case 'images': + this.mqttService.mqttModule.mqttClient.publish(`ar-signage/${this.selectedRoom}/${uid}/media`, JSON.stringify({ + value: { + type: 'image', + content: mediaId, + } + }), {retain: true}); + break; + case 'audio_oneshot': + this.mqttService.mqttModule.mqttClient.publish(`ar-signage/${this.selectedRoom}/${uid}/audio/oneshot`, JSON.stringify({ + value: mediaId, + })); + break; + case 'audio_background': + this.mqttService.mqttModule.mqttClient.publish(`ar-signage/${this.selectedRoom}/${uid}/audio/background`, JSON.stringify({ + value: mediaId, + }), {retain: true}); + this.mqttService.mqttModule.mqttClient.publish(`ar-signage/${this.selectedRoom}/${uid}/audio/background/control`, JSON.stringify({ + value: 'START', + }), {retain: true}); + break; + } + } + + private mqttMessageHandler(topic, message) { let messageObject; let roomname, uid;