diff --git a/tracker/tracker-assist/package.json b/tracker/tracker-assist/package.json index 6064782c2..42f0358f0 100644 --- a/tracker/tracker-assist/package.json +++ b/tracker/tracker-assist/package.json @@ -1,7 +1,7 @@ { "name": "@openreplay/tracker-assist", "description": "Tracker plugin for screen assistance through the WebRTC", - "version": "3.0.2", + "version": "3.0.3", "keywords": [ "WebRTC", "assistance", diff --git a/tracker/tracker-assist/src/CallWindow.ts b/tracker/tracker-assist/src/CallWindow.ts index 279daeb81..860753aa7 100644 --- a/tracker/tracker-assist/src/CallWindow.ts +++ b/tracker/tracker-assist/src/CallWindow.ts @@ -101,15 +101,22 @@ export default class CallWindow { } + private aRemote: HTMLAudioElement | null = null; private localStream: MediaStream | null = null; private remoteStream: MediaStream | null = null; private setLocalVideoStream: (MediaStream) => void = () => {}; private videoRequested: boolean = true; // TODO: green camera light private _trySetStreams() { - if (this.vRemote && this.remoteStream) { + if (this.vRemote && !this.vRemote.srcObject && this.remoteStream) { this.vRemote.srcObject = this.remoteStream; + // Hack for audio (doesen't work in iframe because of some magical reasons) + this.aRemote = document.createElement("audio"); + this.aRemote.autoplay = true; + this.aRemote.style.display = "none" + this.aRemote.srcObject = this.remoteStream; + document.body.appendChild(this.aRemote) } - if (this.vLocal && this.localStream) { + if (this.vLocal && !this.vLocal.srcObject && this.localStream) { this.vLocal.srcObject = this.localStream; } } @@ -195,6 +202,9 @@ export default class CallWindow { if (this.iframe.parentElement) { document.body.removeChild(this.iframe); } + if (this.aRemote && this.aRemote.parentElement) { + document.body.removeChild(this.aRemote); + } } } \ No newline at end of file diff --git a/tracker/tracker-assist/src/index.ts b/tracker/tracker-assist/src/index.ts index 273907687..3ec90b141 100644 --- a/tracker/tracker-assist/src/index.ts +++ b/tracker/tracker-assist/src/index.ts @@ -164,20 +164,20 @@ export default function(opts: Partial = {}) { }); call.on('stream', function(rStream) { callUI.setRemoteStream(rStream); - dataConn.on('data', (data: any) => { - if (data === "call_end") { - //console.log('receiving callend on call') - onCallEnd(); - return; - } - if (data && typeof data.name === 'string') { - //console.log("name",data) - callUI.setAssistentName(data.name); - } - if (data && typeof data.x === 'number' && typeof data.y === 'number') { - mouse.move(data); - } - }); + }); + dataConn.on('data', (data: any) => { + if (data === "call_end") { + //console.log('receiving callend on call') + onCallEnd(); + return; + } + if (data && typeof data.name === 'string') { + //console.log("name",data) + callUI.setAssistentName(data.name); + } + if (data && typeof data.x === 'number' && typeof data.y === 'number') { + mouse.move(data); + } }); }