Skip to content

Commit

Permalink
Readded click media functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Berchtold committed Sep 9, 2018
1 parent 9d51a66 commit 79fb345
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend-app/src/app/media/media.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h6 *ngIf="mediaType?.children?.constructor.name === 'Array'">
placement="bottom"
[ngbTooltip]="media?.name"
[dndDraggable]="{mediaTypeName: mediaType.name, clientName: client.name, mediaName: media.name}"
(click)="playMedia(mediaType.name, client.name, media.name)"
>
<img
class="d-flex"
Expand Down
37 changes: 37 additions & 0 deletions frontend-app/src/app/media/media.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,43 @@ export class MediaComponent implements OnInit {
return this.clients[this.selectedRoom].find(x => 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;
Expand Down

0 comments on commit 79fb345

Please sign in to comment.