Skip to content

Commit 60b41bb

Browse files
authored
Streamyard to youtube translation (#9033)
* Add Paragraph field, text area * [DO NOT MERGE]remove the streamyard, add youtube for translation, hard-coded translation link only for test * get Youtube link and extract Youtube ID from form to video stream. Add responsive for side panel
1 parent d14d197 commit 60b41bb

File tree

8 files changed

+34
-35
lines changed

8 files changed

+34
-35
lines changed

app/components/forms/orders/order-form.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,7 @@ export default Component.extend(FormMixin, {
538538
}
539539
]
540540
};
541-
}
542-
else {
541+
} else {
543542
validationRules.fields[`${field.fieldIdentifier}_required_${index}`] = {
544543
rules: [
545544
{

app/components/public/stream/side-panel.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<span class="ml-2">{{stream.name}}</span>
6565
{{#if (eq index 0)}}
6666
{{#if (gt this.translationChannels.length 1)}}
67-
<div style="display:inline-block;margin-left:80px">
67+
<div style="display:inline-block;margin-left:50px">
6868
<div class="translation-dropdown-button translation-dropdown-container ">
6969
<UiDropdown class="btn btn-secondary dropdown-toggle"
7070
@onChange={{ action "switchLanguage"}}>

app/components/public/stream/side-panel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export default class PublicStreamSidePanel extends Component<Args> {
108108
@action
109109
switchLanguage(url: string): void {
110110
this.selectingLanguage.setLanguage(url);
111+
this.selectingLanguage.updateTranslationYTId();
111112
}
112113

113114
@action

app/components/public/stream/video-stream.hbs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,26 @@
77
{{#if this.iframeUrl}}
88
<iframe style="position: absolute;width: 100%; height: 100%; border: 0px;" src="{{this.iframeUrl}}" title="{{this.iframeTitle}}" allow="camera; microphone; display-capture" allowfullscreen="true"/>
99
{{/if}}
10+
11+
{{#if this.selectingLanguage.selectingLanguage}}
12+
13+
<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"
14+
src="https://www.youtube.com/embed/{{this.selectingLanguage.translationYoutubeId}}?enablejsapi=1&autoplay=1&modestbranding=1&loop=1&controls=0&disablekb=1"
15+
gesture="media" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
16+
{{/if}}
17+
1018
{{#if (eq @videoStream.videoChannel.provider 'jitsi')}}
1119
<Public::Stream::JitsiStream @videoStream={{@videoStream}} />
1220
{{/if}}
1321
{{#if (eq this.provider 'youtube')}}
14-
<iframe style="position: absolute" id="video-player" width="100%" height="100%" frameborder="0" title="YouTube Live Stream"
22+
<iframe style="position: absolute;width: 100%; height: 100%;" id="video-player" width="50%" height="50%" frameborder="0" title="YouTube Live Stream"
1523
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"
1624
gesture="media" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
1725
{{/if}}
1826
{{#if (and (eq @videoStream.videoChannel.provider 'vimeo') this.vimeoId)}}
19-
<iframe style="position: absolute" src="https://player.vimeo.com/video/{{this.vimeoId}}?autoplay={{if @videoStream.extra.autoplay 1 0}}&loop={{if @videoStream.extra.loop 1 0}}" width="100%" height="100%" frameborder="0" allow="autoplay" title="StreamYard Live Stream" allowfullscreen="true"></iframe>
27+
<iframe style="position: absolute" src="https://player.vimeo.com/video/{{this.vimeoId}}?autoplay={{if @videoStream.extra.autoplay 1 0}}&loop={{if @videoStream.extra.loop 1 0}}" width="50%" height="50%" frameborder="0" allow="autoplay" title="StreamYard Live Stream" allowfullscreen="true"></iframe>
2028
{{/if}}
2129

22-
{{#if this.selectingLanguage.selectingLanguage}}
23-
<div >
24-
{{#if this.selectingLanguage.isStreamYardVisible}}
25-
<button class="ui button" style="position:absolute;top:5%; left:650px;z-index: 2" {{on "click" this.hideStreamYard}}>Hide This</button>
26-
{{/if}}
27-
<div id="streamyard-iframe" style="position:absolute;top:30%; left:431px; width:50%;height:0px;position:relative;padding-bottom:56.25%;margin-bottom:20px" class={{if this.selectingLanguage.isStreamYardVisible "visibile" "sink"}}>
28-
<iframe id="streamyard-iframe-player" src="{{this.selectingLanguage.selectingLanguage}}" width="50%" height="50%" frameborder="0" style="width:30%;height:30%;position:absolute;left:0px;top:0px;" title="Stream Yard Live Stream" ></iframe>
29-
</div>
30-
31-
</div>
32-
{{/if}}
3330
</div>
3431
<Public::Stream::SidePanel @event={{@event}} @videoStream={{@videoStream}} @selectingLanguage={{this.selectingLanguage}} @shown={{true}} @showChatPanel={{this.showChatPanel}} @setupRoomChat={{action 'setupRoomChat'}} @currentRoom={{this.currentRoom}} @streamId={{@streamId}}/>
3532

app/components/public/stream/video-stream.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ export default class PublicStreamVideoStream extends Component<Args> {
3939
@tracked
4040
iframeUrl = '';
4141

42-
@tracked
43-
translationIframeUrl = '';
44-
4542
@tracked
4643
youtubeId = '';
4744

@@ -60,18 +57,6 @@ export default class PublicStreamVideoStream extends Component<Args> {
6057
@tracked
6158
provider = '';
6259

63-
@tracked
64-
player = null;
65-
66-
@tracked
67-
player2 = null;
68-
69-
@tracked
70-
players = [];
71-
72-
@tracked
73-
isPlaying: any;
74-
7560
@service
7661
selectingLanguage: any;
7762

@@ -83,13 +68,12 @@ export default class PublicStreamVideoStream extends Component<Args> {
8368
return this.authManager.currentUser?.isRocketChatRegistered && this.args.event.isChatEnabled;
8469
}
8570

86-
8771
@action
8872
async setup(): Promise<void> {
8973
const stream = this.args.videoStream;
9074
this.loading = true;
9175
this.iframeUrl = '';
92-
this.languageUrl = this.selectingLanguage.selectingLanguage;
76+
9377

9478
if (stream.url.includes('youtube')) {
9579
this.provider = 'youtube';
@@ -188,4 +172,5 @@ export default class PublicStreamVideoStream extends Component<Args> {
188172
hideStreamYard() {
189173
this.selectingLanguage.setStreamYardVisibility(false);
190174
}
175+
191176
}

app/services/selecting-language.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export default class SelectingLanguageService extends Service {
88
@tracked
99
isStreamYardVisible = true;
1010

11+
@tracked
12+
translationYoutubeId = null;
13+
1114
setLanguage(language) {
1215
this.selectingLanguage = language;
1316
this.isStreamYardVisible = true;
@@ -17,6 +20,15 @@ export default class SelectingLanguageService extends Service {
1720
this.isStreamYardVisible = isVisible;
1821
}
1922

23+
updateTranslationYTId() {
24+
if (this.selectingLanguage.includes('youtube')) {
25+
const [, id] = this.selectingLanguage.split('v=');
26+
if (id) {
27+
this.translationYoutubeId = id;
28+
}
29+
}
30+
}
31+
2032
getLanguage() {
2133
return this.selectingLanguage;
2234
}

app/styles/app.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ body {
1717
font-size: 14px;
1818
}
1919

20-
.visibile {
20+
.visible {
2121
display: block;
22+
z-index: 1;
2223
}
2324

2425
.sink {

app/styles/components/stream.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}
6767

6868
.stream-side-panel {
69-
width: 420px;
69+
width: 320px;
7070
height: 100%;
7171
position: fixed;
7272
top: 0;
@@ -77,6 +77,10 @@
7777
overflow: hidden;
7878
overflow-y: auto;
7979
z-index: 1;
80+
81+
@media (max-width: 767px) {
82+
width: 100%;
83+
}
8084
}
8185

8286
.chat-side-panel {

0 commit comments

Comments
 (0)