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

Feature/android use fake fullscreen #2866

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
56 changes: 42 additions & 14 deletions build/mediaelement-and-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,13 @@ var MediaElement = function MediaElement(idOrNode, options, sources) {
}
});
}
return response;
} else {
t.mediaElement.renderer[methodName](args);
return t.mediaElement.renderer[methodName](args);
}
} catch (e) {
t.mediaElement.generateError(e, mediaFiles);
throw e;
}
},
assignMethods = function assignMethods(methodName) {
Expand All @@ -897,13 +899,14 @@ var MediaElement = function MediaElement(idOrNode, options, sources) {

if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer[methodName] === 'function') {
if (t.mediaElement.promises.length) {
Promise.all(t.mediaElement.promises).then(function () {
triggerAction(methodName, args);
return Promise.all(t.mediaElement.promises).then(function () {
return triggerAction(methodName, args);
}).catch(function (e) {
t.mediaElement.generateError(e, mediaFiles);
return Promise.reject(e);
});
} else {
triggerAction(methodName, args);
return triggerAction(methodName, args);
}
}
return null;
Expand Down Expand Up @@ -1187,7 +1190,12 @@ Object.assign(_player.config, {

fullscreenText: null,

useFakeFullscreen: false
useFakeFullscreen: false,

androidUseFakeFullscreen: false,

fakeFullscreenMode: 'vertical'

});

Object.assign(_player2.default.prototype, {
Expand Down Expand Up @@ -1315,10 +1323,22 @@ Object.assign(_player2.default.prototype, {
(0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen');
(0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen');

if (t.options.fakeFullscreenMode === 'horizontal') {
(0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen__horizontal');
(0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen__horizontal');
var innerContainer = t.getElement(t.container).firstElementChild;
var width = _window2.default.innerWidth || _document2.default.body.clientWidth;
var height = _window2.default.innerHeight || _document2.default.body.clientHeight;
var top = void 0,
left = void 0;
top = left = (height - width) / 2;
innerContainer.style.transform = 'rotate(90deg) translate(' + top + 'px, ' + left + 'px)';
}

t.normalHeight = parseFloat(containerStyles.height);
t.normalWidth = parseFloat(containerStyles.width);

if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') {
if (t.options.androidUseFakeFullscreen === false && (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native')) {
Features.requestFullScreen(t.getElement(t.container));

if (t.isInIframe) {
Expand Down Expand Up @@ -1407,7 +1427,12 @@ Object.assign(_player2.default.prototype, {

(0, _dom.removeClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen');
(0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen');

if (t.options.fakeFullscreenMode === 'horizontal') {
(0, _dom.removeClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen__horizontal');
(0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen__horizontal');
var innerContainer = t.getElement(t.container).firstElementChild;
innerContainer.style.transform = 'none';
}
if (t.options.setDimensions) {
t.getElement(t.container).style.width = t.normalWidth + 'px';
t.getElement(t.container).style.height = t.normalHeight + 'px';
Expand Down Expand Up @@ -3057,7 +3082,7 @@ Object.assign(_player2.default.prototype, {
mute = _document2.default.createElement('div');

mute.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'volume-button ' + t.options.classPrefix + 'mute';
mute.innerHTML = mode === 'horizontal' ? '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' : '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' + ('<a href="javascript:void(0);" class="' + t.options.classPrefix + 'volume-slider" ') + ('aria-label="' + _i18n2.default.t('mejs.volume-slider') + '" aria-valuemin="0" aria-valuemax="100" role="slider" ') + 'aria-orientation="vertical">' + ('<span class="' + t.options.classPrefix + 'offscreen">' + volumeControlText + '</span>') + ('<div class="' + t.options.classPrefix + 'volume-total">') + ('<div class="' + t.options.classPrefix + 'volume-current"></div>') + ('<div class="' + t.options.classPrefix + 'volume-handle"></div>') + '</div>' + '</a>';
mute.innerHTML = mode === 'horizontal' ? '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' : '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' + ('<a class="' + t.options.classPrefix + 'volume-slider" ') + ('aria-label="' + _i18n2.default.t('mejs.volume-slider') + '" aria-valuemin="0" aria-valuemax="100" role="slider" ') + 'aria-orientation="vertical">' + ('<span class="' + t.options.classPrefix + 'offscreen">' + volumeControlText + '</span>') + ('<div class="' + t.options.classPrefix + 'volume-total">') + ('<div class="' + t.options.classPrefix + 'volume-current"></div>') + ('<div class="' + t.options.classPrefix + 'volume-handle"></div>') + '</div>' + '</a>';

t.addControlElement(mute, 'volume');

Expand Down Expand Up @@ -3122,7 +3147,6 @@ Object.assign(_player2.default.prototype, {
if (mode === 'horizontal') {
var anchor = _document2.default.createElement('a');
anchor.className = t.options.classPrefix + 'horizontal-volume-slider';
anchor.href = 'javascript:void(0);';
anchor.setAttribute('aria-label', _i18n2.default.t('mejs.volume-slider'));
anchor.setAttribute('aria-valuemin', 0);
anchor.setAttribute('aria-valuemax', 100);
Expand Down Expand Up @@ -5027,6 +5051,10 @@ var MediaElementPlayer = function () {
});

t.globalKeydownCallback = function (event) {
if (!_document2.default.activeElement) {
return true;
}

var container = _document2.default.activeElement.closest('.' + t.options.classPrefix + 'container'),
target = t.media.closest('.' + t.options.classPrefix + 'container');
t.hasFocus = !!(container && target && container.id === target.id);
Expand Down Expand Up @@ -5065,17 +5093,17 @@ var MediaElementPlayer = function () {
}, {
key: 'play',
value: function play() {
this.proxy.play();
return this.proxy.play();
}
}, {
key: 'pause',
value: function pause() {
this.proxy.pause();
return this.proxy.pause();
}
}, {
key: 'load',
value: function load() {
this.proxy.load();
return this.proxy.load();
}
}, {
key: 'setCurrentTime',
Expand Down Expand Up @@ -5347,12 +5375,12 @@ var DefaultPlayer = function () {
_createClass(DefaultPlayer, [{
key: 'play',
value: function play() {
this.media.play();
return this.media.play();
}
}, {
key: 'pause',
value: function pause() {
this.media.pause();
return this.media.pause();
}
}, {
key: 'load',
Expand Down
2 changes: 1 addition & 1 deletion build/mediaelement-and-player.min.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions build/mediaelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,13 @@ var MediaElement = function MediaElement(idOrNode, options, sources) {
}
});
}
return response;
} else {
t.mediaElement.renderer[methodName](args);
return t.mediaElement.renderer[methodName](args);
}
} catch (e) {
t.mediaElement.generateError(e, mediaFiles);
throw e;
}
},
assignMethods = function assignMethods(methodName) {
Expand All @@ -897,13 +899,14 @@ var MediaElement = function MediaElement(idOrNode, options, sources) {

if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer[methodName] === 'function') {
if (t.mediaElement.promises.length) {
Promise.all(t.mediaElement.promises).then(function () {
triggerAction(methodName, args);
return Promise.all(t.mediaElement.promises).then(function () {
return triggerAction(methodName, args);
}).catch(function (e) {
t.mediaElement.generateError(e, mediaFiles);
return Promise.reject(e);
});
} else {
triggerAction(methodName, args);
return triggerAction(methodName, args);
}
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion build/mediaelement.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions build/mediaelementplayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ Reference: http://blog.rrwd.nl/2015/04/04/the-screen-reader-text-class-why-and-h
z-index: 1000;
}

.mejs__container-fullscreen__horizontal .mejs__inner {
height: 100vw;
/* transform: rotate(90deg) translate(22%, 39%); */
width: 100vh;
}

.mejs__container-fullscreen .mejs__mediaelement,
.mejs__container-fullscreen video {
height: 100% !important;
Expand Down
2 changes: 1 addition & 1 deletion build/mediaelementplayer.min.css

Large diffs are not rendered by default.

Binary file modified build/mejs-controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 45 additions & 1 deletion build/mejs-controls.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/css/mediaelementplayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ Reference: http://blog.rrwd.nl/2015/04/04/the-screen-reader-text-class-why-and-h
z-index: 1000;
}

.mejs__container-fullscreen__horizontal .mejs__inner {
height: 100vw;
/* transform: rotate(90deg) translate(22%, 39%); */
width: 100vh;
}

.mejs__container-fullscreen .mejs__mediaelement,
.mejs__container-fullscreen video {
height: 100% !important;
Expand Down
Loading