Adding condition to enable reporting only on private rooms
This commit is contained in:
parent
62dfb68aaf
commit
0ea7240834
@ -592,7 +592,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// When connection is performed, let's connect SimplePeer
|
// When connection is performed, let's connect SimplePeer
|
||||||
this.simplePeer = new SimplePeer(this.connection);
|
this.simplePeer = new SimplePeer(this.connection, !this.room.isPublic);
|
||||||
this.GlobalMessageManager = new GlobalMessageManager(this.connection);
|
this.GlobalMessageManager = new GlobalMessageManager(this.connection);
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
|
@ -342,7 +342,7 @@ export class MediaManager {
|
|||||||
* @param reportCallBack
|
* @param reportCallBack
|
||||||
* @param userName
|
* @param userName
|
||||||
*/
|
*/
|
||||||
addActiveVideo(userId: string, reportCallBack: ReportCallback, userName: string = ""){
|
addActiveVideo(userId: string, reportCallBack: ReportCallback|undefined, userName: string = ""){
|
||||||
this.webrtcInAudio.play();
|
this.webrtcInAudio.play();
|
||||||
|
|
||||||
userName = userName.toUpperCase();
|
userName = userName.toUpperCase();
|
||||||
@ -354,18 +354,22 @@ export class MediaManager {
|
|||||||
<div class="rtc-error" style="display: none"></div>
|
<div class="rtc-error" style="display: none"></div>
|
||||||
<i id="name-${userId}" style="background-color: ${color};">${userName}</i>
|
<i id="name-${userId}" style="background-color: ${color};">${userName}</i>
|
||||||
<img id="microphone-${userId}" src="resources/logos/microphone-close.svg">
|
<img id="microphone-${userId}" src="resources/logos/microphone-close.svg">
|
||||||
<img id="report-${userId}" class="report active" src="resources/logos/report.svg">
|
` +
|
||||||
<video id="${userId}" autoplay></video>
|
((reportCallBack!==undefined)?`<img id="report-${userId}" class="report active" src="resources/logos/report.svg">`:'')
|
||||||
|
+
|
||||||
|
`<video id="${userId}" autoplay></video>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
layoutManager.add(DivImportance.Normal, userId, html);
|
layoutManager.add(DivImportance.Normal, userId, html);
|
||||||
|
|
||||||
const reportBtn = this.getElementByIdOrFail<HTMLDivElement>(`report-${userId}`);
|
if (reportCallBack) {
|
||||||
reportBtn.addEventListener('click', (e: MouseEvent) => {
|
const reportBtn = this.getElementByIdOrFail<HTMLDivElement>(`report-${userId}`);
|
||||||
e.preventDefault();
|
reportBtn.addEventListener('click', (e: MouseEvent) => {
|
||||||
this.showReportModal(userId, userName, reportCallBack);
|
e.preventDefault();
|
||||||
});
|
this.showReportModal(userId, userName, reportCallBack);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.remoteVideo.set(userId, this.getElementByIdOrFail<HTMLVideoElement>(userId));
|
this.remoteVideo.set(userId, this.getElementByIdOrFail<HTMLVideoElement>(userId));
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,6 @@ export interface PeerConnectionListener {
|
|||||||
* This class manages connections to all the peers in the same group as me.
|
* This class manages connections to all the peers in the same group as me.
|
||||||
*/
|
*/
|
||||||
export class SimplePeer {
|
export class SimplePeer {
|
||||||
private Connection: RoomConnection;
|
|
||||||
private WebRtcRoomId: string;
|
|
||||||
private Users: Array<UserSimplePeerInterface> = new Array<UserSimplePeerInterface>();
|
private Users: Array<UserSimplePeerInterface> = new Array<UserSimplePeerInterface>();
|
||||||
|
|
||||||
private PeerScreenSharingConnectionArray: Map<number, ScreenSharingPeer> = new Map<number, ScreenSharingPeer>();
|
private PeerScreenSharingConnectionArray: Map<number, ScreenSharingPeer> = new Map<number, ScreenSharingPeer>();
|
||||||
@ -40,9 +38,7 @@ export class SimplePeer {
|
|||||||
private readonly stopLocalScreenSharingStreamCallback: StopScreenSharingCallback;
|
private readonly stopLocalScreenSharingStreamCallback: StopScreenSharingCallback;
|
||||||
private readonly peerConnectionListeners: Array<PeerConnectionListener> = new Array<PeerConnectionListener>();
|
private readonly peerConnectionListeners: Array<PeerConnectionListener> = new Array<PeerConnectionListener>();
|
||||||
|
|
||||||
constructor(Connection: RoomConnection, WebRtcRoomId: string = "test-webrtc") {
|
constructor(private Connection: RoomConnection, private enableReporting: boolean) {
|
||||||
this.Connection = Connection;
|
|
||||||
this.WebRtcRoomId = WebRtcRoomId;
|
|
||||||
// We need to go through this weird bound function pointer in order to be able to "free" this reference later.
|
// We need to go through this weird bound function pointer in order to be able to "free" this reference later.
|
||||||
this.sendLocalVideoStreamCallback = this.sendLocalVideoStream.bind(this);
|
this.sendLocalVideoStreamCallback = this.sendLocalVideoStream.bind(this);
|
||||||
this.sendLocalScreenSharingStreamCallback = this.sendLocalScreenSharingStream.bind(this);
|
this.sendLocalScreenSharingStreamCallback = this.sendLocalScreenSharingStream.bind(this);
|
||||||
@ -148,9 +144,11 @@ export class SimplePeer {
|
|||||||
mediaManager.removeActiveVideo("" + user.userId);
|
mediaManager.removeActiveVideo("" + user.userId);
|
||||||
|
|
||||||
//TODO ad condition isPublic or annonyme
|
//TODO ad condition isPublic or annonyme
|
||||||
mediaManager.addActiveVideo("" + user.userId, (comment: string) => {
|
const reportCallback = this.enableReporting ? (comment: string) => {
|
||||||
this.reportUser(user.userId, comment);
|
this.reportUser(user.userId, comment);
|
||||||
}, name);
|
}: undefined;
|
||||||
|
|
||||||
|
mediaManager.addActiveVideo("" + user.userId, reportCallback, name);
|
||||||
|
|
||||||
const peer = new VideoPeer(user.userId, user.initiator ? user.initiator : false, this.Connection);
|
const peer = new VideoPeer(user.userId, user.initiator ? user.initiator : false, this.Connection);
|
||||||
// When a connection is established to a video stream, and if a screen sharing is taking place,
|
// When a connection is established to a video stream, and if a screen sharing is taking place,
|
||||||
|
Loading…
Reference in New Issue
Block a user