-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathStringeeVideoView.js
More file actions
executable file
·74 lines (66 loc) · 1.83 KB
/
StringeeVideoView.js
File metadata and controls
executable file
·74 lines (66 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import PropTypes from 'prop-types';
import {
findNodeHandle,
Platform,
requireNativeComponent,
UIManager,
View,
} from 'react-native';
import React, {Component} from 'react';
import {StringeeVideoScalingType} from './helpers/StringeeHelper';
class StringeeVideoView extends Component {
callId: string;
local: boolean;
overlay: boolean;
scalingType: StringeeVideoScalingType;
constructor(props) {
super(props);
this.ref = React.createRef();
this.callId = props.callId;
this.local = props.local !== undefined ? props.local : false;
this.overlay = props.overlay !== undefined ? props.overlay : false;
this.scalingType =
props.scalingType !== undefined
? props.scalingType
: StringeeVideoScalingType.fill;
}
componentDidMount() {
this.viewId = findNodeHandle(this.ref.current);
if (Platform.OS === 'android') {
this.createNativeView(this.viewId);
}
}
createNativeView = viewId => {
UIManager.dispatchViewManagerCommand(
viewId,
UIManager.RNStringeeVideoView.Commands.create.toString(),
[],
);
};
render(): React.ReactNode {
return (
<View style={this.props.style}>
<RCTStringeeVideoView
{...this.props}
callId={this.callId}
local={this.local}
overLay={this.overlay}
scalingType={this.scalingType}
ref={this.ref}
/>
</View>
);
}
}
StringeeVideoView.propTypes = {
callId: PropTypes.string,
local: PropTypes.bool,
overlay: PropTypes.bool,
scalingType: PropTypes.oneOf([
StringeeVideoScalingType.fit,
StringeeVideoScalingType.fill,
]),
...View.propTypes,
};
const RCTStringeeVideoView = requireNativeComponent('RNStringeeVideoView');
export {StringeeVideoView};