WebRTC Application Testing

I am trying to test a WebRTC application. Right now, the best thing I can do is open several private browser windows and let them talk to each other, but this is clearly not scalable.

I am looking for a way to create a large number of peers on a single machine. I looked in Phantom.js, but not yet supported WebRTC. Any suggestions?

+6
source share
2 answers

The problem is that PhantomJS is currently based on QtWebKit, and WebRTC needs components from Chromium, as well as WebKit.

It would be a lot of work for Phantom.js to reimplement all this - and there are also problems with codec support, etc. It also occurs to me that in a headless environment it would be difficult to check getUserMedia (), which is fundamental to WebRTC, but requires user interaction and cannot be scripted.

+8
source

For MediaStream it can be used https://www.npmjs.com/package/mediastream as:

import { MediaStream as libMediaStream } from 'mediastream'; 

For getUserMedia () it can be used https://www.npmjs.com/package/get-user-media-promise as:

 (<any>window.navigator).mediaDevices = Object.assign({}, window.navigator.mediaDevices, { getUserMedia: require('get-user-media-promise')} ); 

RTCPeerConnection, depends on your unit tests, can be a mockery:

 window['RTCPeerConnection'] = () => { return { close: () => { }, getTracks: () => { }, addStream: () => { }, createOffer: () => { }, addIceCandidate: () => { }, setRemoteDescription: () => { }, createAnswer: () => { }, setLocalDescription: () => { } }; }; 
0
source

Source: https://habr.com/ru/post/950056/


All Articles