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-8032): when switching to iOS fullscreen in portrait captions displayed in the middle for few seconds #223

Merged
merged 14 commits into from
May 6, 2018

Conversation

odedhutzler
Copy link
Contributor

@odedhutzler odedhutzler commented Apr 18, 2018

  • when detecting iOS and full screen, removing the transition -60px because there is no bottom menu bar.
  • added environment classes to the player main class to indicate browser and device.
  • added helper 'playkit' global var to the webpack build.

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

fired an iOSFullscreen action when going to full screen on ios devices.
added a class if iosFullscreen state changes respectivly,
removed the transition -60px because there is no bottom menu bar
@odedhutzler odedhutzler self-assigned this Apr 18, 2018
@dan-ziv
Copy link
Contributor

dan-ziv commented Apr 22, 2018

@odedhutzler I think this solution is too specific.
You don't really need to save iOSFullscreen state in the store since you already know when u r
on fullscreen and what is your platform.
If the solution is only to set a custom css on iOS we can handle it simply in the render function of the fullscreen component

@@ -276,6 +277,7 @@ class Shell extends BaseComponent {
if (this.props.metadataLoaded) playerClasses.push(style['state-' + this.props.currentState]);
if (this.props.seekbarDraggingActive) playerClasses.push(style.hover);
if (this.props.playerClientRect && this.props.playerClientRect.width <= 480) playerClasses.push(style.sizeSm);
if (this.props.fullscreen && this.player.env.os.name === 'iOS') playerClasses.push(style.iOSFullscreen);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this condition from between the size condition (row above and below).
Also, let's just add fullscreen state class, e.g. if (this.props.fullscreen) playerClass.push(style.inFullscreen) (or maybe just fullscreen)
and add user agent class, so:

let playerClasses = [style.player, style.skinDefault, this.player.env.os.name, this.player.env.browser.name];
playerClasses.push(props.playerClasses);

Probably need to add the playkit prefix to these new classes.

ref in V2: https://github.com/kaltura/mwEmbed/blob/ba045a91abdee7d0761ba543f5068b4335c04c9f/modules/EmbedPlayer/resources/mw.PlayerLayoutBuilder.js#L152-L177

changing the class selection accordingly
@@ -265,7 +266,9 @@ class Shell extends BaseComponent {
* @memberof Shell
*/
render(props: any): React$Element<any> {
let playerClasses = [style.player, style.skinDefault];
let playerClasses = [style.player, style.skinDefault,
`playkit-${this.player.env.os.name.replace(/ /g, "_")}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add the prefix as global in webpack.config and add this as token here.
See here how we use it with webpack.DefinePlugin
We define it here:

new webpack.DefinePlugin({
__VERSION__: JSON.stringify(packageData.version),
__NAME__: JSON.stringify(packageData.name),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
})

and use it here:

export {UIManager};
export {__VERSION__ as VERSION, __NAME__ as NAME};

so you can add another define in webpack.config ➡️ const CSS_MODULE_PREFIX = 'playkit' and use it in webpack config in the define plugin and also in the style loader config where we define the localIdentName

OrenMe
OrenMe previously approved these changes Apr 23, 2018
@@ -4,11 +4,13 @@ const webpack = require("webpack");
const path = require("path");
const PROD = (process.env.NODE_ENV === 'production');
const packageData = require("./package.json");
const CSS_MODULE_PREFIX = "playkit-";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the - since this is not part of the prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done + beautify

@@ -265,7 +267,9 @@ class Shell extends BaseComponent {
* @memberof Shell
*/
render(props: any): React$Element<any> {
let playerClasses = [style.player, style.skinDefault];
let playerClasses = [style.player, style.skinDefault,
__CSS_MODULE_PREFIX__+this.player.env.os.name.replace(/ /g, "_"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Format code!

@@ -66,7 +68,7 @@ module.exports = {
options: {
camelCase: true,
modules: true,
localIdentName: 'playkit-[local]'
localIdentName: CSS_MODULE_PREFIX+'[local]'
Copy link
Contributor

Choose a reason for hiding this comment

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

Format code!

@OrenMe
Copy link
Contributor

OrenMe commented Apr 24, 2018

@dan-ziv please re-review following fixes

@@ -7,6 +7,7 @@ import {bindActions} from '../../utils/bind-actions';
import {actions} from '../../reducers/shell';
import {KeyMap} from "../../utils/key-map";

declare var __CSS_MODULE_PREFIX__: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this declaration to the ui manager

let playerClasses = [style.player, style.skinDefault];
let playerClasses = [style.player, style.skinDefault,
__CSS_MODULE_PREFIX__ + '-' + this.player.env.os.name.replace(/ /g, "_"),
__CSS_MODULE_PREFIX__ + '-' + this.player.env.browser.name.replace(/ /g, "_")];
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to re calculate it on every time render has been called. We can calculate it one time in the constructor and use it here.

this._osClass = `${__CSS_MODULE_PREFIX__}-${this.player.env.os.name.replace(/ /g, '-')}`;
this._browserClass = `${__CSS_MODULE_PREFIX__}-${this.player.env.browser.name.replace(/ /g, '-')}`;

One more thing is to change the replacer string to '-' instead of '_' since this is our convention in css class names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@dan-ziv
Copy link
Contributor

dan-ziv commented Apr 25, 2018

@odedhutzler update description

dan-ziv
dan-ziv previously approved these changes Apr 25, 2018
@odedhutzler odedhutzler merged commit 4da5170 into master May 6, 2018
@odedhutzler odedhutzler deleted the FEC-8032 branch May 6, 2018 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants