-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Fullscreen updates for iOS #1511
Conversation
This event isn't really being used for this usecase right now, so, no need to trigger it.
In #1504 when I was asking about use cases I was actually meaning the entire vjs.IS_IOS block. Is there a usecase behind checking isFullscreen in enterFullScreen mode? |
I think it's good to do it just in case. It's theoretically possible that the fullscreen gets cancelled for whatever reason. Also, this way, it mimics the code that uses the proper |
But if we didn't change anything when it entered fullscreen does it matter? The thing that we've relied on up to this point is that when enterFullScreen is used, Video.js essentially doesn't know about it. The controls stay the same and the vjs-fullscreen class isn't added, which is fine because they wouldn't do anything anyway since you can't see the player. Then when you exitFullScreen everything is exactly how it should be because we never changed anything (unless I'm missing something). Consistency may be a good enough reason to add this, though you might be able to make a case that they're different enough modes that they don't need to work the same, since in one mode we have no control over the UI. What were you trying to do when you discovered this issue? |
The problem was that on iOS, even after exiting fullscreen, |
Ah, I get it now. So this could also potentially be fixed by moving the isFullScreen(true) into the specific fullscreen-type blocks, excluding it from the In that case I might go back on my previous comment of removing the fullscreenchange events. If we're going to mimic requestfullscreen with enterfullscreen we should probably do it fully. Could this run into the same issue that #1476 is trying to solve for? I'm not sure that one's quite valid yet. |
@@ -209,6 +209,18 @@ vjs.Html5.prototype.supportsFullScreen = function(){ | |||
|
|||
vjs.Html5.prototype.enterFullScreen = function(){ | |||
var video = this.el_; | |||
|
|||
if (vjs.IS_IOS) { | |||
vjs.one(video, 'webkitbeginfullscreen', vjs.bind(this, function(e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line could be simplified to
this.one('webkitbeginfullscreen', function(e) {
Same with line 217
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
I think changing from setting Maybe the real solution is to change |
|
||
if (vjs.IS_IOS) { | ||
vjs.one(video, 'webkitbeginfullscreen', vjs.bind(this, function(e) { | ||
this.player_.isFullscreen(video['webkitDisplayingFullscreen']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check video['webkitDisplayingFullscreen']
or can we just assume that it's true since it's in webkitbeginfullscreen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may be able to assume it's true. This is again to mimic the other piece of code.
Don't bother checking whether the video element is fullscreen but just assume we are fullscreen.
Yeah, I think you're right about the isFullScreen change. Want to take a quick pass at it? If it's going to be complicated or a significant change we can pull this in first then make that change. |
I'll take a look. |
I think changing the a POC is below: function isFullscreen() {
var isFS,
fsApi = vjs.browser.fullscreenAPI,
thisEl = this.el(),
techEl = this.tech.el(),
fsEl;
// if we are spec compliant and there is no fullscreen element, return false
// otherwise, return true if the fullscreen element is either our player div or the tech element
if (fsApi) {
fsEl = document[fsApi.fullscreenElement]
return fsEl || fsEl === thisEl || fsEl === techEl;
}
// if we are not spec compliant, then either the player el is in fullscreen
// or the tech el is in fullscreen.
isFS = isFS || thisEl['webkitDisplayingFullscreen'];
isFS = isFS || techEl['webkitDisplayingFullscreen'];;
return isFS;
} |
This reverts commit cc45177. Conflicts: src/js/media/html5.js
@@ -209,6 +209,20 @@ vjs.Html5.prototype.supportsFullScreen = function(){ | |||
|
|||
vjs.Html5.prototype.enterFullScreen = function(){ | |||
var video = this.el_; | |||
|
|||
if (vjs.IS_IOS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use feature detection here instead of UA? Maybe check for this.el_['onwebkitbeginfullscreen']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can test by checking: 'webkitDisplayingFullscreen' in video
. onwebkitbeginfullscreen
doesn't exist on the element.
#1504 but against stable.