소스 검색

fix(UI): add playsinline attr for video element

> playinline attr needs to be set to true to stop local video from playing in full screen mode in Safari on iOS.
> This applies to the local video thumbnails and the camera previews from the device selection menu and video preview button
master
Jaya Allamsetty 5 년 전
부모
커밋
b7b861259b

+ 4
- 1
modules/UI/videolayout/LocalVideo.js 파일 보기

@@ -276,9 +276,12 @@ export default class LocalVideo extends SmallVideo {
276 276
 
277 277
         // Ensure the video gets play() called on it. This may be necessary in the
278 278
         // case where the local video container was moved and re-attached, in which
279
-        // case video does not autoplay.
279
+        // case video does not autoplay. Also, set the playsinline attribute on the
280
+        // video element so that local video doesn't open in full screen by default
281
+        // in Safari browser on iOS.
280 282
         const video = this.container.querySelector('video');
281 283
 
284
+        video && video.setAttribute('playsinline', 'true');
282 285
         video && !config.testing?.noAutoPlayVideo && video.play();
283 286
     }
284 287
 }

+ 10
- 2
react/features/base/media/components/web/Video.js 파일 보기

@@ -32,7 +32,13 @@ type Props = {
32 32
      * Used to determine the value of the autoplay attribute of the underlying
33 33
      * video element.
34 34
      */
35
-    autoPlay: boolean
35
+    autoPlay: boolean,
36
+
37
+    /**
38
+     * Used to determine the value of the autoplay attribute of the underlying
39
+     * video element.
40
+     */
41
+    playsinline: boolean
36 42
 };
37 43
 
38 44
 /**
@@ -51,7 +57,8 @@ class Video extends Component<Props> {
51 57
     static defaultProps = {
52 58
         className: '',
53 59
         autoPlay: true,
54
-        id: ''
60
+        id: '',
61
+        playsinline: true
55 62
     };
56 63
 
57 64
     /**
@@ -140,6 +147,7 @@ class Video extends Component<Props> {
140 147
                 autoPlay = { this.props.autoPlay }
141 148
                 className = { this.props.className }
142 149
                 id = { this.props.id }
150
+                playsInline = { this.props.playsinline }
143 151
                 ref = { this._setVideoElement } />
144 152
         );
145 153
     }

+ 1
- 0
react/features/device-selection/components/VideoInputPreview.js 파일 보기

@@ -45,6 +45,7 @@ class VideoInputPreview extends Component<Props> {
45 45
             <div className = { className }>
46 46
                 <Video
47 47
                     className = 'video-input-preview-display flipVideoX'
48
+                    playsinline = { true }
48 49
                     videoTrack = {{ jitsiTrack: this.props.track }} />
49 50
                 <div className = 'video-input-preview-error'>
50 51
                     { error || '' }

+ 1
- 0
react/features/settings/components/web/video/VideoSettingsContent.js 파일 보기

@@ -167,6 +167,7 @@ class VideoSettingsContent extends Component<Props, State> {
167 167
                 <div className = 'video-preview-overlay' />
168 168
                 <Video
169 169
                     className = { videoClassName }
170
+                    playsinline = { true }
170 171
                     videoTrack = {{ jitsiTrack }} />
171 172
             </div>
172 173
         );

Loading…
취소
저장