Video Streaming Server With Multi-Protocol,Robust And Rich API
LocationIndex Page  >  Document  >  WebRTC

Since version 1.0.61, TiTopStreamer started add support to webrtc, You can push live stream to TiTopStreamer by Webrtc,or you can pull live stream from TiTopStreamer by webrtc(Any stream existed on TiTopStreamer,No matter how it was ingested)

Here is an introduction to how to configure WEBRTC related feature on TiTopStreamer:

webrtc

Note: Under the default configuration after software installation, the WebRTC feature is not enabled. You can check "Enable WebRTC" in the configuration interface, then save and restart the TiTopStreamer service for the WebRTC feature to take effect.

In addition to these configurations on the interface, there are also some more complex configurations that you can directly modify in the configuration file. This configuration file is located in the conf directory of the TiTopStreamer installation directory, and the file name is "webrtc.json"

Here is an example of this configuration file:

{
  "enable": true,
  "media": {
    "host": "0.0.0.0",
    "port": 19888,
    "external_host": "109.35.48.121"
  },
  "signal": {
    "host": "0.0.0.0",
    "port": 7443
  },
  "use_embed_demo": true,
  "use_embed_cert": true,
  "cert_file": "",
  "private_key_file": "",
  "web_paths": {
    "/pub/": "/usr/local/TiTopStreamer/static/webdemo/pub",
    "/sub/": "/usr/local/TiTopStreamer/static/webdemo/sub"
  }
}		
	


The configuration file and configuration on UI are generally the same, but there is an additional configuration "web_paths" in the configuration file, which we did not include in the web console pannel. The configuration in "web_paths" is a demo program (DEMO) we provide. Regarding the access address of this DEMO, using the above configuration as an example, the following explanation is provided:

1. about push live stream to TiTopStreamer by WebRTC
https://ip_address_or_domain:7443/pub/		
		


2. about pull live stream from TiTopStreamer by WebRTC
https://ip_address_or_domain:7443/sub/		
		


about the source code of the demo, You can find it at the directory /usr/local/TiTopStreamer/static/webdemo. Note:If the installation directory of TiTopStreamer has been modified, The directory here also needs to be adjusted to the new installation directory.

about the source code of the demo, You can download it first, then deploy it to your web server (e.g. ginx), Then you can modify the UI of this demo according to your actual project requirements.

Note: When using this demo for testing, please first use firefox. When testing the streaming page, it will prompt you to choose the correct camera. Please make sure to choose the correct camera.



Regarding the signaling protocol of webrtc, we use the HTTP protocol and submit SDP information through POST. The URL format of HTTP is as follows:
https://ip_address_or_domain:[port]/[app_name]/[stream_name]		
	
Briefly explain:

[port] : It is the port number of signaling in the configuration(both UI and config file), Please notes:It's a TCP port, not the UDP port for media streaming.

[app_name] : It is an Application name of TiTopStreamer.

[stream_name] : It is a stream name of TiTopStreamer.

Whether you want to push a webrtc stream to TiTopStreamer or play a webrtc stream from TiTopStreamer, the signaling URL above is the same (the difference is in the sdp part of the HTTP message body, for which you can check the source code of the demo).