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

Automatic fullscreen videos on device roation #10108

Merged
merged 5 commits into from
Jul 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Requested changes
  • Loading branch information
wassgha committed Jul 27, 2017
commit 6f76e185ad4f01502febb1f072642540b89c893a
7 changes: 5 additions & 2 deletions src/service/video-manager-impl.js
Original file line number Diff line number Diff line change
@@ -476,8 +476,8 @@ class VideoEntry {
VideoAttributes.FULLSCREEN_ON_LANDSCAPE
);

this.hasFullscreenOnLandscape = fsOnLandscapeAttr !== undefined
&& (fsOnLandscapeAttr === '' || fsOnLandscapeAttr == 'always');
this.hasFullscreenOnLandscape = fsOnLandscapeAttr == ''
|| fsOnLandscapeAttr == 'always';

listenOncePromise(element, VideoEvents.LOAD)
.then(() => this.videoLoaded());
@@ -581,6 +581,9 @@ class VideoEntry {
* @private
*/
orientationChanged_(isLandscape) {
if (!this.loaded_) {
return;
}
// Put the video in/out of fullscreen depending on screen orientation
Copy link
Contributor

Choose a reason for hiding this comment

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

return early if this.loaded_ is false. What can happen is orientation change occurring before the layoutCallback of a video player is called in which case their iframe is null. Now at the moment we can't get to that case because of the this.getPlayingState() == PlayingStates.PLAYING_MANUAL check but I like to keep the code safe since later supporting AUTOPLAY can surface the race condition.

if (!isLandscape && this.isFullscreenByOrientationChange_) {
this.exitFullscreen_();