Sfoglia il codice sorgente

feat(responsive-ui): Keep aspect ratio for filmstrip self view on mobile web (#9848)

* feat(responsive-ui): Keep aspect ratio for filmstrip self view on mobile web

Right now filmstrip displays self view in landscape mode.
With these changes the aspect ratio of the self view will be maintained
so on portrait mode the thumbnail will be displayed vertically.
Of course this makes sense only on mobile web.

* Code review

* Fix height
master
vp8x8 3 anni fa
parent
commit
07d023968a
Nessun account collegato all'indirizzo email del committer

+ 8
- 4
react/features/base/responsive-ui/actions.js Vedi File

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { batch } from 'react-redux';
3 4
 import type { Dispatch } from 'redux';
4 5
 
5 6
 import { CHAT_SIZE } from '../../chat/constants';
@@ -45,10 +46,13 @@ export function clientResized(clientWidth: number, clientHeight: number) {
45 46
             }
46 47
         }
47 48
 
48
-        return dispatch({
49
-            type: CLIENT_RESIZED,
50
-            clientHeight,
51
-            clientWidth: availableWidth
49
+        batch(() => {
50
+            dispatch({
51
+                type: CLIENT_RESIZED,
52
+                clientHeight,
53
+                clientWidth: availableWidth
54
+            });
55
+            dispatch(setAspectRatio(clientWidth, clientHeight));
52 56
         });
53 57
     };
54 58
 }

+ 17
- 0
react/features/filmstrip/components/web/Thumbnail.js Vedi File

@@ -14,6 +14,7 @@ import {
14 14
     pinParticipant
15 15
 } from '../../../base/participants';
16 16
 import { connect } from '../../../base/redux';
17
+import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
17 18
 import { isTestModeEnabled } from '../../../base/testing';
18 19
 import {
19 20
     getLocalAudioTrack,
@@ -33,6 +34,7 @@ import {
33 34
     DISPLAY_MODE_TO_STRING,
34 35
     DISPLAY_VIDEO,
35 36
     DISPLAY_VIDEO_WITH_NAME,
37
+    MOBILE_FILMSTRIP_PORTRAIT_RATIO,
36 38
     VIDEO_TEST_EVENTS,
37 39
     SHOW_TOOLBAR_CONTEXT_MENU_AFTER
38 40
 } from '../../constants';
@@ -144,6 +146,11 @@ export type Props = {|
144 146
      */
145 147
     _isMobile: boolean,
146 148
 
149
+    /**
150
+     * Whether we are currently running in a mobile browser in portrait orientation.
151
+     */
152
+    _isMobilePortrait: boolean,
153
+
147 154
     /**
148 155
      * Indicates whether the participant is screen sharing.
149 156
      */
@@ -764,7 +771,9 @@ class Thumbnail extends Component<Props, State> {
764 771
         const {
765 772
             _defaultLocalDisplayName,
766 773
             _disableLocalVideoFlip,
774
+            _height,
767 775
             _isMobile,
776
+            _isMobilePortrait,
768 777
             _isScreenSharing,
769 778
             _localFlipX,
770 779
             _disableProfile,
@@ -778,6 +787,9 @@ class Thumbnail extends Component<Props, State> {
778 787
         const videoTrackClassName
779 788
             = !_disableLocalVideoFlip && _videoTrack && !_isScreenSharing && _localFlipX ? 'flipVideoX' : '';
780 789
 
790
+        styles.thumbnail.height = _isMobilePortrait
791
+            ? `${Math.floor(_height * MOBILE_FILMSTRIP_PORTRAIT_RATIO)}px`
792
+            : styles.thumbnail.height;
781 793
 
782 794
         return (
783 795
             <span
@@ -1043,6 +1055,7 @@ function _mapStateToProps(state, ownProps): Object {
1043 1055
         ? getLocalAudioTrack(tracks) : getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, participantID);
1044 1056
     const _currentLayout = getCurrentLayout(state);
1045 1057
     let size = {};
1058
+    let _isMobilePortrait = false;
1046 1059
     const {
1047 1060
         startSilent,
1048 1061
         disableLocalVideoFlip,
@@ -1078,9 +1091,12 @@ function _mapStateToProps(state, ownProps): Object {
1078 1091
             _height: height
1079 1092
         };
1080 1093
 
1094
+        _isMobilePortrait = _isMobile && state['features/base/responsive-ui'].aspectRatio === ASPECT_RATIO_NARROW;
1095
+
1081 1096
         break;
1082 1097
     }
1083 1098
     case LAYOUTS.TILE_VIEW: {
1099
+
1084 1100
         const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
1085 1101
 
1086 1102
         size = {
@@ -1106,6 +1122,7 @@ function _mapStateToProps(state, ownProps): Object {
1106 1122
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1107 1123
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1108 1124
         _isMobile,
1125
+        _isMobilePortrait,
1109 1126
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1110 1127
         _isTestModeEnabled: isTestModeEnabled(state),
1111 1128
         _isVideoPlayable: id && isVideoPlayable(state, id),

+ 8
- 0
react/features/filmstrip/constants.js Vedi File

@@ -221,6 +221,14 @@ export const HORIZONTAL_FILMSTRIP_MARGIN = 39;
221 221
  */
222 222
 export const SHOW_TOOLBAR_CONTEXT_MENU_AFTER = 600;
223 223
 
224
+
225
+/**
226
+ * The ratio for filmstrip self view on mobile portrait mode.
227
+ *
228
+ * @type {number}
229
+ */
230
+export const MOBILE_FILMSTRIP_PORTRAIT_RATIO = 2.5;
231
+
224 232
 /**
225 233
  * The margin for each side of the tile view. Taken away from the available
226 234
  * height and width for the tile container to display in.

Loading…
Annulla
Salva