Skip to content

Commit 639e7e1

Browse files
authored
Mention scaletype in comments (#453)
* Mention scaletype in comments * Update readme
1 parent d0f6e29 commit 639e7e1

File tree

4 files changed

+107
-200
lines changed

4 files changed

+107
-200
lines changed

docs/README.md

Lines changed: 93 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,240 +1,136 @@
1-
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2-
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3-
# React Component Reference
1+
Components
2+
----------
43

5-
- [TwilioVideo](#twiliovideo)
6-
- [TwilioVideoLocalView](#twiliovideolocalview)
7-
- [TwilioVideoParticipantView](#twiliovideoparticipantview)
84

9-
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5+
**src/TwilioVideo.android.js**
106

11-
## TwilioVideo
127

13-
From [`../src/TwilioVideo.js`](../src/TwilioVideo.js)
8+
### 1. CustomTwilioVideoView
149

15-
#### onCameraDidStart
1610

17-
```js
18-
onCameraDidStart: Function
19-
```
2011

21-
Called when the camera has started
2212

23-
#### onCameraDidStopRunning
13+
Property | Type | Required | Default value | Description
14+
:--- | :--- | :--- | :--- | :---
15+
onCameraSwitched | func | no | | Callback that is called when camera source changes
16+
onVideoChanged | func | no | | Callback that is called when video is toggled.
17+
onAudioChanged | func | no | | Callback that is called when a audio is toggled.
18+
onRoomDidConnect | func | no | | Callback that is called when user is connected to a room.
19+
onRoomDidFailToConnect | func | no | | Callback that is called when connecting to room fails.
20+
onRoomDidDisconnect | func | no | | Callback that is called when user is disconnected from room.
21+
onParticipantAddedDataTrack | func | no | | Called when a new data track has been added @param {{participant, track}}
22+
onParticipantRemovedDataTrack | func | no | | Called when a data track has been removed @param {{participant, track}}
23+
onDataTrackMessageReceived | func | no | | Called when an dataTrack receives a message @param {{message}}
24+
onParticipantAddedVideoTrack | func | no | | Called when a new video track has been added @param {{participant, track, enabled}}
25+
onParticipantRemovedVideoTrack | func | no | | Called when a video track has been removed @param {{participant, track}}
26+
onParticipantAddedAudioTrack | func | no | | Called when a new audio track has been added @param {{participant, track}}
27+
onParticipantRemovedAudioTrack | func | no | | Called when a audio track has been removed @param {{participant, track}}
28+
onRoomParticipantDidConnect | func | no | | Callback called a participant enters a room.
29+
onRoomParticipantDidDisconnect | func | no | | Callback that is called when a participant exits a room.
30+
onParticipantEnabledVideoTrack | func | no | | Called when a video track has been enabled. @param {{participant, track}}
31+
onParticipantDisabledVideoTrack | func | no | | Called when a video track has been disabled. @param {{participant, track}}
32+
onParticipantEnabledAudioTrack | func | no | | Called when an audio track has been enabled. @param {{participant, track}}
33+
onParticipantDisabledAudioTrack | func | no | | Called when an audio track has been disabled. @param {{participant, track}}
34+
onStatsReceived | func | no | | Callback that is called when stats are received (after calling getStats)
35+
onNetworkQualityLevelsChanged | func | no | | Callback that is called when network quality levels are changed (only if enableNetworkQualityReporting in connect is set to true)
36+
onDominantSpeakerDidChange | func | no | | Called when dominant speaker changes @param {{ participant, room }} dominant participant and room
37+
-----
2438

25-
```js
26-
onCameraDidStopRunning: Function
27-
```
39+
**src/TwilioVideo.ios.js**
2840

29-
Called when the camera has stopped running with an error
3041

31-
@param {{error}} The error message description
42+
### 1. TwilioVideo
3243

33-
#### onCameraWasInterrupted
3444

35-
```js
36-
onCameraWasInterrupted: Function
37-
```
3845

39-
Called when the camera has been interrupted
4046

41-
#### onParticipantAddedAudioTrack
47+
Property | Type | Required | Default value | Description
48+
:--- | :--- | :--- | :--- | :---
49+
screenShare | bool | no | | Flag that enables screen sharing RCTRootView instead of camera capture
50+
onRoomDidConnect | func | no | | Called when the room has connected @param {{roomName, participants}}
51+
onRoomDidDisconnect | func | no | | Called when the room has disconnected @param {{roomName, error}}
52+
onRoomDidFailToConnect | func | no | | Called when connection with room failed @param {{roomName, error}}
53+
onRoomParticipantDidConnect | func | no | | Called when a new participant has connected @param {{roomName, participant}}
54+
onRoomParticipantDidDisconnect | func | no | | Called when a participant has disconnected @param {{roomName, participant}}
55+
onParticipantAddedVideoTrack | func | no | | Called when a new video track has been added @param {{participant, track, enabled}}
56+
onParticipantRemovedVideoTrack | func | no | | Called when a video track has been removed @param {{participant, track}}
57+
onParticipantAddedDataTrack | func | no | | Called when a new data track has been added @param {{participant, track}}
58+
onParticipantRemovedDataTrack | func | no | | Called when a data track has been removed @param {{participant, track}}
59+
onParticipantAddedAudioTrack | func | no | | Called when a new audio track has been added @param {{participant, track}}
60+
onParticipantRemovedAudioTrack | func | no | | Called when a audio track has been removed @param {{participant, track}}
61+
onParticipantEnabledVideoTrack | func | no | | Called when a video track has been enabled. @param {{participant, track}}
62+
onParticipantDisabledVideoTrack | func | no | | Called when a video track has been disabled. @param {{participant, track}}
63+
onParticipantEnabledAudioTrack | func | no | | Called when an audio track has been enabled. @param {{participant, track}}
64+
onParticipantDisabledAudioTrack | func | no | | Called when an audio track has been disabled. @param {{participant, track}}
65+
onDataTrackMessageReceived | func | no | | Called when an dataTrack receives a message @param {{message}}
66+
onCameraDidStart | func | no | | Called when the camera has started
67+
onCameraWasInterrupted | func | no | | Called when the camera has been interrupted
68+
onCameraInterruptionEnded | func | no | | Called when the camera interruption has ended
69+
onCameraDidStopRunning | func | no | | Called when the camera has stopped runing with an error @param {{error}} The error message description
70+
onStatsReceived | func | no | | Called when stats are received (after calling getStats)
71+
onNetworkQualityLevelsChanged | func | no | | Called when the network quality levels of a participant have changed (only if enableNetworkQualityReporting is set to True when connecting)
72+
onDominantSpeakerDidChange | func | no | | Called when dominant speaker changes @param {{ participant, room }} dominant participant
73+
-----
4274

43-
```js
44-
onParticipantAddedAudioTrack: Function
45-
```
75+
**src/TwilioVideoLocalView.android.js**
4676

47-
Called when a new audio track has been added
4877

49-
@param {{participant, track}}
78+
### 1. TwilioVideoPreview
5079

51-
#### onParticipantAddedVideoTrack
5280

53-
```js
54-
onParticipantAddedVideoTrack: Function
55-
```
5681

57-
Called when a new video track has been added
5882

59-
@param {{participant, track, enabled}}
83+
Property | Type | Required | Default value | Description
84+
:--- | :--- | :--- | :--- | :---
85+
scaleType | enum(&#x27;fit&#x27;,&#x27;fill&#x27;,) | no | | How the video stream should be scaled to fit its container.
86+
-----
6087

61-
#### onParticipantDisabledVideoTrack
88+
**src/TwilioVideoLocalView.ios.js**
6289

63-
```js
64-
onParticipantDisabledVideoTrack: Function
65-
```
6690

67-
Called when a video track has been disabled.
91+
### 1. TwilioVideoLocalView
6892

69-
@param {{participant, track}}
7093

71-
#### onParticipantDisabledAudioTrack
7294

73-
```js
74-
onParticipantDisabledAudioTrack: Function
75-
```
7695

77-
Called when an audio track has been disabled.
96+
Property | Type | Required | Default value | Description
97+
:--- | :--- | :--- | :--- | :---
98+
enabled | bool | YES | | Indicate if video feed is enabled.
99+
scaleType | enum(&#x27;fit&#x27;,&#x27;fill&#x27;,) | no | | How the video stream should be scaled to fit its container.
100+
-----
78101

79-
@param {{participant, track}}
102+
**src/TwilioVideoParticipantView.android.js**
80103

81-
#### onParticipantEnabledVideoTrack
82104

83-
```js
84-
onParticipantEnabledVideoTrack: Function
85-
```
105+
### 1. TwilioRemotePreview
86106

87-
Called when a video track has been enabled.
88107

89-
@param {{participant, track}}
90108

91-
#### onParticipantEnabledAudioTrack
92109

93-
```js
94-
onParticipantEnabledVideoTrack: Function
95-
```
110+
Property | Type | Required | Default value | Description
111+
:--- | :--- | :--- | :--- | :---
112+
trackIdentifier | shape(,) | no | | &nbsp;
113+
onFrameDimensionsChanged | func | no | | &nbsp;
114+
trackSid | string | no | | &nbsp;
115+
renderToHardwareTextureAndroid | string | no | | &nbsp;
116+
onLayout | string | no | | &nbsp;
117+
accessibilityLiveRegion | string | no | | &nbsp;
118+
accessibilityComponentType | string | no | | &nbsp;
119+
importantForAccessibility | string | no | | &nbsp;
120+
accessibilityLabel | string | no | | &nbsp;
121+
nativeID | string | no | | &nbsp;
122+
testID | string | no | | &nbsp;
123+
-----
96124

97-
Called when an audio track has been enabled.
125+
**src/TwilioVideoParticipantView.ios.js**
98126

99-
@param {{participant, track}}
100127

101-
#### onParticipantRemovedAudioTrack
128+
### 1. TwilioVideoParticipantView
102129

103-
```js
104-
onParticipantRemovedAudioTrack: Function
105-
```
106130

107-
Called when a audio track has been removed
108131

109-
@param {{participant, track}}
110132

111-
#### onParticipantRemovedVideoTrack
112-
113-
```js
114-
onParticipantRemovedVideoTrack: Function
115-
```
116-
117-
Called when a video track has been removed
118-
119-
@param {{participant, track}}
120-
121-
#### onRoomDidConnect
122-
123-
```js
124-
onRoomDidConnect: Function
125-
```
126-
127-
Called when the room has connected
128-
129-
@param {{roomName, participants}}
130-
131-
#### onRoomDidDisconnect
132-
133-
```js
134-
onRoomDidDisconnect: Function
135-
```
136-
137-
Called when the room has disconnected
138-
139-
@param {{roomName, error}}
140-
141-
#### onRoomDidFailToConnect
142-
143-
```js
144-
onRoomDidFailToConnect: Function
145-
```
146-
147-
Called when connection with room failed
148-
149-
@param {{roomName, error}}
150-
151-
#### onRoomParticipantDidConnect
152-
153-
```js
154-
onRoomParticipantDidConnect: Function
155-
```
156-
157-
Called when a new participant has connected
158-
159-
@param {{roomName, participant}}
160-
161-
#### onRoomParticipantDidDisconnect
162-
163-
```js
164-
onRoomParticipantDidDisconnect: Function
165-
```
166-
167-
Called when a participant has disconnected
168-
169-
@param {{roomName, participant}}
170-
171-
#### setLocalVideoEnabled
172-
173-
```js
174-
setLocalVideoEnabled: Function
175-
```
176-
177-
Called when a local video is disable / enabled, how to use it below
178-
179-
```js
180-
_onDisableCameraButtonPress = () => {
181-
this.refs.twilioVideo
182-
.setLocalVideoEnabled(!this.state.cameraDisabled)
183-
.then(cameraDisabled => {
184-
this.setState({ cameraDisabled });
185-
});
186-
};
187-
188-
```
189-
190-
#### setLocalAudioEnabled
191-
192-
```js
193-
setLocalAudioEnabled: Function
194-
```
195-
196-
Called when a local audio is disable / enabled, how to use it below
197-
198-
```js
199-
_onMuteButtonPress = () => {
200-
this.refs.twilioVideo
201-
.setLocalAudioEnabled(!this.state.isAudioEnabled)
202-
.then(isAudioEnabled => {
203-
this.setState({ isAudioEnabled });
204-
});
205-
};
206-
207-
208-
```
209-
210-
<br><br>
211-
212-
## TwilioVideoLocalView
213-
214-
From [`../src/TwilioVideoLocalView.js`](../src/TwilioVideoLocalView.js)
215-
216-
#### enabled
217-
218-
```js
219-
// Required
220-
enabled: Boolean
221-
```
222-
223-
Indicate if video feed is enabled.
224-
225-
<br><br>
226-
227-
## TwilioVideoParticipantView
228-
229-
From [`../src/TwilioVideoParticipantView.js`](../src/TwilioVideoParticipantView.js)
230-
231-
#### trackIdentifier
232-
233-
```js
234-
trackIdentifier: {
235-
participantSid: String
236-
videoTrackSid: String
237-
}
238-
```
239-
240-
<br><br>
133+
Property | Type | Required | Default value | Description
134+
:--- | :--- | :--- | :--- | :---
135+
trackIdentifier | shape(,,) | no | | &nbsp;
136+
-----

src/TwilioVideo.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { NativeModules, NativeEventEmitter, View } from 'react-native'
1212

1313
const { TWVideoModule } = NativeModules
1414

15-
export default class extends Component {
15+
export default class TwilioVideo extends Component {
1616
static propTypes = {
1717
/**
1818
* Flag that enables screen sharing RCTRootView instead of camera capture

src/TwilioVideoLocalView.android.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@
77

88
import { requireNativeComponent, View } from 'react-native'
99
import React from 'react'
10+
import PropTypes from 'prop-types'
1011

1112
const propTypes = {
12-
...View.propTypes
13+
...View.propTypes,
14+
/**
15+
* How the video stream should be scaled to fit its
16+
* container.
17+
*/
18+
scaleType: PropTypes.oneOf(['fit', 'fill'])
1319
}
1420

1521
class TwilioVideoPreview extends React.Component {

src/TwilioVideoLocalView.ios.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ class TwilioVideoLocalView extends Component {
1515
/**
1616
* Indicate if video feed is enabled.
1717
*/
18-
enabled: PropTypes.bool.isRequired
18+
enabled: PropTypes.bool.isRequired,
19+
/**
20+
* How the video stream should be scaled to fit its
21+
* container.
22+
*/
23+
scaleType: PropTypes.oneOf(['fit', 'fill'])
1924
}
2025

2126
render () {

0 commit comments

Comments
 (0)