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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/playbackstrategy/msestrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
STREAM_INITIALIZED: "streamInitialized",
FRAGMENT_CONTENT_LENGTH_MISMATCH: "fragmentContentLengthMismatch",
QUOTA_EXCEEDED: "quotaExceeded",
PLAYBACK_RATE_CHANGED: "playbackRateChanged",
}

function onLoadedMetaData() {
Expand Down Expand Up @@ -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,

}
}
}
Expand Down Expand Up @@ -563,6 +565,11 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
mediaPlayer.on(DashJSEvents.GAP_JUMP_TO_END, onGapJump)
mediaPlayer.on(DashJSEvents.QUOTA_EXCEEDED, onQuotaExceeded)
mediaPlayer.on(DashJSEvents.MANIFEST_LOADING_FINISHED, manifestLoadingFinished)
mediaPlayer.on(DashJSEvents.PLAYBACK_RATE_CHANGED, onPlaybackRateChanged)
}

function onPlaybackRateChanged(event) {
Plugins.interface.onPlaybackRateChanged(event)
}

function manifestLoadingFinished(event) {
Expand Down Expand Up @@ -671,6 +678,7 @@ function MSEStrategy(mediaSources, windowType, mediaKind, playbackElement, isUHD
mediaPlayer.off(DashJSEvents.GAP_JUMP, onGapJump)
mediaPlayer.off(DashJSEvents.GAP_JUMP_TO_END, onGapJump)
mediaPlayer.off(DashJSEvents.QUOTA_EXCEEDED, onQuotaExceeded)
mediaPlayer.off(DashJSEvents.PLAYBACK_RATE_CHANGED, onPlaybackRateChanged)

mediaPlayer = undefined
}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ export default {
onSubtitlesDynamicLoadError: (evt) => callOnAllPlugins("onSubtitlesDynamicLoadError", evt),
onFragmentContentLengthMismatch: (evt) => callOnAllPlugins("onFragmentContentLengthMismatch", evt),
onQuotaExceeded: (evt) => callOnAllPlugins("onQuotaExceeded", evt),
onPlaybackRateChanged: (evt) => callOnAllPlugins("onPlaybackRateChanged", evt),
onDashMetrics: (evt) => callOnAllPlugins("onDashMetrics", evt),
},
}
Loading