Je sais que votre question est un peu vieux et vous n'êtes probablement pas besoin de ce plus, mais je vais envoyer un code au cas où quelqu'un en a besoin par la suite.
Comme vous l'avez dit, getBandwidthForRepresentation()
attend 2 paramètres: representationId
et periodId
Comment arriver representationId:
- dont vous avez besoin pour obtenir des mesures:
var metrics = player.getMetricsFor('video')
- et dashMetrics:
var dashMetrics = player.getDashMetrics()
- maintenant nous obtenons representationId:
var representationId = dashMetrics.getCurrentRepresentationSwitch(metrics).to
Comment obtenir peropdId:
- nous obtenons les informations de flux actif:
var streamInfo = player.getActiveStream().getStreamInfo()
- nous utilisons l'index comme periodId:
var periodId = streamInfo.index
Comment obtenir bande passante:
- nous pouvons maintenant obtenir la bande passante:
var bandwidth = dashMetrics.getBandwidthForRepresentation(representationId, periodId)
complet Code:
var metrics = player.getMetricsFor('video')
var dashMetrics = player.getDashMetrics()
var representationId = dashMetrics.getCurrentRepresentationSwitch(metrics).to
var streamInfo = player.getActiveStream().getStreamInfo()
var periodId = streamInfo.index
var bandwidth = dashMetrics.getBandwidthForRepresentation(representationId, periodId)
Hope it helps