Skip to content

Commit 43d1247

Browse files
authored
1.0.6 - Audio fix and API update (#10)
* Initial update * Compatibility with older RN versions * That is more like it should be :o! * We will do a new example app at a later point * Oops, didn't catch that one
1 parent e5d3ca5 commit 43d1247

13 files changed

+14504
-6150
lines changed

.prettierrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
bracketSpacing: true,
3-
jsxBracketSameLine: true,
43
singleQuote: true,
54
trailingComma: 'all',
65
};

README.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Add support for `react-native-web` to a `react-native-webrtc` app.
1010

1111
## Getting Started
1212

13-
Use one of the following preferred package install methods to immediately get going.
13+
Use one of the following preferred package install methods to immediately get going.
1414

1515
**npm:** `npm install react-native-webrtc-web-shim --save`
1616
**yarn:** `yarn add react-native-webrtc-web-shim`
@@ -21,46 +21,45 @@ Use one of the following preferred package install methods to immediately get go
2121
Import directly from our library instead of `react-native-webrtc`.
2222

2323
```javascript
24-
-import { RTCPeerConnection } from 'react-native-webrtc';
25-
+import { RTCPeerConnection } from 'react-native-webrtc-web-shim';
24+
import {
25+
RTCPeerConnection,
26+
RTCIceCandidate,
27+
RTCSessionDescription,
28+
RTCRtpTransceiver,
29+
RTCRtpReceiver,
30+
RTCRtpSender,
31+
RTCErrorEvent,
32+
MediaStream,
33+
MediaStreamTrack,
34+
mediaDevices,
35+
permissions,
36+
registerGlobals,
37+
RTCView,
38+
} from 'react-native-webrtc-web-shim';
2639
```
2740

28-
#### RTCView
41+
When displaying the `RTCView` component make sure to give it the `stream` object as a prop instead of `streamURL`, you'll then be using an HTML5 video element on your Web app.
2942

30-
When displaying the `RTCView` component, pass it the `stream` object as a prop instead of `streamURL`.
31-
On Web, this component renders an HTML5 video tag.
43+
Simply change this.
3244

3345
```javascript
34-
<RTCView
35-
-streamURL={stream.toURL()}
36-
+stream={stream}
37-
/>
46+
<RTCView streamURL={stream.toURL()} />
3847
```
3948

40-
#### Track Listener
41-
42-
Add the `ontrack` listener to your `RTCPeerConnection` object, similar to the `onaddstream` listener.
49+
To be like the following.
4350

4451
```javascript
45-
// existing code, keep this for native support
46-
webRtcPeer.onaddstream = async ({ stream }) => {
47-
await addVideo( sessionId, stream );
48-
};
49-
50-
// add the ontrack listener for web support
51-
webRtcPeer.ontrack = async ({ track, streams }) => {
52-
if ( track.kind === 'video' ) {
53-
await addVideo( sessionId, streams[ 0 ] );
54-
}
55-
};
52+
<RTCView stream={stream} />
5653
```
5754

55+
You don't need `toURL` as that is handled for you.
56+
5857
## Community
5958

6059
Come join our [Discourse Community](https://react-native-webrtc.discourse.group/) if you want to discuss any React Native and WebRTC related topics.
61-
Everyone is welcome and every little helps.
60+
Everyone is welcome and every little helps.
6261

6362
## Related Projects
6463

6564
Looking for extra functionality coverage?
66-
The [react-native-webrtc](https://github.com/react-native-webrtc) organization provides a number of packages which are more than useful when developing Real Time Communication applications.
65+
The [react-native-webrtc](https://github.com/react-native-webrtc) organization provides a number of packages which are more than useful when developing Real Time Communication applications.

0 commit comments

Comments
 (0)