MediaPipeline mp = pipelineFactory.create();
WebRtcEndpoint webRtcEP1 = mp.newWebRtcEndpoint().build();
WebRtcEndpoint webRtcEP2 = mp.newWebRtcEndpoint().build();
WebRtcEndpoint webRtcEP3 = mp.newWebRtcEndpoint().build();
WebRtcEndpoint webRtcEP4 = mp.newWebRtcEndpoint().build();
HttpGetEndpoint httpEP = mp.newHttpGetEndpoint().terminateOnEOS()
.build();
Composite composite = mp.newComposite().build();
HubPort hubPort1 = composite.newHubPort().build();
HubPort hubPort2 = composite.newHubPort().build();
HubPort hubPort3 = composite.newHubPort().build();
HubPort hubPort4 = composite.newHubPort().build();
HubPort hubPort5 = composite.newHubPort().build();
webRtcEP1.connect(hubPort1);
webRtcEP2.connect(hubPort2);
webRtcEP3.connect(hubPort3);
webRtcEP4.connect(hubPort4);
hubPort5.connect(httpEP);
// Test execution
try (BrowserClient browserPlayer = new BrowserClient.Builder()
.browser(browserType).client(Client.PLAYER).build();
BrowserClient browserWebRtc1 = new BrowserClient.Builder()
.browser(browserType).client(Client.WEBRTC)
.video(getPathTestFiles() + "/video/10sec/red.y4m")
.build();
BrowserClient browserWebRtc2 = new BrowserClient.Builder()
.browser(browserType).client(Client.WEBRTC)
.video(getPathTestFiles() + "/video/10sec/green.y4m")
.build();
BrowserClient browserWebRtc3 = new BrowserClient.Builder()
.browser(browserType).client(Client.WEBRTC)
.video(getPathTestFiles() + "/video/10sec/blue.y4m")
.build();
BrowserClient browserWebRtc4 = new BrowserClient.Builder()
.browser(browserType).client(Client.WEBRTC)
.video(getPathTestFiles() + "/video/10sec/white.y4m")
.build();) {
// WebRTC browsers
browserWebRtc1.subscribeEvents("playing");
browserWebRtc1.connectToWebRtcEndpoint(webRtcEP1,
WebRtcChannel.AUDIO_AND_VIDEO);
browserWebRtc2.subscribeEvents("playing");
browserWebRtc2.connectToWebRtcEndpoint(webRtcEP2,
WebRtcChannel.AUDIO_AND_VIDEO);
browserWebRtc3.subscribeEvents("playing");
browserWebRtc3.connectToWebRtcEndpoint(webRtcEP3,
WebRtcChannel.AUDIO_AND_VIDEO);
browserWebRtc4.subscribeEvents("playing");
browserWebRtc4.connectToWebRtcEndpoint(webRtcEP4,
WebRtcChannel.AUDIO_AND_VIDEO);
browserPlayer.setURL(httpEP.getUrl());
browserPlayer.subscribeEvents("playing");
browserPlayer.start();
browserPlayer.setColorCoordinates(450, 450);