Skip to content

Commit

Permalink
Merge branch 'development' into fix-contributor-guidlines
Browse files Browse the repository at this point in the history
  • Loading branch information
sergyDwhiz authored Mar 23, 2024
2 parents ba80a13 + 12b957b commit 7fa143e
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 194 deletions.
48 changes: 23 additions & 25 deletions app/components/public/stream/side-panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,39 @@
<div class="chat-video-room">
<div>
<div class="ui inverted vertical fluid menu borderless stream-side-menu">
{{#each this.streamList as |stream|}}
<a href={{href-to 'public.stream.view' @event stream.slugName stream.id }} class="{{if (eq @currentRoom.microlocationId stream.microlocationId) 'video-active'}} item stream-item d-flex items-center" {{on "click" (fn @setupRoomChat stream) }} >
{{#each this.streams as |stream|}}
<a href={{href-to 'public.stream.view' @event stream.slugName stream.id }} class="{{if (eq @currentRoom.microlocationId stream.microlocationId) 'video-active'}} item stream-item d-flex items-center" {{on "click" (fn @setupRoomChat stream) }}>

<span class="stream-preview-letter" style={{css background-color=(object-at (abs (mod stream.hash this.colors.length)) this.colors)}}>{{truncate (uppercase stream.name) 1 false}}</span>
<span class="ml-2">{{stream.name}}</span>
{{#if (gt stream.translations.length 1)}}
<div class="block-side-panel">
<div class="translation-dropdown-button translation-dropdown-container">
<div style="display:inline-block;margin-left:auto">
<div class="translation-dropdown-button translation-dropdown-container ">
<UiDropdown class="btn btn-secondary dropdown-toggle"
@selected={{this.selectingLanguage.getName}}
@onChange={{ action "switchLanguage"}} as |execute mapper|
{{action 'switchRoom' stream}} >
<div class="{{if (and this.selectingLanguage.getName (eq @currentRoom.id stream.id)) 'translate-hidden'}} translation-dropdown-wrapper">
<div class="translation-dropdown-component">
<i class="language icon"></i>
</div>
<div class="translation-dropdown-component translation-length">
{{stream.translations.length}} {{t}}
</div>
<div class="translation-dropdown-component">
<i class="dropdown icon translation-dropdown-icon"> </i>
</div>
</div>
{{#if (and (eq @currentRoom.id stream.id) this.selectingLanguage.getName)}}
<div class="text">{{this.selectingLanguage.getName}}</div>
{{/if}}
<div class="ui translation menu custom-menu">
{{#each stream.translations as |channel|}}
<div class="item custom-item" data-value="{{map-value mapper channel}}">{{channel.name}}</div>
{{/each}}
@onChange={{ action "switchLanguage"}}>
<div class="translation-dropdown-wrapper">
<div class="translation-dropdown-component">
<i style="font-size:1.1em" class="language icon"></i>
</div>
<div class="translation-dropdown-component">
{{stream.translations.length}} {{t 'languages'}}
</div>
<div class="translation-dropdown-component">
<i style="margin-left: 0 !important;text-align: right;"
class="dropdown icon"> </i>
</div>
</div>
<div class="ui translation menu">
{{#each-in stream.translations as |key channel|}}
<div class="item" data-value="{{channel.url}}">{{channel.name}}</div>
{{/each-in}}
</div>
</UiDropdown>
</div>
</div>
{{/if}}
</a>

{{/each}}
</div>
</div>
Expand Down
39 changes: 8 additions & 31 deletions app/components/public/stream/side-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default class PublicStreamSidePanel extends Component<Args> {
@tracked showChat = false;
@tracked showRoomChat = false;
@tracked showVideoRoom = false;
@tracked languageList: any = [];

@tracked translationChannels = [{
id : '0',
Expand Down Expand Up @@ -110,18 +109,9 @@ export default class PublicStreamSidePanel extends Component<Args> {
}

@action
switchLanguage(channel: any): void {
this.selectingLanguage.setLanguage(channel.url);
switchLanguage(url: string): void {
this.selectingLanguage.setLanguage(url);
this.selectingLanguage.updateTranslationYTId();
this.selectingLanguage.setName(channel.name);
}

@action
switchRoom(stream: any) {
if (this.selectingLanguage.getTranslationRoomId() !== stream.id) {
this.selectingLanguage.setName(null);
}
this.selectingLanguage.setTranslationRoomId(stream.id)
}

@action
Expand All @@ -148,22 +138,14 @@ export default class PublicStreamSidePanel extends Component<Args> {
isGlobalEventRoom : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.attributes['is-global-event-room'])[0],
chatRoomName : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.attributes['chat-room-name'])[0],
microlocationId : rooms.data.filter((room: any) => room.relationships['video-stream'].data ? room.relationships['video-stream'].data.id === stream.id : null).map((room: any) => room.id)[0],
hash : stringHashCode(stream.attributes.name + stream.id),
translations : []
})).forEach((stream: any) => {
hash : stringHashCode(stream.attributes.name + stream.id)
})).forEach(async(stream: any) => {
this.addStream(stream)
});
const languageLists: any = [];
Promise.all(this.streams.map(async(stream: any) => {
const res = await this.fetchTranslationChannels(stream.id);
const item = {
streamId: stream.id
}
languageLists.push(item);
stream.translations = res;
})).then(() => {
this.languageList = languageLists;
})
this.streams.forEach(async(stream: any) => {
const res = await this.fetchTranslationChannels(stream.id)
stream.translations = res
});
} catch (e) {
console.error('Error while loading rooms in video stream', e);
}
Expand All @@ -183,9 +165,4 @@ export default class PublicStreamSidePanel extends Component<Args> {
this.loading = false;
this.streams = [...this.streams];
}

@computed('[email protected]')
get streamList() {
return this.streams;
}
}
24 changes: 9 additions & 15 deletions app/components/public/stream/video-stream.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,19 @@
<iframe style="position: absolute;width: 100%; height: 100%; border: 0px;" src="{{this.iframeUrl}}" title="{{this.iframeTitle}}" allow="camera; microphone; display-capture" allowfullscreen="true"/>
{{/if}}

{{#if this.selectingLanguage.selectingLanguage}}

<iframe style="position: absolute;width: 50%; height: 100%; z-index: -1" id="video-player-translation" width="50%" height="50%" frameborder="0" title="YouTube Live Stream Translation"
src="https://www.youtube.com/embed/{{this.selectingLanguage.translationYoutubeId}}?enablejsapi=1&autoplay=1&modestbranding=1&loop=1&controls=0&disablekb=1"
gesture="media" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
{{/if}}

{{#if (eq @videoStream.videoChannel.provider 'jitsi')}}
<Public::Stream::JitsiStream @videoStream={{@videoStream}} />
{{/if}}
{{#if this.selectingLanguage.selectingLanguage}}
<iframe
style="position: absolute;width: 50%; height: 100%; z-index: -1"
id="video-player-translation"
frameborder="0"
title="YouTube Live Stream Translation"
src="https://www.youtube.com/embed/{{this.selectingLanguage.translationYoutubeId}}?enablejsapi=1&mute=0&autoplay=1&modestbranding=1&loop=1&controls=0&disablekb=1"
gesture="media" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
{{/if}}
{{#if (eq this.provider 'youtube')}}
<iframe
style="position: absolute; width: 100%; height: 100%;"
id="video-player"
frameborder="0"
title="YouTube Live Stream"
src="https://www.youtube.com/embed/{{this.youtubeId}}?enablejsapi=1&playlist={{this.youtubeId}}&autoplay=1&modestbranding=1&loop={{if @videoStream.extra.loop 1 0}}&mute={{if this.selectingLanguage.selectingLanguage 1 0}}&controls=0&disablekb=1"
<iframe style="position: absolute;width: 100%; height: 100%;" id="video-player" width="50%" height="50%" frameborder="0" title="YouTube Live Stream"
src="https://www.youtube.com/embed/{{this.youtubeId}}?enablejsapi=1&playlist={{this.youtubeId}}&autoplay=1&modestbranding=1&loop={{if @videoStream.extra.loop 1 0}}&mute={{if (eq this.selectingLanguage.selectingLanguage null) 0 1}}&controls=0&disablekb=1"
gesture="media" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
{{/if}}
{{#if (and (eq @videoStream.videoChannel.provider 'vimeo') this.vimeoId)}}
Expand Down
10 changes: 3 additions & 7 deletions app/components/public/stream/video-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export default class PublicStreamVideoStream extends Component<Args> {
@service
l10n: any;

@service
selectingLanguage: any;

@service
confirm: any;

Expand Down Expand Up @@ -60,6 +57,9 @@ export default class PublicStreamVideoStream extends Component<Args> {
@tracked
provider = '';

@service
selectingLanguage: any;

@tracked
languageUrl = '';

Expand Down Expand Up @@ -166,10 +166,6 @@ export default class PublicStreamVideoStream extends Component<Args> {
async setupRoomChat(stream:any) {
this.currentRoom = stream;
this.shown = false;
if (this.selectingLanguage.getTranslationRoomId() !== stream.id) {
this.selectingLanguage.setName(null);
}
this.selectingLanguage.setTranslationRoomId(stream.id)
this.eventCheckIn(this.args.event.identifier, stream.microlocationId)
}

Expand Down
1 change: 0 additions & 1 deletion app/models/video-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default class VideoStream extends ModelBase.extend() {
@attr() additionalInformation!: string;
@attr() extra!: Extra;
@attr() chatRoomName?: string;
@attr() translations?: any[];

@hasMany('microlocation') rooms!: Microlocation[];
@hasMany('video-recording') videoRecordings!: VideoRecording[];
Expand Down
27 changes: 0 additions & 27 deletions app/services/selecting-language.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import Service from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { computed } from '@ember/object';

export default class SelectingLanguageService extends Service {
@tracked
selectingLanguage = null;

@tracked
name = null;

@tracked
translationRoomId = null;

@tracked
isStreamYardVisible = true;

Expand All @@ -23,14 +16,6 @@ export default class SelectingLanguageService extends Service {
this.isStreamYardVisible = true;
}

setName(name) {
this.name = name;
}

setTranslationRoomId(roomId) {
this.translationRoomId = roomId;
}

setStreamYardVisibility(isVisible) {
this.isStreamYardVisible = isVisible;
}
Expand All @@ -47,16 +32,4 @@ export default class SelectingLanguageService extends Service {
getLanguage() {
return this.selectingLanguage;
}

getTranslationRoomId() {
return this.translationRoomId;
}

@computed('name')
get getName() {
if (this.name === 'Original') {
return null;
}
return this.name;
}
}
Loading

0 comments on commit 7fa143e

Please sign in to comment.