Issue Description:
Users testing RTMP streaming (Media Push) through the Agora iOS SDK may encounter the error AgoraRtmpStreamingReasonInvalidPrivilege (Error 16) when calling startRtmpStreamWithoutTranscoding(). This issue can occur even if the Media Push feature is already activated in the Agora Console.
Platform/SDK:
iOS application using Agora SDK v4.6.0
Error Message:
AgoraRtmpStreamingReasonInvalidPrivilege (Error 16)
Step by Step Solution:
1. Confirm Media Push Activation
- Log in to the Agora Console.
- Go to Project Management and open the project you are using.
- Under All Features, make sure Media Push is toggled to Enabled.
2. Ensure Proper API Usage
- The startRtmpStreamWithoutTranscoding() method in the client SDK is intended for use with the Agora broadcasting workflow where the channel is managed by Agora’s media servers.
- If you are integrating with external providers (such as Mux, YouTube, or Twitch) to push RTMP streams, use the Media Push RESTful API instead of the client-side SDK method.
3. Use the Media Push RESTful API
- Refer to Agora’s official REST API documentation: Media Push RESTful API Guide
- The API allows you to programmatically start, update, or stop RTMP streaming for your active channels.
- Generate the appropriate authorization credentials (App ID, App Certificate, token if required) and send a POST request to initiate the RTMP stream to your RTMP server (e.g. Mux).
4. Test RTMP Stream
- After invoking the RESTful API, verify that the RTMP stream is successfully received by your target endpoint.
- Monitor logs for any “permission” or “privilege” related errors. A successful API call should start the stream without issue.
Root Cause:
The error occurs because initiating an RTMP stream directly from the client SDK requires specific privileges controlled by the server API. When using third-party services like Mux, the Media Push RESTful API is required to authorize and manage RTMP egress correctly.
Prevention/Best Practice:
- Always verify that Media Push is enabled for your project before testing.
- Use the RESTful API method for all RTMP streaming to external CDN providers to ensure proper privilege handling.
- Avoid using the client-side method startRtmpStreamWithoutTranscoding() for workflows involving external RTMP destinations.
Corresponding Document/Link:
- Agora Media Push RESTful API — Official Documentation
- Agora Console Project Management