onCdnStreamStateChanged property
final
Callback for Change of RTMP/RTMPS Publishing Status
When you call startPublishMediaStream
to publish a stream to the
TRTC backend, the SDK will immediately update the command to the
cloud server.
If you set the publishing destination (TRTCPublishTarget) to the URL of Tencent Cloud or a third-party CDN, you will be notified of the RTMP/RTMPS publishing status via this callback.
- Parameters:
- cdnUrl(String):
- The URL you specify in TRTCPublishTarget when you call
startPublishMediaStream
.
- The URL you specify in TRTCPublishTarget when you call
- code(int):
- The publishing result.
0
: Successful; other values: Failed.
- The publishing result.
- extraInfo(String):
- Additional information. For some error codes, there may be additional information to help you troubleshoot the issues.
- message(String):
- The publishing information.
- status(int):
- The publishing status:
0
: The publishing has not started yet or has ended. This value will be returned after you callstopPublishMediaStream
.1
: The TRTC server is connecting to the CDN server. If the first attempt fails, the TRTC backend will retry multiple times and will return this value via the callback (every five seconds). After publishing succeeds, the value2
will be returned. If a server error occurs or publishing is still unsuccessful after 60 seconds, the value4
will be returned.2
: The TRTC server is publishing to the CDN. This value will be returned if the publishing succeeds.3
: The TRTC server is disconnected from the CDN server and is reconnecting. If a CDN error occurs or publishing is interrupted, the TRTC backend will try to reconnect and resume publishing and will return this value via the callback (every five seconds). After publishing resumes, the value2
will be returned. If a server error occurs or the attempt to resume publishing is still unsuccessful after 60 seconds, the value4
will be returned.4
: The TRTC server is disconnected from the CDN server and failed to reconnect within the timeout period. In this case, the publishing is deemed to have failed. You can callupdatePublishMediaStream
to try again.5
: The TRTC server is disconnecting from the CDN server. After you callstopPublishMediaStream
, the SDK will return this value first and then the value0
.
- The publishing status:
- cdnUrl(String):
Implementation
final void Function(String cdnUrl, int status, int errCode, String errMsg, String extraInfo)? onCdnStreamStateChanged;