Skip to content

Commit

Permalink
Merge pull request #93 from bbc/configurable-playback-ended
Browse files Browse the repository at this point in the history
Make PLAYBACK_ENDED event behaviour configurable in PlaybackController
  • Loading branch information
jlks authored Aug 20, 2024
2 parents 7c7e55f + f204daa commit 20c3473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,8 @@ import Events from './events/Events';
* Defines the delay in milliseconds between two consecutive checks for events to be fired.
* @property {boolean} [seekWithoutReadyStateCheck=false]
* This allows a seek by setting currentTime regardless of the loadedmetadata event being emitted
* @property {boolean} [enableDashPlaybackEnded = false]
* This enables the synthetic ended behaviour in PlaybackController that seeks and pauses the media element
* @property {boolean} [parseInbandPrft=false]
* Set to true if dash.js should parse inband prft boxes (ProducerReferenceTime) and trigger events.
* @property {module:Settings~Metrics} metrics Metric settings
Expand Down Expand Up @@ -901,6 +903,7 @@ function Settings() {
parseInbandPrft: false,
enableManifestTimescaleMismatchFix: false,
seekWithoutReadyStateCheck: false,
enableDashPlaybackEnded: false,
capabilities: {
filterUnsupportedEssentialProperties: true,
useMediaCapabilitiesApi: false
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ function PlaybackController() {

// Handle DASH PLAYBACK_ENDED event
function _onPlaybackEnded(e) {
if (wallclockTimeIntervalId && e.isLast) {
if (settings.get().streaming.enableDashPlaybackEnded && wallclockTimeIntervalId && e.isLast) {
// PLAYBACK_ENDED was triggered elsewhere, react.
logger.info('onPlaybackEnded -- PLAYBACK_ENDED but native video element didn\'t fire ended');
const seekTime = e.seekTime ? e.seekTime : getStreamEndTime();
Expand Down

0 comments on commit 20c3473

Please sign in to comment.