Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose PLAYBACK_RATE_CHANGED to the plugin interface #362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ryanmccartney
Copy link

@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
@@ -429,6 +430,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
bufferLength: playerMetadata.bufferLength,
playbackBitrate: playerMetadata.playbackBitrate,
})
Plugins.interface.onDashMetrics(dashMetrics)
Copy link
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,

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