-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
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 I think this solution is too specific. |
src/components/shell/shell.js
Outdated
@@ -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); |
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.
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.
changing the class selection accordingly
src/components/shell/shell.js
Outdated
@@ -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, "_")}`, |
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 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:
playkit-js-ui/webpack.config.js
Lines 9 to 13 in afe561f
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:
Lines 23 to 24 in afe561f
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
webpack.config.js
Outdated
@@ -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-"; |
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.
Remove the - since this is not part of the prefix
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.
done + beautify
src/components/shell/shell.js
Outdated
@@ -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, "_"), |
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.
Format code!
webpack.config.js
Outdated
@@ -66,7 +68,7 @@ module.exports = { | |||
options: { | |||
camelCase: true, | |||
modules: true, | |||
localIdentName: 'playkit-[local]' | |||
localIdentName: CSS_MODULE_PREFIX+'[local]' |
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.
Format code!
@dan-ziv please re-review following fixes |
src/components/shell/shell.js
Outdated
@@ -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; |
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.
Move this declaration to the ui manager
src/components/shell/shell.js
Outdated
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, "_")]; |
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.
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.
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.
done
@odedhutzler update description |
CheckLists