Skip to content

Commit

Permalink
Add QR code to TV Player
Browse files Browse the repository at this point in the history
  • Loading branch information
mintopia committed Jun 18, 2024
1 parent 7cc72b6 commit 2c59a78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions resources/js/components/TvPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
</template>
</div>
</div>
<div class="qr">
<img v-bind:src="qrCodeUrl" />
</div>
</div>
</div>
</template>
Expand All @@ -92,6 +95,12 @@
padding: 1em;
}
.qr {
position: absolute;
bottom: 20px;
left: 20px;
}
.blur-bg {
backdrop-filter: blur(2px);
background-repeat: no-repeat;
Expand Down Expand Up @@ -126,6 +135,7 @@
export default {
props: [
'code',
'partyurl',
'initialstate',
],
data() {
Expand All @@ -136,6 +146,7 @@
progress: '',
startedAt: null,
intervalId: null,
qrCodeUrl: null,
}
},
Expand Down Expand Up @@ -202,6 +213,7 @@
mounted() {
this.updateState(JSON.parse(this.initialstate));
let channel = `party.${this.code}`;
this.qrCodeUrl = `https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=${this.partyurl}`;
window.Echo.channel(channel).listen('Party\\UpdatedEvent', (payload) => {
this.updateState(payload);
});
Expand Down
1 change: 1 addition & 0 deletions resources/views/parties/tv.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<div id="app">
<tv-player
code="{{ $party->code }}"
partyUrl="{{ route('parties.show', $party->code) }}"
initialstate='@json($party->getState())'
>
</tv-player>
Expand Down

0 comments on commit 2c59a78

Please sign in to comment.