Skip to content

CirCall IPCam Broadcasting API Change

Ray edited this page Oct 23, 2018 · 8 revisions

目的

因為目前架構上, 一種 publish 方法會多出一組 prepare/publish method,對於 code 來說會較凌亂, 所以 refactor 以減少此負擔。

更動版本

預計版本 0.11.0 會更動 API,新增新的 API 且同時移除舊的 API。

API 更動概述

  • 不需要再呼叫 CircallManager#prepare(...) 、處理 PREPARINGPREPARED 兩種狀態,CircallManager 會更單純地負責 connection 狀態。
  • 呼叫 CircallManager#createStream(...) 之後即可拿到各種 CircallStream (例如: CircallRtspUrlStream)以供 publish
  • publish 時帶入上一部拿到的 CircallStream 即可辨別 Stream 種類,詳見API 更動細節

API 更動細節

Prepare

移除此 method, 改以 createStream 產生 CircallStream 代表狀態完成

  • old API

Task<Void> prepareForUrl(Context context)

  • new API

Task<CircallStream> createStream(CircallStreamConfig config)


  • old sample

mCircallManager.prepareForUrl(context)

  • new sample

mCircallManager.createStream(new CircallStreamConfig.Builder(context).build())

Publish

新增傳入從 createStream 產生之 CircallStream

  • old API

CircallManager#publishWithUrl(CircallPublishWithUrlConfig config)

  • new API

CircallManager#publish(CircallStream stream, CircallPublishConfig config)


  • old sample
CircallPublishWithUrlConfig config = new CircallPublishWithUrlConfig.Builder().url("<RTSP URL>").build()
mCircallManager.publishWithUrl(config);
  • new sample
CircallPublishRtspUrlConfig config = new CircallPublishRtspUrlConfig.Builder().build()
mCircallManager.publish(stream, config);

Unpublish

新增傳入CircallStream

  • old API

CircallManager#unpublish()

  • new API

CircallManager#unpublish(CircallStream stream)


  • old sample

mCircallManager.unpublish();

  • new sample

mCircallManager.unpublish(stream);

CircallState

移除 PREPARING、PREPARED

  • STATE_IDLE
  • STATE_PREPARING
  • STATE_PREPARED
  • STATE_CONNECTING
  • STATE_CONNECTED
  • STATE_DISCONNECTING