服務質量統計資料

服務品質(QoS)提供視訊引擎執行情形的詳細檢視。 瀏覽器TVSDK提供播放、緩衝和裝置的詳細統計資料。

讀取QOS回放、緩衝和設備統計資訊

您可以從QOSProvider類讀取播放、緩衝和設備統計資訊。

QOSProvider類別提供各種統計資料,包括緩衝、位元速率、影格速率、時間資料等資訊。

  1. 實例化媒體播放器。

  2. 建立QOSProvider物件,並將它附加至媒體播放器。

    // Create Media Player.qosProvider =
          new AdobePSDK.QOSProvider();
    qosProvider.attachMediaPlayer(player);
    
  3. (可選)閱讀播放統計資料。

    讀取播放統計資訊的一個解決方案是具有計時器,該計時器定期從QOSProvider中讀取新的QoS值。 例如:

    var qosTimer = (function () {
        var ref = null,
        qosChangeInterval = 500, // in milliseconds
    
        startTimer = function () {
            var playbackInformation = qosProvider.playbackInformation;
         console.log("Frame rate", playbackInformation.frameRate);
            console.log ("Dropped frames", playbackInformation.droppedFrameCount);
            console.log ("Bitrate", playbackInformation.bitrate);
            console.log ("Buffering time", playbackInformation.bufferingTime);
            console.log ("Buffer length", playbackInformation.bufferLength);
            console.log ("Buffer time", playbackInformation.bufferTime);
            console.log ("Empty buffer count", playbackInformation.emptyBufferCount);
            console.log ("Time to load", playbackInformation.timeToLoad);
            console.log ("Time to start", playbackInformation.timeToStart);
            ref = window.setTimeout(startTimer, qosChangeInterval);
        };
    
        return {
            start: function () {
                if (ref !== null) {
                    // don't start another timeout if one already exists.
                    return;
                }
                startTimer();
            },
    
            stop: function () {
                window.clearTimeout(ref);
                ref = null;
            }
        };
    })()
    
    qosTimer.start();
    
  4. (可選)閱讀裝置特定資訊。

    // Show device information
    DeviceInformation deviceInfo = new QOSProvider().deviceInformation;
    console.log("OS: "+ deviceInfo.getOS());
    console.log("Width: "+ deviceInfo.getWidthPixels() +
                "Height: "+ deviceInfo.getHeightPixels() );
    

本頁內容