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-7355): don't show poster when autoplaying is on #158

Merged
merged 6 commits into from
Nov 13, 2017
Merged

Conversation

odedhutzler
Copy link
Contributor

@odedhutzler odedhutzler commented Nov 7, 2017

Description of the Changes

When autoplay is on, the poster might be shown for few miliseconds, which looks buggy.
If autoplay is on & the browser is capable of doing it, I am hiding the poster element .

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

src/player.js Outdated
this.configure(config);
(this.config.playback && !this.config.playback.autoplay) && this._appendPosterEl();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the poster DOM placeholder, you want to avoid setting the poster source, not the entire DOM element

Copy link
Contributor

@dan-ziv dan-ziv Nov 9, 2017

Choose a reason for hiding this comment

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

@OrenMe you don't even want to avoid setting the poster source but only avoid to show it (i.e. posterManager.show())

@OrenMe
Copy link
Contributor

OrenMe commented Nov 8, 2017

@odedhutzler if change media seems like a related change, IMO it is, then do it in same PR

src/player.js Outdated
this.configure(config);
(this.config.playback && !this.config.playback.autoplay) && this._appendPosterEl();
Copy link
Contributor

Choose a reason for hiding this comment

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

@odedhutzler you can't rely on config.playback.autoplay in this manner since it's can be true but the browser disallow autoplay

@@ -346,8 +346,6 @@ export default class Player extends FakeEventTarget {
}
if (this._selectEngineByPriority()) {
this._appendEngineEl();
this._posterManager.setSrc(this._config.metadata.poster);
Copy link
Contributor

@dan-ziv dan-ziv Nov 12, 2017

Choose a reason for hiding this comment

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

You want to set the source anyway, whether if we will hide it or show it later.

* @param {string} posterUrl - the poster image URL
* @returns {void}
*/
setAndShow(posterUrl: ?string): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

First, this method is redundant (see my comment above)
Second, the name of it is too generic - set and show what?

src/player.js Outdated
@@ -1280,13 +1278,16 @@ export default class Player extends FakeEventTarget {
this.dispatchEvent(new FakeEvent(CustomEvents.FALLBACK_TO_MUTED_AUTOPLAY));
} else {
Player._logger.warn("Autoplay failed, pause player");
this._posterManager.setAndShow(this._config.metadata.poster);
Copy link
Contributor

Choose a reason for hiding this comment

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

call only this._posterManager.show()

src/player.js Outdated
this.load();
this.ready().then(() => this.pause());
this.dispatchEvent(new FakeEvent(CustomEvents.AUTOPLAY_FAILED));
}
}
});
}
} else {
this._posterManager.setAndShow(this._config.metadata.poster);
Copy link
Contributor

Choose a reason for hiding this comment

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

call only this._posterManager.show()

@odedhutzler odedhutzler changed the title fix(FEC-7355): removing poster when autoplay is on fix(FEC-7355): don't show poster when autoplaying is on Nov 13, 2017
@dan-ziv dan-ziv merged commit d940225 into master Nov 13, 2017
@dan-ziv dan-ziv deleted the FEC-7355 branch November 13, 2017 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants