Skip to content

Commit

Permalink
fix(FEC-10564): keep the poster for display for an audio-only entry (#…
Browse files Browse the repository at this point in the history
…520)

Issue: audio stream has a black screen when it plays.
Solution: check if it's audio by sources.type and keep the poster.
  • Loading branch information
Yuvalke authored Dec 28, 2020
1 parent d87e7b1 commit 68a7026
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,16 @@ export default class Player extends FakeEventTarget {
);
}

/**
* Checking if the current playback is audio only.
* @function isAudio
* @returns {boolean} - Whether playback is audio.
* @private
*/
isAudio(): boolean {
return this._config.sources.type === MediaType.AUDIO;
}

/**
* Get whether the video is seeked to live edge in dvr
* @returns {boolean} - Whether the video is seeked to live edge in dvr
Expand Down Expand Up @@ -1863,6 +1873,9 @@ export default class Player extends FakeEventTarget {
* @private
*/
_handleAutoPlay(): void {
if (this.isAudio() || this._config.playback.autoplay === false) {
this._posterManager.show();
}
if (this._config.playback.autoplay === true) {
const allowMutedAutoPlay = this._config.playback.allowMutedAutoPlay;
Player.getCapabilities(this.engineType).then(capabilities => {
Expand All @@ -1882,8 +1895,6 @@ export default class Player extends FakeEventTarget {
}
}
});
} else {
this._posterManager.show();
}

const onAutoPlay = () => {
Expand Down Expand Up @@ -2018,7 +2029,9 @@ export default class Player extends FakeEventTarget {
if (this._firstPlay) {
this._firstPlay = false;
this.dispatchEvent(new FakeEvent(CustomEventType.FIRST_PLAY));
this._posterManager.hide();
if (!this.isAudio()) {
this._posterManager.hide();
}
this.hideBlackCover();
if (typeof this._playbackAttributesState.rate === 'number') {
this.playbackRate = this._playbackAttributesState.rate;
Expand Down

0 comments on commit 68a7026

Please sign in to comment.