Skip to content

Commit

Permalink
fix(FEC-7368): show loading spinner for ads initial buffering (#114)
Browse files Browse the repository at this point in the history
There is no indication of buffering activity when user presses play or playback is initiated and ad is buffering.
This PR adds loading spinner between thumbnail and ad playback (UX)
The spinner do appear when actual video buffers, so this adds same experience for the ad buffer.
  • Loading branch information
odedhutzler authored and OrenMe committed Oct 31, 2017
1 parent ed2aff3 commit 2b8e74d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/loading/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ class Loading extends BaseComponent {
this.props.updateLoadingSpinnerState(true);
}
});

this.player.addEventListener(this.player.Event.AD_BREAK_START, () => {
this.props.updateLoadingSpinnerState(true);
});

this.player.addEventListener(this.player.Event.AD_LOADED, () => {
this.props.updateLoadingSpinnerState(true);
});

this.player.addEventListener(this.player.Event.AD_STARTED, () => {
this.props.updateLoadingSpinnerState(false);
});

this.player.addEventListener(this.player.Event.ALL_ADS_COMPLETED, () => {
this.props.updateLoadingSpinnerState(false);
});
}

/**
Expand All @@ -106,7 +122,7 @@ class Loading extends BaseComponent {
* @memberof Loading
*/
render(props: any): React$Element<any> | void {
if (!props.show || props.adBreak || this.isPreloading) return undefined;
if (!props.show || this.isPreloading) return undefined;

return (
<div className={[style.loadingBackdrop, style.show].join(' ')}>
Expand Down

0 comments on commit 2b8e74d

Please sign in to comment.