文档中心
全部产品
Agora.io 社区
推流的新旧回调有何关系?
分类: 集成类    平台: Android / iOS / macOS / Windows   最后更新时间: 2021/12/02 01:07:50

Agora 提供两套回调供你监听推流:

  • 旧回调:onStreamPublishedonStreamUnpublished
  • 新回调:onRtmpStreamingStateChangedonRtmpStreamingEvent

Agora 废弃旧回调并推荐你使用新回调。旧回调依然可用。你可以根据业务逻辑挑选一套回调使用。新旧回调的对应关系详见下表:

新回调 旧回调
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_OK (0) (自首个版本)onStreamPublished.ERROR_OK (0)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT (1) (自首个版本)onStreamPublished.ERR_INVALID_ARGUMENT (2)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED (2) (自首个版本)onStreamPublished.ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH (130)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT (3) (自首个版本)onStreamPublished.ERR_TIMEDOUT (10)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR (4) (自首个版本)onStreamPublished.ERR_PUBLISH_STREAM_INTERNAL_SERVER_ERROR (154)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR (4) (自首个版本)onStreamPublished.ERROR_FAILED (1)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR (5) (自 v2.4.1)onStreamPublished.ERR_PUBLISH_STREAM_CDN_ERROR (151)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN (6) 无对应回调
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT (7) (自 v2.4.1)onStreamPublished.ERR_PUBLISH_STREAM_NUM_REACH_LIMIT (152)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED (8) (自 v2.4.1)onStreamPublished.ERR_PUBLISH_STREAM_NOT_AUTHORIZED (153)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND (9) (自 v2.4.1)onStreamPublished.ERR_PUBLISH_STREAM_NOT_FOUND (155)
(自 v2.4.1)onRtmpStreamingStateChanged.RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED (10) (自 v2.4.1)onStreamPublished.ERR_PUBLISH_STREAM_FORMAT_NOT_SUPPORTED (156)
(自 v3.4.5)onRtmpStreamingStateChanged.RTMP_STREAM_UNPUBLISH_ERROR_OK (100) (自首个版本)onStreamUnpublished
(自 v3.1.0)onRtmpStreamingEvent.RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE (1) 无对应回调
(自 v3.4.5)onRtmpStreamingEvent.RTMP_STREAMING_EVENT_URL_ALREADY_IN_USE (2) (自首个版本)onStreamPublished.ERR_ALREADY_IN_USE (19)