浏览代码

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 年前
父节点
当前提交
07d023968a
没有帐户链接到提交者的电子邮件

+ 8
- 4
react/features/base/responsive-ui/actions.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
+import { batch } from 'react-redux';
3
 import type { Dispatch } from 'redux';
4
 import type { Dispatch } from 'redux';
4
 
5
 
5
 import { CHAT_SIZE } from '../../chat/constants';
6
 import { CHAT_SIZE } from '../../chat/constants';
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 查看文件

14
     pinParticipant
14
     pinParticipant
15
 } from '../../../base/participants';
15
 } from '../../../base/participants';
16
 import { connect } from '../../../base/redux';
16
 import { connect } from '../../../base/redux';
17
+import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
17
 import { isTestModeEnabled } from '../../../base/testing';
18
 import { isTestModeEnabled } from '../../../base/testing';
18
 import {
19
 import {
19
     getLocalAudioTrack,
20
     getLocalAudioTrack,
33
     DISPLAY_MODE_TO_STRING,
34
     DISPLAY_MODE_TO_STRING,
34
     DISPLAY_VIDEO,
35
     DISPLAY_VIDEO,
35
     DISPLAY_VIDEO_WITH_NAME,
36
     DISPLAY_VIDEO_WITH_NAME,
37
+    MOBILE_FILMSTRIP_PORTRAIT_RATIO,
36
     VIDEO_TEST_EVENTS,
38
     VIDEO_TEST_EVENTS,
37
     SHOW_TOOLBAR_CONTEXT_MENU_AFTER
39
     SHOW_TOOLBAR_CONTEXT_MENU_AFTER
38
 } from '../../constants';
40
 } from '../../constants';
144
      */
146
      */
145
     _isMobile: boolean,
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
      * Indicates whether the participant is screen sharing.
155
      * Indicates whether the participant is screen sharing.
149
      */
156
      */
764
         const {
771
         const {
765
             _defaultLocalDisplayName,
772
             _defaultLocalDisplayName,
766
             _disableLocalVideoFlip,
773
             _disableLocalVideoFlip,
774
+            _height,
767
             _isMobile,
775
             _isMobile,
776
+            _isMobilePortrait,
768
             _isScreenSharing,
777
             _isScreenSharing,
769
             _localFlipX,
778
             _localFlipX,
770
             _disableProfile,
779
             _disableProfile,
778
         const videoTrackClassName
787
         const videoTrackClassName
779
             = !_disableLocalVideoFlip && _videoTrack && !_isScreenSharing && _localFlipX ? 'flipVideoX' : '';
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
         return (
794
         return (
783
             <span
795
             <span
1043
         ? getLocalAudioTrack(tracks) : getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, participantID);
1055
         ? getLocalAudioTrack(tracks) : getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, participantID);
1044
     const _currentLayout = getCurrentLayout(state);
1056
     const _currentLayout = getCurrentLayout(state);
1045
     let size = {};
1057
     let size = {};
1058
+    let _isMobilePortrait = false;
1046
     const {
1059
     const {
1047
         startSilent,
1060
         startSilent,
1048
         disableLocalVideoFlip,
1061
         disableLocalVideoFlip,
1078
             _height: height
1091
             _height: height
1079
         };
1092
         };
1080
 
1093
 
1094
+        _isMobilePortrait = _isMobile && state['features/base/responsive-ui'].aspectRatio === ASPECT_RATIO_NARROW;
1095
+
1081
         break;
1096
         break;
1082
     }
1097
     }
1083
     case LAYOUTS.TILE_VIEW: {
1098
     case LAYOUTS.TILE_VIEW: {
1099
+
1084
         const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
1100
         const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
1085
 
1101
 
1086
         size = {
1102
         size = {
1106
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1122
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,
1107
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1123
         _isDominantSpeakerDisabled: interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR,
1108
         _isMobile,
1124
         _isMobile,
1125
+        _isMobilePortrait,
1109
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1126
         _isScreenSharing: _videoTrack?.videoType === 'desktop',
1110
         _isTestModeEnabled: isTestModeEnabled(state),
1127
         _isTestModeEnabled: isTestModeEnabled(state),
1111
         _isVideoPlayable: id && isVideoPlayable(state, id),
1128
         _isVideoPlayable: id && isVideoPlayable(state, id),

+ 8
- 0
react/features/filmstrip/constants.js 查看文件

221
  */
221
  */
222
 export const SHOW_TOOLBAR_CONTEXT_MENU_AFTER = 600;
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
  * The margin for each side of the tile view. Taken away from the available
233
  * The margin for each side of the tile view. Taken away from the available
226
  * height and width for the tile container to display in.
234
  * height and width for the tile container to display in.

正在加载...
取消
保存