|
@@ -1,20 +1,8 @@
|
1
|
1
|
import React, { Component } from 'react';
|
2
|
|
-import { View } from 'react-native';
|
3
|
2
|
import { RTCView } from 'react-native-webrtc';
|
4
|
3
|
|
5
|
|
-import { Platform } from '../../../react';
|
6
|
|
-
|
7
|
4
|
import { styles } from './styles';
|
8
|
5
|
|
9
|
|
-/**
|
10
|
|
- * Indicates whether RTCView (is to be considered that it) natively supports
|
11
|
|
- * i.e. implements mirroring the video it renders. If false, a workaround will
|
12
|
|
- * be used in an attempt to support mirroring in Video. If RTCView does not
|
13
|
|
- * implement mirroring on a specific platform but the workaround causes issues,
|
14
|
|
- * set to true for that platform to disable the workaround.
|
15
|
|
- */
|
16
|
|
-const RTCVIEW_SUPPORTS_MIRROR = Platform.OS === 'android';
|
17
|
|
-
|
18
|
6
|
/**
|
19
|
7
|
* The React Native component which is similar to Web's video element and wraps
|
20
|
8
|
* around react-native-webrtc's RTCView.
|
|
@@ -91,31 +79,15 @@ export class Video extends Component {
|
91
|
79
|
const style = styles.video;
|
92
|
80
|
const objectFit = (style && style.objectFit) || 'cover';
|
93
|
81
|
|
94
|
|
- const { mirror } = this.props;
|
95
|
|
-
|
96
|
|
- // XXX RTCView may not support support mirroring, even when
|
97
|
|
- // providing a transform style property (e.g. iOS) . As a
|
98
|
|
- // workaround, wrap the RTCView inside another View and apply the
|
99
|
|
- // transform style property to that View instead.
|
100
|
|
- const mirrorWorkaround = mirror && !RTCVIEW_SUPPORTS_MIRROR;
|
101
|
|
-
|
102
|
82
|
// eslint-disable-next-line no-extra-parens
|
103
|
|
- const video = (
|
|
83
|
+ return (
|
104
|
84
|
<RTCView
|
105
|
|
- mirror = { mirrorWorkaround ? false : mirror }
|
|
85
|
+ mirror = { this.props.mirror }
|
106
|
86
|
objectFit = { objectFit }
|
107
|
87
|
streamURL = { streamURL }
|
108
|
88
|
style = { style }
|
109
|
89
|
zOrder = { this.props.zOrder } />
|
110
|
90
|
);
|
111
|
|
-
|
112
|
|
- if (mirrorWorkaround) {
|
113
|
|
- return (
|
114
|
|
- <View style = { styles.mirroredVideo }>{ video }</View>
|
115
|
|
- );
|
116
|
|
- }
|
117
|
|
-
|
118
|
|
- return video;
|
119
|
91
|
}
|
120
|
92
|
|
121
|
93
|
// RTCView has peculiarities which may or may not be platform specific.
|