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

fix(FEC-11136): Tizen 4 got stuck on the beginning of the media #140

Merged
merged 14 commits into from
Apr 27, 2021
40 changes: 40 additions & 0 deletions src/dash-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
*/
_videoSizeUpdateTimer: ?IntervalID = null;

/**
* stall interval to break the stall on Smart TV
* @type {null|number}
* @private
*/
_stallInterval: ?IntervalID = null;

/**
* 3016 is the number of the video error at shaka, we already listens to it in the html5 class
* @member {number} - VIDEO_ERROR_CODE
Expand Down Expand Up @@ -365,10 +372,42 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
}
this._maybeSetFilters();
this._maybeSetDrmConfig();
this._maybeBreakStalls();
this._shaka.configure(this._config.shakaConfig);
this._addBindings();
}

_clearStallInterval(): void {
if (this._stallInterval) {
clearInterval(this._stallInterval);
this._stallInterval = null;
}
}

_stallSmartTVHandler(): void {
this._clearStallInterval();
let lastCurrentTime = this._videoElement.currentTime;
this._stallInterval = setInterval(() => {
if (lastCurrentTime === this._videoElement.currentTime) {
this._videoElement.currentTime = parseFloat(this._videoElement.currentTime.toFixed(1)) + 0.1;
Copy link
Contributor

Choose a reason for hiding this comment

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

move 0.1 to const, maybe expose as config?

} else {
this._clearStallInterval();
}
}, 2 * 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

move to const, maybe expose as config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't want to do it too robust cause I believe we need to handle it on Shaka, WDYT?

Copy link
Contributor Author

@Yuvalke Yuvalke Apr 25, 2021

Choose a reason for hiding this comment

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

To create 3 configs for hack we're adding for edge case that we won't need anymore after Shaka will handle it, it sounds too robust, don't you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

agree, let's start lean, but please move to consts and we will hope Shaka will approve this :-)

}

/**
* register to event to break the stalls on smart TV
* @returns {void}
* @private
*/
_maybeBreakStalls(): void {
if (this._config.playback.forceBreakStall) {
this._eventManager.listenOnce(EventType.STALLED, this._stallSmartTVHandler);
this._eventManager.listenOnce(EventType.SEEKED, this._stallSmartTVHandler);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need/want to remove them after one handler is called?
If stalled occurred we can remove seeked and vide versa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I clear the stall interval if it's not stopped for each one of them.
Yes, the issue that we saw occur only on the beginning.

}
}

/**
* get the redirected URL
* @param {string} url - The url to check for redirection
Expand Down Expand Up @@ -729,6 +768,7 @@ export default class DashAdapter extends BaseMediaSourceAdapter {
this._responseFilterError = false;
this._manifestParser = null;
this._thumbnailController = null;
this._clearStallInterval();
this._clearVideoUpdateTimer();
if (this._eventManager) {
this._eventManager.removeAll();
Expand Down