通知
本站点除 Legacy 产品与方案外,已迁移至 声网新文档中心 ,当前页面不再维护
Documentation
All
Console 官网 Community Technical support

How do I use the Agora Web SDK to interoperate with the Agora Native SDK?

Type: Integration issues    Platform: Android / iOS / macOS / Web / Windows   Last Updated: 2022/09/14 23:07:50

As of v3.0.0, the RTC Native SDK can communicate with the RTC Web SDK by default, whether in the COMMUNICATION or the LIVE_BROADCASTING profile.

For RTC native SDKs earlier than v3.0.0, the interoperability with the Web SDK is enabled by default in the COMMUNICATION profile. In the LIVE_BROADCASTING profile, however, to enable interoperability between a mobile device and a web browser or app, you need to make the following settings on both platforms.

  • On the mobile/desktop device, call the enableWebSdkInteroperability method.

      // java
      // Ensure that this methid is called from the native side to interoperate with Web SDK.
      rtcEngine.enableWebSdkInteroperability(true);
      // swift
      // Ensure that this method is called from the native side to interoperate with the Web SDK.
      agoraKit.enableWebSdkInteroperability(true)
      // objective-c
      // Ensure that this method is called from the native side to interoperate with the Web SDK.
      [agoraKit enableWebSdkInteroperability: YES];
      // cpp
      //  Ensure that this method is called from the native side to interoperate with the Web SDK.
      lpAgoraEngine->enableWebSdkInteroperability
  • For the Web, in the createClient method, set the mode argument as 'live'.

      // javascript
      // Choose the current mode and codec.
      var client = AgoraRTC.createClient({ mode: 'live', codec: 'h264' });
Given known test experience, if your scenario involves Safari, we recommend setting codec at the Web Client as h264; otherwise, set it as vp8.