Recording WebRTC-Enabled Sessions: Server-side or Client-side?
- Full-stack developers who are building applications using the native browser API tend to wrap one of the many browser-side screen recording plugins in their application. This works as a prototyping solution. At best, it is a way to circumvent the problem rather than providing a clean and robust solution that is tightly integrated in the end-user application.
- Mobile application developers building native mobile applications on top of WebRTC stack have little choices to record the session. They would often run another recording application in the background to record the session. These quick-fixes, workaround solutions are prone to cyber hacks and numerous usability issues.
- Developers could also leverage on WebRTC or CPaaS providers. However, there are not many such service providers that offer APIs that help in recording. For those who do, the features and architecture for recording video sessions differs. In general, there are two broad mechanisms – server-side recording and client-side recording. Let’s look at them in more details
Server-side or Client-side recording
For server-side recording, the media is routed via a media server instead of directly between the browsers. In this case, the WebRTC session is terminated over the severs on both ends with the media routed to the receiving end. The decoded media is then simultaneously sent to post-processing and recording. Service providers with server-side recording APIs allow the developers to do the following:
- Recording video/audio stream for each participant in the WebRTC session. These sessions could either be one to one or multi-party.
- Mixing and transcoding all participants’ streams into a single composite video file.
- Providing lay-outing API to manage the recording content layout.
- Additionally, there can be additional features such as integrating chat with recording, watermarking, etc. which are often required for recreating the session as it happened and for copyrighting
For client-side recording, videos are recorded locally, and then processed before uploading to the servers. In this case, an additional client endpoint is needed to connect to the WebRTC session. This end-point is expected to install a software binary containing the recording software image. The software could either be offered as a docker image or a simple ISO. One distinctive disadvantage is that you can’t control the client’s endpoint and its performance greatly varies according to the endpoint specifications. Large scale sessions require a high-end machine with fast disk I/O access rate and a fast CPU.
So, what’s best?
When deciding whether to go for application level recording or recording capability offered by a WebRTC platform provider (i.e. Server-side or client side recording), several factors need to be considered.
- Browsers: You need to find the relevant screen recording plugins suitable for the specific browser. If you need it to be on all browsers, which happens in most cases, you will end up having multiple plugins for each of the browsers.
- Mobile App: If you are developing native mobile or hybrid applications (i.e. REACT native etc) then it is recommended to go for a platform provider
Size of the session
- Multiparty Sessions
In a multiparty session, the probability of users not having enough bandwidth to receive all of the participants’ video streams, is high. In realistic cases, some of the participants’ video quality will be low. As a result, video recording quality, if done solely at the client end will also have lower quality. For such cases, it is recommended to go for a service provider offering server-side recording
- One-to-one Sessions
Since bandwidth may not be a challenge here, you can choose client-side or server-side recording depending on whether you prefer installing a recording server at your end and deal with all recording management issues.
- Concurrent Sessions
For multiple concurrent sessions, load balancing is required. In such cases, it is recommended to go for server-side recording to avoid dealing with the complexity of load balancing and recording management in your application layer.
Session recording is a “must-have” requirement
If it is required that the session must be recorded for legal or business process rules, it is recommended to go for server-side recording as it is least prone to errors.
In summary, you should carefully weigh all the above options before settling down on the final solution when adding recording capability in your WebRTC enabled application.
Also read What is WebRTC and How It Works