Skip to content

Commit 4a0e050

Browse files
committed
v2.4.31 - Set publisher video to mirror.
1 parent 9384464 commit 4a0e050

File tree

5 files changed

+46
-29
lines changed

5 files changed

+46
-29
lines changed

example/rtc/css/style.css

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,24 @@
2020
flex-direction: row;
2121
}
2222

23-
.rtc-parameters .row > span {
23+
.rtc-parameters .row>span {
2424
margin-right: 40px;
2525
width: 100%;
2626
display: flex;
2727
flex-direction: row;
2828
}
2929

30-
.rtc-parameters .row > span:last-child {
30+
.rtc-parameters .row>span:last-child {
3131
margin-right: 0;
3232
}
3333

34-
.rtc-parameters .row > span label {
34+
.rtc-parameters .row>span label {
3535
margin-right: 10px;
36-
width: 94px;
3736
flex-grow: 0;
3837
}
3938

40-
.rtc-parameters .row > span input,
41-
.rtc-parameters .row > span select {
39+
.rtc-parameters .row>span input,
40+
.rtc-parameters .row>span select {
4241
padding: 2px 4px;
4342
height: 24px;
4443
line-height: 24px;
@@ -59,25 +58,25 @@
5958
justify-content: center;
6059
}
6160

62-
.toolbar > * {
61+
.toolbar>* {
6362
margin-right: 20px;
6463
}
6564

66-
.toolbar > *:last-child {
65+
.toolbar>*:last-child {
6766
margin-right: 0;
6867
}
6968

7069
@media only screen and (max-width: 568px) {
71-
.toolbar {
72-
height: auto;
73-
display: block;
74-
flex-direction: unset;
75-
}
76-
77-
.toolbar > *,
78-
.toolbar > *:last-child {
79-
margin: 4px auto;
80-
}
70+
.toolbar {
71+
height: auto;
72+
display: block;
73+
flex-direction: unset;
74+
}
75+
76+
.toolbar>*,
77+
.toolbar>*:last-child {
78+
margin: 4px auto;
79+
}
8180
}
8281

8382

@@ -89,11 +88,17 @@
8988
margin: 20px 0 0 0;
9089
}
9190

91+
#view .mirror {
92+
transform: rotateY(180deg);
93+
-webkit-transform: rotateY(180deg);
94+
-moz-transform: rotateY(180deg);
95+
}
96+
9297
#view video {
9398
width: 50%;
9499
float: left;
95100
}
96101

97102
#view video:nth-child(even) {
98103
float: none;
99-
}
104+
}

example/rtc/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@
102102
<select id='sl_profiles'></select>
103103
</span>
104104
<span>
105-
<label style="width: 50%;"><input id='ch_enablevideo' type='checkbox' checked onchange='onVideoEnableChange();'>Video</label>
106-
<label style="width: 50%;"><input id='ch_enableaudio' type='checkbox' checked onchange='onAudioEnableChange();'>Audio</label>
105+
<label><input id='ch_enableaudio' type='checkbox' checked onchange='onAudioEnableChange();'>Audio</label>
106+
<label><input id='ch_enablevideo' type='checkbox' checked onchange='onVideoEnableChange();'>Video</label>
107+
<label><input id='ch_enablemirror' type='checkbox' checked onchange='onMirrorEnableChange();'>Mirror</label>
107108
</span>
108109
</div>
109110
<div class='row'>

example/rtc/js/main.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ function onPreviewClick(e) {
133133
_preview = ns;
134134

135135
var video = ns.video;
136+
video.setAttribute('controls', '');
137+
video.classList[ch_enablemirror.checked ? 'add' : 'remove']('mirror');
136138
video.muted = true;
137139
video.srcObject = ns.stream;
138140
video.play().catch(function (err) {
@@ -191,6 +193,8 @@ function onPublishClick(e) {
191193
});
192194

193195
var video = ns.video;
196+
video.setAttribute('controls', '');
197+
video.classList[ch_enablemirror.checked ? 'add' : 'remove']('mirror');
194198
video.muted = true;
195199
video.srcObject = ns.stream;
196200
video.play().catch(function (err) {
@@ -209,28 +213,35 @@ function onPublishClick(e) {
209213
});
210214
}
211215

212-
function onVideoEnableChange(e) {
216+
function onAudioEnableChange(e) {
213217
utils.forEach(rtc.publishers, function (_, ns) {
214218
ns.getSenders().forEach((sender) => {
215219
var track = sender.track;
216-
if (track && track.kind === 'video') {
217-
track.enabled = ch_enablevideo.checked;
220+
if (track && track.kind === 'audio') {
221+
track.enabled = ch_enableaudio.checked;
218222
}
219223
});
220224
});
221225
}
222226

223-
function onAudioEnableChange(e) {
227+
function onVideoEnableChange(e) {
224228
utils.forEach(rtc.publishers, function (_, ns) {
225229
ns.getSenders().forEach((sender) => {
226230
var track = sender.track;
227-
if (track && track.kind === 'audio') {
228-
track.enabled = ch_enableaudio.checked;
231+
if (track && track.kind === 'video') {
232+
track.enabled = ch_enablevideo.checked;
229233
}
230234
});
231235
});
232236
}
233237

238+
function onMirrorEnableChange(e) {
239+
utils.forEach(rtc.publishers, function (_, ns) {
240+
var video = ns.video;
241+
video.classList[ch_enablemirror.checked ? 'add' : 'remove']('mirror');
242+
});
243+
}
244+
234245
function onChangeProfileClick(e) {
235246
utils.forEach(rtc.publishers, function (_, ns) {
236247
ns.setProfile(sl_profiles.value);
@@ -263,6 +274,7 @@ function play(name) {
263274
switch (e.data.code) {
264275
case Code.NETSTREAM_PLAY_START:
265276
var video = e.srcElement.video;
277+
video.setAttribute('controls', '');
266278
video.srcObject = e.data.info.streams[0];
267279
video.play().catch(function (err) {
268280
console.warn(`${err}`);

src/odd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
odd = function () {
22
return {
3-
version: '2.4.30',
3+
version: '2.4.31',
44
};
55
};
66

src/rtc/rtc.netstream.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
_this.video = utils.createElement('video');
7676
_this.video.setAttribute('playsinline', '');
7777
_this.video.setAttribute('autoplay', '');
78-
_this.video.setAttribute('controls', '');
7978

8079
_pid = 0;
8180
_screenshare = false;

0 commit comments

Comments
 (0)