Skip to content
Draft
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
5 changes: 5 additions & 0 deletions src/streaming/MediaPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ function MediaPlayer() {
return playbackController.isSeeking();
}

function setSeekDisabled(value){
playbackController.setSeekDisabled(value)
}
Comment on lines +778 to +780

Choose a reason for hiding this comment

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

medium

This new function is missing JSDoc documentation. Adding documentation improves code clarity and maintainability for future developers. Also, for consistency with the project's coding style, please add a semicolon at the end of the statement.

    /**
     * Use this method to disable seeking. When disabled, any calls to seek() will be ignored.
     * @param {boolean} value - A boolean to enable/disable seeking.
     * @memberof module:MediaPlayer
     * @instance
     */
    function setSeekDisabled(value) {
        playbackController.setSeekDisabled(value);
    }


/**
* Returns a Boolean that indicates whether the media is in the process of dynamic.
* @return {boolean}
Expand Down Expand Up @@ -2954,6 +2958,7 @@ function MediaPlayer() {
setTextTrack,
setVolume,
setXHRWithCredentialsForType,
setSeekDisabled,
time,
timeAsUTC,
timeInDvrWindow,
Expand Down
14 changes: 14 additions & 0 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function PlaybackController() {
playbackStalled,
manifestUpdateInProgress,
initialCatchupModeActivated,
seekDisabled,

Choose a reason for hiding this comment

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

high

The new seekDisabled flag is not reset in the reset() function. This can lead to unexpected behavior where seeking remains disabled after a player reset (e.g., when loading a new source). Please ensure seekDisabled is set to false within the reset() function to restore the default state.

settings;

function setup() {
Expand Down Expand Up @@ -215,6 +216,10 @@ function PlaybackController() {
return;
}

if (seekDisabled){
return;
}

internalSeek = (internal === true);

if (!internalSeek) {
Expand Down Expand Up @@ -610,6 +615,10 @@ function PlaybackController() {
wallclockTimeIntervalId = null;
}

function setSeekDisabled(value){
seekDisabled = value;
}
Comment on lines +618 to +620

Choose a reason for hiding this comment

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

medium

Please add JSDoc documentation for the new setSeekDisabled function to explain its purpose and parameters. This will help with code maintainability.

    /**
     * Sets the seek disabled state. If true, seeking is disabled.
     * @param {boolean} value
     */
    function setSeekDisabled(value) {
        seekDisabled = value;
    }


function _onDataUpdateCompleted(e) {
const voRepresentation = e.currentRepresentation;
const info = voRepresentation ? voRepresentation.mediaInfo.streamInfo : null;
Expand Down Expand Up @@ -670,6 +679,10 @@ function PlaybackController() {
return;
}

if (seekDisabled){
return;
}

let seekTime = getTime();
// On some browsers/devices, in case of live streams, setting current time on video element fails when there is no buffered data at requested time
// Then re-set seek target time and video element will be seeked afterwhile once data is buffered (see BufferContoller)
Expand Down Expand Up @@ -949,6 +962,7 @@ function PlaybackController() {
seekToOriginalLive,
setConfig,
updateCurrentTime,
setSeekDisabled
};

setup();
Expand Down
Loading