Skip to content

Add onPlaybackRateChanged and latency to onPlayerInfoUpdated#362

Closed
ryanmccartney wants to merge 8 commits intobbc:masterfrom
ryanmccartney:plugin-playback-rate
Closed

Add onPlaybackRateChanged and latency to onPlayerInfoUpdated#362
ryanmccartney wants to merge 8 commits intobbc:masterfrom
ryanmccartney:plugin-playback-rate

Conversation

@ryanmccartney
Copy link
Copy Markdown
Contributor

@ryanmccartney ryanmccartney commented Dec 9, 2024

📺 What

Exposes PLAYBACK_RATE_CHANGED event from Dash.js to the plugin interface - part of larger work to support low-latency playback. This change allows information on the current playback rate to be captured.

Additionally, it also adds onDashMetrics to the plugin interface to expose more detailed player information to the plugin. Specifically, this would be used to determine the current latency as follows;

const onDashMetrics = (event) => {
        const dvrInfo = event.getCurrentDVRInfo();
        const latency = dvrInfo.range.end - dvrInfo.time
};

These are important for identifying any devices which have problems with low-latency playback.

E.g.) If logs suggest the playback rate is greater than 1.0 but the latency reported does not reduce we can reasonably assume that the device is struggling to playback at the speed requested by the player.

🛠 How

Adds an additional event PLAYBACK_RATE_CHANGED to DashJSEvents in the MSEStrategy. On this event being triggered it is passed to a newly added plugin function Plugins.interface.onPlaybackRateChanged.

Also adds a plugin interface Plugins.interface.onDashMetrics to an existing event METRIC_ADDED to provide more detailed access to metrics with plugins. This could potentially be more tightly scoped to onDvrInfoChanged.

✅ Testing

No new tested added for this change, happy to add any ones deemed necessary on review.

Test Guidelines

Test engineer sign off

@ryanmccartney ryanmccartney requested a review from a team as a code owner December 9, 2024 15:14
bufferLength: playerMetadata.bufferLength,
playbackBitrate: playerMetadata.playbackBitrate,
})
Plugins.interface.onDashMetrics(dashMetrics)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be more tightly scoped at this point if needed instead looking like.

Plugins.interface.onDvrInfoChanged(dashMetrics.getCurrentDVRInfo())

Avoids exposing unnecessary functions to the plugin interface,

@ryanmccartney ryanmccartney force-pushed the plugin-playback-rate branch from 9ce249f to 710c48b Compare March 5, 2025 14:43
@ryanmccartney
Copy link
Copy Markdown
Contributor Author

PR now brought up to date with 9.0.2

@ryanmccartney ryanmccartney changed the title Expose PLAYBACK_RATE_CHANGED to the plugin interface Add onPlaybackRateChanged and latency to onPlayerInfoUpdated Mar 5, 2025
@ryanmccartney
Copy link
Copy Markdown
Contributor Author

Closing without merging as this functionality has been provided by another PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant