angular 8-Firefox中的webrtc适配器不工作

angular 8-Firefox中的webrtc适配器不工作,webrtc,angular8,Webrtc,Angular8,我尝试使用webrtc adpater运行angular 8中创建的poc。问题是它在firefox和safari中不起作用,但在chrome中起作用。 我观察到的连接从未连接或在firefox中连接。 我在代码中导入webrtc,以便为firefox和safari处理任何其他需要处理的事情。 基本上,我从Wowza开始尝试使用流媒体。 以下代码示例在chrome中工作,但在Firefox和safari中不工作: const ICE_SERVERS: RTCIceServer[] = [ {

我尝试使用webrtc adpater运行angular 8中创建的poc。问题是它在firefox和safari中不起作用,但在chrome中起作用。 我观察到的连接从未连接或在firefox中连接。 我在代码中导入webrtc,以便为firefox和safari处理任何其他需要处理的事情。 基本上,我从Wowza开始尝试使用流媒体。 以下代码示例在chrome中工作,但在Firefox和safari中不工作:

const ICE_SERVERS: RTCIceServer[] = [
  { urls: ['stun:stun.example.com', 'stun:stun-1.example.com'] },
  { urls: 'stun:stun.l.google.com:19302' }
];
setupSignalingServer(ele) {
    const self = this;
    window.RTCPeerConnection = window.RTCPeerConnection ||
        window.mozRTCPeerConnection ||
        window.webkitRTCPeerConnection;
    let signalingConnection = new WebSocket('wss://local.geofabricdev.com/webrtc-session.json');
    signalingConnection.binaryType = 'arraybuffer';
    signalingConnection.onopen = function (res) {
      console.log('connection open');
      signalingConnection.onerror = self.errorHandler;
    //  window.RTCPeerConnection = self.getRTCPeerConnection();

      const peerConnection = new RTCPeerConnection(PEER_CONNECTION_CONFIG);
      peerConnection.addEventListener('connectionstatechange', event => {
        console.log(event);
        if (peerConnection.connectionState === 'connected') {
          console.log('connected');
        }
      });
      peerConnection.addEventListener('icecandidate', event => {
        console.log('peerconnection state5:' + peerConnection.connectionState);
        if (event.candidate) {
          //  signalingChannel.send({'new-ice-candidate': event.candidate});
        }
    });
   
    peerConnection.addEventListener('track', async event => {
      console.log('gotRemoteTrack: kind:' + event.track.kind + ' stream:' + event.streams[0]);
    const video = self.createVideo();
    //  const remoteVideo1 = document.querySelector('#remoteVideo') as HTMLVideoElement;
    try {
      video.srcObject = event.streams[0];
      //  remoteVideo1.srcObject = event.streams[0];
    } catch (error) {
      video.src = window.URL.createObjectURL(event.streams[0]);
    }
    });
   
      signalingConnection.addEventListener('message', async message => {
        console.dir(message);
        //  self.getSignalMessageCallback(message);
        console.log('wsConnection.onmessage: ' + message.data);
        const signal = JSON.parse(message.data);
        if(signal.status !== 200) {
          const video = self.createVideo();
          video.poster = '../assets/streaming-error.png';
        }
        const streamInfoResponse = signal['streamInfo'];
        let g = [];
       // self.socketStream.some((f) => {
        g = self.streams.filter((str) => signal['streamInfo'].streamName === str.streamName);
        // if(g.length > 0) {
        //   return true;
        // }
     //   });
    //  });
        if (streamInfoResponse !== undefined) {
          g[0]['sessionId'] = streamInfoResponse.sessionId;
        }
        console.log('Received signal');
        const msgCommand = signal['command'];
        console.log(msgCommand);
          if (signal.sdp) {
            peerConnection.setRemoteDescription(new RTCSessionDescription(signal.sdp));
                if (signal.sdp) {
                  const description = await peerConnection.createAnswer();
                  await peerConnection.setLocalDescription(description);
                  signalingConnection.send('{"direction":"play", "command":"sendResponse", "streamInfo":' +
                    JSON.stringify(g[0]) + ', "sdp":' + JSON.stringify(description) + ',"userData":' + JSON.stringify(self.userData) + '}');

                }
           //   })
             // .catch(self.errorHandler);
          } else if (signal.iceCandidates) {
            console.log('ice: ' + JSON.stringify(signal.iceCandidates));
            peerConnection.addIceCandidate(new RTCIceCandidate(signal.iceCandidates[0])).catch(self.errorHandler);
          }
          if ('sendResponse'.localeCompare(msgCommand) === 0) {
            if (signalingConnection != null) {
              signalingConnection.close();
            }
            signalingConnection = null;
          }
    //    };
      });
      signalingConnection.send('{"direction":"play", "command":"getOffer", "streamInfo":' +
      JSON.stringify(ele) + ', "userData":' + JSON.stringify(self.userData) + '}');
    };
    signalingConnection.onclose = function (r) {
      console.log('close');
    };
  }

  private createVideo() {
    const video = document.createElement('video');
    video.classList.add('cameraPanel');
    video.autoplay = true;
    video.preload = 'true';
    video.muted = true;
    video.width = 300;
    const remoteVideo = document.querySelector('#videoContainer') as HTMLElement;
    remoteVideo.appendChild(video);
    return video;
  }

现在我可以在safari浏览器中运行,但在firefox中仍然存在错误:“WebRTC:ICE失败,请添加TURN服务器,有关更多详细信息,请参阅about:WebRTC”。我尝试使用AddTurn服务器,但仍然无法查看视频。任何人都有一个想法,我可以在safari浏览器中运行,但在firefox中仍然存在错误:“WebRTC:ICE失败,请添加TURN服务器,并查看关于:WebRTC以了解更多详细信息”。我尝试使用AddTurn服务器,但仍然无法查看视频。谁有主意