在 iOS 上追蹤體驗品質 track-quality-of-experience-on-ios

下列指示提供所有 2.x SDK 之間實作的指引。

IMPORTANT
若您正在實作 SDK 1.x 版,您可以在此處下載 1.x 開發人員指南:下載 SDK

實作 QoS

  1. 識別媒體播放期間位元速率是否變更,並且利用 QoS 資訊建立 MediaObject 例項。

    QoSObject 變數:

    table 0-row-3 1-row-3 2-row-3 3-row-3 4-row-3 3-align-center 7-align-center 11-align-center 15-align-center 19-align-center
    變數 說明 必填
    bitrate 目前位元速率
    startupTime 啟動時間
    fps FPS 值
    droppedFrames 掉格的數量
    note tip
    TIP
    唯有在您計劃追蹤 QoS 時,才須使用這些變數。

    QoS 物件建立:

    code language-none
    id qosObject = [ADBMediaHeartbeat createQoSObjectWithBitrate:[BITRATE]
                                      startupTime:[STARTUP_TIME]
                                      fps:[FPS]
                                      droppedFrames:[DROPPED_FRAMES]];
    
  2. 請確定 getQoSObject 方法會傳回最新的 QoS 資訊。

  3. 當播放轉換位元速率時,呼叫媒體心率例項中的 BitrateChange 事件:

    code language-none
    - (void)onBitrateChange:(NSNotification *)notification {
        [_mediaHeartbeat trackEvent:ADBMediaHeartbeatEventBitrateChange
                         mediaObject:nil
                         data:nil];
    }
    
    note important
    IMPORTANT
    更新 QoS 物件,並在每次位元速率變更時呼叫位元速率變更事件。如此可提供最精確的 QoS 資料。
recommendation-more-help
c8eee520-cef5-4f8c-a38a-d4952cfae4eb