Skip to content

Commit 02bc0d9

Browse files
committed
feat: allow loop and autoplay to public youtube stream
1 parent 131bd97 commit 02bc0d9

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

app/controllers/public/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export default class IndexController extends Controller {
2626
return !this.model.tickets.toArray().filter(ticket => ticket.type !== 'freeRegistration' && ticket.type !== 'free').length > 0;
2727
}
2828

29+
@computed
30+
get publicStreamLink() {
31+
let publicStreamLink = 'https://www.youtube.com/embed/' + this.model.event.publicStreamLink + '?'
32+
publicStreamLink += this.model.event.streamAutoplay ? 'autoplay=1' : 'autoplay=0';
33+
publicStreamLink += this.model.event.streamLoop ? '&loop=1' : '&loop=0';
34+
return publicStreamLink+'&playlist='+this.model.event.publicStreamLink;
35+
}
36+
2937
@action
3038
async createNewUserViaEmail(email, password) {
3139
this.set('isLoading', true);

app/models/event.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export default class Event extends ModelBase.extend(CustomPrimaryKeyMixin, {
3333
locationName : attr('string'),
3434
searchableLocationName : attr('string'),
3535

36-
publicStreamLink: attr('string'),
36+
publicStreamLink : attr('string'),
37+
streamLoop : attr('boolean', { defaultValue: false }),
38+
streamAutoplay : attr('boolean', { defaultValue: false }),
3739

3840
longitude : attr('number', { defaultValue: 0.0 }),
3941
latitude : attr('number', { defaultValue: 0.0 }),

app/templates/components/forms/wizard/basic-details-step.hbs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,23 @@
7474
<div class="mb-2 mt-2">
7575
{{t 'You can add video meeting rooms or streams after you created a draft of the event.'}}
7676
</div>
77-
<div class="field mt-6">
78-
<label for="stream">{{t 'Public Stream Link'}}</label>
77+
<div class="field mt-4 mb-4">
78+
<label for="stream">{{t 'Public Stream VideoId'}}</label>
7979
<Input
8080
@type="text"
8181
@id="stream"
8282
@value={{this.data.event.publicStreamLink}} />
83+
<label class="mt-4">{{t 'Autoplay'}}</label>
84+
<UiCheckbox
85+
@class="toggle"
86+
@checked={{this.data.event.streamAutoplay}}
87+
@onChange={{action (mut this.data.event.streamAutoplay) }} />
88+
<br>
89+
<label class="mt-4">{{t 'Loop'}}</label>
90+
<UiCheckbox
91+
@class="toggle"
92+
@checked={{this.data.event.streamLoop}}
93+
@onChange={{action (mut this.data.event.streamLoop) }} />
8394
</div>
8495
{{/if}}
8596
<br>

app/templates/public/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="event">
22
{{#if this.model.event.publicStreamLink}}
3-
<div class="iframe-container">
4-
<iframe class="responsive-iframe" title="{{this.model.event.name}}" src="{{this.model.event.publicStreamLink}}" allowfullscreen></iframe>
3+
<div class="iframe-container mb-4">
4+
<iframe class="responsive-iframe" title="{{this.model.event.name}}" src="{{this.publicStreamLink}}" allowfullscreen></iframe>
55
</div>
66
{{/if}}
77
{{#if this.model.event.description}}

0 commit comments

Comments
 (0)