WebRTC modules - detecting WebRTC request for stream that is not running

My application supports clients pulling a stream from a URL. Streams are dormant (not actively connected to wowza) until the client side requests it.

I have achieved this with RTP and HTTP sessions, by creating a custom module that contains custom onRTPSessionCreate and onHTTPSessionCreate functions. I would like to do this same thing with WebRTC connections.

When I request a stream through WebRTC I see the following in the log:

  • WebSocketSession.create[1308990425]
  • WebRTCCommands.getOffer: STATUS_ERROR_STREAM_NOT_RUNNING: myStream
  • WebSocketSession.destroy[1308990425]: source:client status:-1 description:Unknown

Neither the onRTPSessionCreate or onHTTPSessionCreate functions are reached during the above request. In the above request, the stream is not actively connected.

If I manually connect the stream before requesting the webRTC connection, onRTPSessionCreate IS reached. But that doesn’t help me – I need to find a way to interfere with execution before STATUS_ERROR_STREAM_NOT_RUNNING is logged.

I have tried the following:

protected class MyWebSocketListener extends WebSocketEventNotifyBase
{
	@Override
	public void onCreate(IWebSocketSession webSocketSession) {
	 	WMSLoggerFactory.getLogger(null).info("TEST");
	}
}

as well as

public class MVWebRTCExchangeSessionInfo extends HTTPWebRTCExchangeSessionInfo
{
	@Override
	protected void websocketSessionCreate(IWebSocketSession webSocketSession)
	{
		WMSLoggerFactory.getLogger(null).info("TEST");
	}
}

With no luck. Any advice appreciated

1 Like

In the WebRTC context you’ll need to do this in the HTTP provider you’re using to handle the websockets for SDP negotiation. You’re on the right track with the bits of code you posted, but it’s unclear how you’re implementing that code (if you’re putting it in a module and adding the module to your application, that won’t work).

There’s an example of subclassing the default http provider here: https://www.wowza.com/docs/how-to-use-webrtc-with-wowza-streaming-engine (scroll down toward the bottom of the page)

Once you’ve properly implemented the HTTPProvider, you’ll be able to access your application modules through the IApplicationInstance.getModuleInstance() method.

Thank you very much (once again!) - You’re correct that I was attempting to add the above code as a module. I have since extended HTTPWebRTCExchangeSessionInfo and added it as an HTTPProvider, and am making progress with that.

Exactly the nudge I needed! Thanks again!

Hi @Jaimee_Blackwood, were you able to build the solution for WebRTC workflow ? I have the exact same use case.