Skip to content

Commit

Permalink
fix(FEC-7971): change media doesn't work after a critical error (#135)
Browse files Browse the repository at this point in the history
reset the error state when loading a new media
depends on kaltura/playkit-js-ui#249
  • Loading branch information
yairans authored Jun 26, 2018
1 parent e705bd1 commit 292876f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/common/ui-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ class UIWrapper {
this._uiManager.setConfig(config, componentAlias);
}

setErrorPresetConfig(mediaInfo: ProviderMediaInfoObject): void {
resetErrorConfig(mediaInfo: ProviderMediaInfoObject): void {
this._setErrorPresetConfig(mediaInfo);
this._resetErrorState();
}

_setErrorPresetConfig(mediaInfo: ProviderMediaInfoObject): void {
if (this._disabled) return;
this.setConfig({mediaInfo: mediaInfo}, 'error');
}

_resetErrorState(): void {
if (this._disabled) return;
this.setConfig({hasError: false}, 'engine');
}

setSeekbarConfig(mediaConfig: ProviderMediaConfigObject): void {
if (this._disabled) return;
const seekbarConfig = Utils.Object.getPropertyPath(this._uiManager, 'config.components.seekbar');
Expand Down
8 changes: 6 additions & 2 deletions src/kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ export default class KalturaPlayer {

loadMedia(mediaInfo: ProviderMediaInfoObject): Promise<*> {
this._logger.debug('loadMedia', mediaInfo);
this._player.reset();
this._reset(mediaInfo);
this._player.loadingMedia = true;
this._uiWrapper.setErrorPresetConfig(mediaInfo);
this._uiWrapper.setLoadingSpinnerState(true);
return this._provider.getMediaConfig(mediaInfo)
.then(mediaConfig => this.setMedia(mediaConfig))
Expand Down Expand Up @@ -77,4 +76,9 @@ export default class KalturaPlayer {
set: undefined
};
}

_reset(mediaInfo: ProviderMediaInfoObject): void {
this._player.reset();
this._uiWrapper.resetErrorConfig(mediaInfo);
}
}

0 comments on commit 292876f

Please sign in to comment.