├── .gitignore
├── Documentation
├── AndroidInstallation.md
├── BuildingWebRTC.md
├── doc_install_xcode_add_xcodeproject.png
├── doc_install_xcode_embed_framework.png
├── doc_install_xcode_file_structure.png
├── doc_install_xcode_link_libraries.png
├── doc_install_xcode_search_path.png
├── git-lfs-installation.md
└── iOSInstallation.md
├── ISSUE_TEMPLATE.md
├── LICENSE
├── MediaDevices.js
├── MediaStream.js
├── MediaStreamError.js
├── MediaStreamErrorEvent.js
├── MediaStreamEvent.js
├── MediaStreamTrack.js
├── MediaStreamTrackEvent.js
├── MessageEvent.js
├── Permissions.js
├── README.md
├── RTCDataChannel.js
├── RTCDataChannelEvent.js
├── RTCEvent.js
├── RTCIceCandidate.js
├── RTCIceCandidateEvent.js
├── RTCPeerConnection.js
├── RTCSessionDescription.js
├── RTCUtil.js
├── RTCView.js
├── android
├── build.gradle
├── libs
│ ├── libjingle_peerconnection.so.jar
│ └── libwebrtc.jar
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── oney
│ │ └── WebRTCModule
│ │ ├── CameraEventsHandler.java
│ │ ├── DataChannelObserver.java
│ │ ├── EglUtils.java
│ │ ├── GetUserMediaImpl.java
│ │ ├── PeerConnectionObserver.java
│ │ ├── RTCVideoViewManager.java
│ │ ├── ReactBridgeUtil.java
│ │ ├── ThreadUtils.java
│ │ ├── VideoCaptureController.java
│ │ ├── VideoTrackAdapter.java
│ │ ├── WebRTCModule.java
│ │ ├── WebRTCModulePackage.java
│ │ └── WebRTCView.java
│ └── res
│ └── values
│ └── styles.xml
├── getUserMedia.js
├── index.js
├── ios
├── RCTWebRTC.xcodeproj
│ └── project.pbxproj
├── RCTWebRTC
│ ├── RCTConvert+WebRTC.h
│ ├── RCTConvert+WebRTC.m
│ ├── RTCMediaStreamTrack+React.h
│ ├── RTCMediaStreamTrack+React.m
│ ├── RTCVideoViewManager.h
│ ├── RTCVideoViewManager.m
│ ├── VideoCaptureController.h
│ ├── VideoCaptureController.m
│ ├── WebRTCModule+Permissions.m
│ ├── WebRTCModule+RTCDataChannel.h
│ ├── WebRTCModule+RTCDataChannel.m
│ ├── WebRTCModule+RTCMediaStream.m
│ ├── WebRTCModule+RTCPeerConnection.h
│ ├── WebRTCModule+RTCPeerConnection.m
│ ├── WebRTCModule+VideoTrackAdapter.h
│ ├── WebRTCModule+VideoTrackAdapter.m
│ ├── WebRTCModule.h
│ └── WebRTCModule.m
└── WebRTC.framework
│ ├── Headers
│ ├── RTCAudioSession.h
│ ├── RTCAudioSessionConfiguration.h
│ ├── RTCAudioSource.h
│ ├── RTCAudioTrack.h
│ ├── RTCCVPixelBuffer.h
│ ├── RTCCallbackLogger.h
│ ├── RTCCameraPreviewView.h
│ ├── RTCCameraVideoCapturer.h
│ ├── RTCCertificate.h
│ ├── RTCCodecSpecificInfo.h
│ ├── RTCCodecSpecificInfoH264.h
│ ├── RTCConfiguration.h
│ ├── RTCCryptoOptions.h
│ ├── RTCDataChannel.h
│ ├── RTCDataChannelConfiguration.h
│ ├── RTCDefaultVideoDecoderFactory.h
│ ├── RTCDefaultVideoEncoderFactory.h
│ ├── RTCDispatcher.h
│ ├── RTCDtmfSender.h
│ ├── RTCEAGLVideoView.h
│ ├── RTCEncodedImage.h
│ ├── RTCFieldTrials.h
│ ├── RTCFileLogger.h
│ ├── RTCFileVideoCapturer.h
│ ├── RTCH264ProfileLevelId.h
│ ├── RTCI420Buffer.h
│ ├── RTCIceCandidate.h
│ ├── RTCIceServer.h
│ ├── RTCIntervalRange.h
│ ├── RTCLegacyStatsReport.h
│ ├── RTCLogging.h
│ ├── RTCMTLVideoView.h
│ ├── RTCMacros.h
│ ├── RTCMediaConstraints.h
│ ├── RTCMediaSource.h
│ ├── RTCMediaStream.h
│ ├── RTCMediaStreamTrack.h
│ ├── RTCMetrics.h
│ ├── RTCMetricsSampleInfo.h
│ ├── RTCMutableI420Buffer.h
│ ├── RTCMutableYUVPlanarBuffer.h
│ ├── RTCNativeI420Buffer.h
│ ├── RTCNativeMutableI420Buffer.h
│ ├── RTCPeerConnection.h
│ ├── RTCPeerConnectionFactory.h
│ ├── RTCPeerConnectionFactoryOptions.h
│ ├── RTCRtcpParameters.h
│ ├── RTCRtpCodecParameters.h
│ ├── RTCRtpEncodingParameters.h
│ ├── RTCRtpFragmentationHeader.h
│ ├── RTCRtpHeaderExtension.h
│ ├── RTCRtpParameters.h
│ ├── RTCRtpReceiver.h
│ ├── RTCRtpSender.h
│ ├── RTCRtpTransceiver.h
│ ├── RTCSSLAdapter.h
│ ├── RTCSessionDescription.h
│ ├── RTCTracing.h
│ ├── RTCVideoCapturer.h
│ ├── RTCVideoCodecConstants.h
│ ├── RTCVideoCodecInfo.h
│ ├── RTCVideoDecoder.h
│ ├── RTCVideoDecoderFactory.h
│ ├── RTCVideoDecoderFactoryH264.h
│ ├── RTCVideoDecoderH264.h
│ ├── RTCVideoDecoderVP8.h
│ ├── RTCVideoDecoderVP9.h
│ ├── RTCVideoEncoder.h
│ ├── RTCVideoEncoderFactory.h
│ ├── RTCVideoEncoderFactoryH264.h
│ ├── RTCVideoEncoderH264.h
│ ├── RTCVideoEncoderQpThresholds.h
│ ├── RTCVideoEncoderSettings.h
│ ├── RTCVideoEncoderVP8.h
│ ├── RTCVideoEncoderVP9.h
│ ├── RTCVideoFrame.h
│ ├── RTCVideoFrameBuffer.h
│ ├── RTCVideoRenderer.h
│ ├── RTCVideoSource.h
│ ├── RTCVideoTrack.h
│ ├── RTCVideoViewShading.h
│ ├── RTCYUVPlanarBuffer.h
│ ├── UIDevice+RTCDevice.h
│ └── WebRTC.h
│ ├── Info.plist
│ ├── Modules
│ └── module.modulemap
│ └── WebRTC
├── package-lock.json
├── package.json
├── react-native-webrtc.podspec
└── tools
├── build-webrtc.py
├── downloadBitcode.sh
├── ios_arch.js
└── release.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependency directory
2 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3 | node_modules
4 | ios/RCTWebRTC.xcodeproj/xcuserdata
5 | ios/RCTWebRTC.xcodeproj/project.xcworkspace
6 | .DS_Store
7 | .idea
8 |
--------------------------------------------------------------------------------
/Documentation/AndroidInstallation.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | 1.) In `android/app/src/main/AndroidManifest.xml` add these permissions
4 |
5 | ```xml
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | ```
16 |
17 | 2.) In `android/settings.gradle`, includes WebRTCModule
18 | ```gradle
19 | include ':WebRTCModule', ':app'
20 | project(':WebRTCModule').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webrtc/android')
21 | ```
22 |
23 | 3.) In `android/app/build.gradle`, add WebRTCModule to dependencies
24 | ```gradle
25 | dependencies {
26 | ...
27 | compile project(':WebRTCModule')
28 | }
29 |
30 | ```
31 |
32 | 4.) In `android/app/src/main/java/com/xxx/MainApplication.java`
33 |
34 | React Native versions 0.60.0 after
35 | ```java
36 | import com.oney.WebRTCModule.WebRTCModulePackage; // <--- Add this line
37 | ...
38 | @Override
39 | protected List getPackages() {
40 | @SuppressWarnings("UnnecessaryLocalVariable")
41 | List packages = new PackageList(this).getPackages();
42 | // Packages that cannot be autolinked yet can be added manually here, for example:
43 | // packages.add(new MyReactNativePackage());
44 | packages.add(new WebRTCModulePackage()); // <-- Add this line
45 | return packages;
46 | }
47 | ```
48 | React Native versions 0.60.0 before
49 | ```java
50 | import com.oney.WebRTCModule.WebRTCModulePackage; // <--- Add this line
51 | ...
52 |
53 | @Override
54 | protected List getPackages() {
55 | return Arrays.asList(
56 | new MainReactPackage(),
57 | new WebRTCModulePackage() // <-- Add this line
58 | );
59 | }
60 | ```
61 |
62 | 5.) Enable Java 8 support in your project. You will probably need to have React Native 0.55+ for this.
63 |
64 | 5.a.) In `android/app/build.gradle` add inside `android` section:
65 | ```gradle
66 | compileOptions {
67 | sourceCompatibility JavaVersion.VERSION_1_8
68 | targetCompatibility JavaVersion.VERSION_1_8
69 | }
70 | ```
71 |
72 | 5.b.) In `android/build.gradle` replace to:
73 |
74 | ```gradle
75 | dependencies {
76 | classpath 'com.android.tools.build:gradle:3.0.1'
77 | }
78 |
79 | //...
80 |
81 | ext {
82 | //...
83 | compileSdkVersion 27
84 | buildToolsVersion '27.0.3'
85 | //...
86 | }
87 | ```
88 |
89 | 5.c.) In `android/gradle/wrapper/gradle-wrapper.properties` set `distributionUrl` variable to
90 | ```
91 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
92 | ```
93 |
94 |
95 | ## CLEAN PROCESS
96 |
97 | if you encounter any build time errors, like "linking library not found",
98 | try the cleaning steps below, and do it again carefully with every steps.
99 |
100 | 1. remove npm module: `rm -rf $YourProject/node_modules/react-native-webrtc`
101 | 2. clean npm cache: `npm cache clean`
102 | 3. clear temporary build files ( depends on your env )
103 | * ANDROID: clear intermediate files in `gradle buildDir`
104 | * iOS: in xocde project, click `Product` -> `clean`
105 | 4. `npm install react-native-webrtc`
106 |
--------------------------------------------------------------------------------
/Documentation/BuildingWebRTC.md:
--------------------------------------------------------------------------------
1 | # Building WebRTC
2 |
3 | This document shows how to prepare a WebRTC build for its inclusion in this
4 | plugin.
5 |
6 | The build will be made with the `build-webrtc.py` Python script located in the
7 | `tools/` directory.
8 |
9 | ## Preparing the build
10 |
11 | Running the script with `--setup` will download all necessary tools for building
12 | WebRTC. The script must be run with a target directory where all WebRTC source
13 | code and resulting build artifacts will be placed. A `build_webrtc` directory
14 | will be created containing it all.
15 |
16 | The setup process only needs to be carried out once.
17 |
18 | ### iOS
19 |
20 | ```
21 | python build-webrtc.py --setup --ios ~/src/
22 | ```
23 |
24 | ### Android
25 |
26 | NOTE: Make sure you have the Java JDK installed beforehand. On Debian and
27 | Ubuntu systems this can be accomplished by installing the `default-jdk-headless`
28 | package.
29 |
30 | ```
31 | python build-webrtc.py --setup --android ~/src/
32 | ```
33 |
34 | ## Selecting the branch
35 |
36 | Once the setup process has finished, the target branch must be selected, also
37 | adding any required cherry-picks. The following example shows how the M57 branch
38 | was made:
39 |
40 | ```
41 | cd ~/src/build_webrtc/webrtc/ios/src/
42 | git checkout -b build-M57 refs/remotes/branch-heads/57
43 | git cherry-pick 0e22a4cfd3790d80ad1ae699891341fe322cb418
44 | cd
45 | ```
46 |
47 | Now the code is ready for building!
48 |
49 | ## Building
50 |
51 | ### iOS
52 |
53 | ```
54 | python build-webrtc.py --build --ios ~/src/
55 | ```
56 |
57 | The build artifacts will be located in `~/src/build_webrtc/build/ios/`.
58 |
59 | ### Android
60 |
61 | **NOTE**: WebRTC for Android can only be built on Linux at the moment.
62 |
63 | ```
64 | python build-webrtc.py --build --android ~/src/
65 | ```
66 |
67 | The build artifacts will be located in `~/src/build_webrtc/build/android/`.
68 |
69 | ### Making debug builds
70 |
71 | Debug builds can be made by adding `--debug` together with `--build`. For
72 | example, to make a debug iOS build:
73 |
74 | ```
75 | python build-webrtc.py --build --ios --debug ~/src/
76 | ```
77 |
78 |
--------------------------------------------------------------------------------
/Documentation/doc_install_xcode_add_xcodeproject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/Documentation/doc_install_xcode_add_xcodeproject.png
--------------------------------------------------------------------------------
/Documentation/doc_install_xcode_embed_framework.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/Documentation/doc_install_xcode_embed_framework.png
--------------------------------------------------------------------------------
/Documentation/doc_install_xcode_file_structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/Documentation/doc_install_xcode_file_structure.png
--------------------------------------------------------------------------------
/Documentation/doc_install_xcode_link_libraries.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/Documentation/doc_install_xcode_link_libraries.png
--------------------------------------------------------------------------------
/Documentation/doc_install_xcode_search_path.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/Documentation/doc_install_xcode_search_path.png
--------------------------------------------------------------------------------
/Documentation/git-lfs-installation.md:
--------------------------------------------------------------------------------
1 | ## Git Large File Storage ( Git LFS )
2 |
3 | **NOTE: required only between 0.10.0 ~ 0.12.0**
4 |
5 | since 0.10.0, we upgrade webrtc library to branch 52 stable release, and store library on [Git Large File Storage](https://git-lfs.github.com/)
6 | you may need to install `git lfs` to automatically download library when `git clone` or `npm install`.
7 |
8 | belows are brief memo, please go to [Git LFS official website](https://git-lfs.github.com/) for details.
9 |
10 | **Linux:** download `git-lfs tar file` and execute `install.sh` inside it.
11 | **Mac:** `brew install git-lfs` or `port install git-lfs` then `git lfs install`
12 |
--------------------------------------------------------------------------------
/Documentation/iOSInstallation.md:
--------------------------------------------------------------------------------
1 | ## iOS Installation
2 |
3 | **If you used this module before, please remove `RCTWebRTC.xcodeproject`/`libjingle_peerconnection` and follow instructions below.**
4 |
5 | `npm install react-native-webrtc --save`
6 |
7 | ## Step 1. Add Files Into Project
8 |
9 | 1-1.) in Xcode: Right click `Libraries` ➜ `Add Files to [project]`
10 | 1-2.) choose `node_modules/react-native-webrtc/ios/RCTWebRTC.xcodeproj` then `Add`
11 | 1-3.) also add `node_modules/react-native-webrtc/ios/WebRTC.framework` to project root or anywhere you want:
12 |
13 | 
14 |
15 | 1-4.) you will ended up with structure like:
16 |
17 | 
18 |
19 | ## iOS Podfile
20 |
21 | You can use the included podspec in your podfile to take care of all dependencies instead of manually adding files to the project (instead of steps 2 through 4, but you might still have to do Appendix A/B ).
22 |
23 | Include in a Podfile in your react-native ios directory:
24 |
25 | ```
26 | pod 'react-native-webrtc', :path => '../node_modules/react-native-webrtc'
27 | ```
28 |
29 | You may have to change the `platform` field in your Podfile, as `react-native-webrtc` doesn't support iOS 9 - set it to '10.0' or above (otherwise you get an error when doing `pod install`):
30 |
31 | ```
32 | platform :ios, '10.0'
33 | ```
34 |
35 | ## Step 2. Add Library Search Path
36 |
37 | 2-1.) select `Build Settings`, find `Search Paths`
38 | 2-2.) edit BOTH `Framework Search Paths` and `Library Search Paths`
39 | 2-3.) add path on BOTH sections with: `$(SRCROOT)/../node_modules/react-native-webrtc/ios` with `recursive`
40 |
41 | 
42 |
43 | ## Step 3. Change General Setting and Embed Framework
44 |
45 | 3-1.) go to `General` tab
46 | 3-2.) change `Deployment Target` to `8.0`
47 | 3-3.) add `Embedded Binaries` like below:
48 |
49 | 
50 |
51 |
52 | ## Step 4. Link/Include Necessary Libraries
53 |
54 |
55 | 4-1.) click `Build Phases` tab, open `Link Binary With Libraries`
56 | 4-2.) add `libRCTWebRTC.a`
57 | 4-3.) make sure WebRTC.framework linked
58 | 4-4.) add the following libraries:
59 |
60 | ```
61 | AVFoundation.framework
62 | AudioToolbox.framework
63 | CoreGraphics.framework
64 | GLKit.framework
65 | CoreAudio.framework
66 | CoreVideo.framework
67 | VideoToolbox.framework
68 | libc.tbd
69 | libc++.tbd
70 | libsqlite3.tbd
71 | ```
72 | 
73 | 4-5.) Under `Build setting` set `Dead Code Stripping` to `No` also under `Build Options` set `Enable Bitcode` to `No` as well
74 |
75 |
76 |
77 | ## Step 5. Add Permissions
78 |
79 | 5-1.) navigate to `/ios//`
80 | 5-2.) edit `Info.plist` and add the following lines
81 |
82 | ```
83 | NSCameraUsageDescription
84 | Camera Permission
85 | NSMicrophoneUsageDescription
86 | Microphone Permission
87 | ```
88 |
89 | ## Appendix A - CLEAN PROCESS
90 |
91 | if you encounter any build time errors, like "linking library not found",
92 | try the cleaning steps below, and do it again carefully with every steps.
93 |
94 | 1. remove npm module: `rm -rf $YourProject/node_modules/react-native-webrtc`
95 | 2. clean npm cache: `npm cache clean`
96 | 3. clear temporary build files ( depends on your env )
97 | * ANDROID: clear intermediate files in `gradle buildDir`
98 | * iOS: in xocde project, click `Product` -> `clean`
99 | 4. `npm install react-native-webrtc`
100 |
101 | ## Appendix B - Apple Store Submission
102 |
103 | (ios only)
104 |
105 | You should strip simulator (i386/x86_64) archs from WebRTC binary before submit to Apple Store.
106 | We provide a handy script to do it easily. see below sections.
107 |
108 | credit: The script is originally provided by [@besarthoxhaj](https://github.com/besarthoxhaj) in [#141](https://github.com/react-native-webrtc/react-native-webrtc/issues/141), thanks!
109 |
110 | #### Strip Simulator Archs Usage
111 |
112 | The script and example are here: https://github.com/react-native-webrtc/react-native-webrtc/blob/master/tools/ios_arch.js
113 |
114 | 1. go to `react-native-webrtc/tools` folder
115 | 2. extract all archs first: `node ios_arch.js --extract`
116 | 3. re-package device related archs only: `node ios_arch.js --device`
117 | 4. delete files generated from `step 2` under `node_modules/react-native-webrtc/ios WebRTC.framework/` (e.g. with a command `rm node_modules/react-native-webrtc/ios/WebRTC.framework/WebRTC-*` from application root)
118 | 5. you can check current arch use this command: `file node_modules/react-native-webrtc/ios/WebRTC.framework/WebRTC`
119 |
--------------------------------------------------------------------------------
/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
9 |
10 | #### Expected behavior
11 |
12 | #### Observerd behavior
13 |
14 | #### Steps to reproduce the problem
15 |
16 | #### Platform information
17 |
18 | * **React Native version**:
19 | * **Plugin version**:
20 | * **OS**:
21 | * **OS version**:
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Howard Yang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MediaDevices.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {NativeModules} from 'react-native';
4 | import EventTarget from 'event-target-shim';
5 |
6 | import getUserMedia from './getUserMedia';
7 |
8 | const {WebRTCModule} = NativeModules;
9 |
10 | const MEDIA_DEVICES_EVENTS = [
11 | 'devicechange'
12 | ];
13 |
14 | class MediaDevices extends EventTarget(MEDIA_DEVICES_EVENTS) {
15 | // TODO: implement.
16 | ondevicechange: ?Function;
17 |
18 | /**
19 | * W3C "Media Capture and Streams" compatible {@code enumerateDevices}
20 | * implementation.
21 | */
22 | enumerateDevices() {
23 | return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));
24 | }
25 |
26 | /**
27 | * W3C "Media Capture and Streams" compatible {@code getUserMedia}
28 | * implementation.
29 | * See: https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-enumeratedevices
30 | *
31 | * @param {*} constraints
32 | * @returns {Promise}
33 | */
34 | getUserMedia(constraints) {
35 | return getUserMedia(constraints);
36 | }
37 | }
38 |
39 | export default new MediaDevices();
40 |
--------------------------------------------------------------------------------
/MediaStream.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {NativeModules} from 'react-native';
4 | import EventTarget from 'event-target-shim';
5 | import uuid from 'uuid';
6 |
7 | import MediaStreamTrack from './MediaStreamTrack';
8 |
9 | const {WebRTCModule} = NativeModules;
10 |
11 | const MEDIA_STREAM_EVENTS = [
12 | 'active',
13 | 'inactive',
14 | 'addtrack',
15 | 'removetrack',
16 | ];
17 |
18 | export default class MediaStream extends EventTarget(MEDIA_STREAM_EVENTS) {
19 | id: string;
20 | active: boolean = true;
21 |
22 | onactive: ?Function;
23 | oninactive: ?Function;
24 | onaddtrack: ?Function;
25 | onremovetrack: ?Function;
26 |
27 | _tracks: Array = [];
28 |
29 | /**
30 | * The identifier of this MediaStream unique within the associated
31 | * WebRTCModule instance. As the id of a remote MediaStream instance is unique
32 | * only within the associated RTCPeerConnection, it is not sufficiently unique
33 | * to identify this MediaStream across multiple RTCPeerConnections and to
34 | * unambiguously differentiate it from a local MediaStream instance not added
35 | * to an RTCPeerConnection.
36 | */
37 | _reactTag: string;
38 |
39 | /**
40 | * A MediaStream can be constructed in several ways, depending on the paramters
41 | * that are passed here.
42 | *
43 | * - undefined: just a new stream, with no tracks.
44 | * - MediaStream instance: a new stream, with a copy of the tracks of the passed stream.
45 | * - Array of MediaStreamTrack: a new stream with a copy of the tracks in the array.
46 | * - object: a new stream instance, represented by the passed info object, this is always
47 | * done internally, when the stream is first created in native and the JS wrapper is
48 | * built afterwards.
49 | */
50 | constructor(arg) {
51 | super();
52 |
53 | // Assigm a UUID to start with. It may get overridden for remote streams.
54 | this.id = uuid.v4();
55 | // Local MediaStreams are created by WebRTCModule to have their id and
56 | // reactTag equal because WebRTCModule follows the respective standard's
57 | // recommendation for id generation i.e. uses UUID which is unique enough
58 | // for the purposes of reactTag.
59 | this._reactTag = this.id;
60 |
61 | if (typeof arg === 'undefined') {
62 | WebRTCModule.mediaStreamCreate(this.id);
63 | } else if (arg instanceof MediaStream) {
64 | WebRTCModule.mediaStreamCreate(this.id);
65 | for (const track of arg.getTracks()) {
66 | this.addTrack(track);
67 | }
68 | } else if (Array.isArray(arg)) {
69 | WebRTCModule.mediaStreamCreate(this.id);
70 | for (const track of arg) {
71 | this.addTrack(track);
72 | }
73 | } else if (typeof arg === 'object' && arg.streamId && arg.streamReactTag && arg.tracks) {
74 | this.id = arg.streamId;
75 | this._reactTag = arg.streamReactTag;
76 | for (const trackInfo of arg.tracks) {
77 | // We are not using addTrack here because the track is already part of the
78 | // stream, so there is no need to add it on the native side.
79 | this._tracks.push(new MediaStreamTrack(trackInfo));
80 | }
81 | } else {
82 | throw new TypeError(`invalid type: ${typeof arg}`);
83 | }
84 | }
85 |
86 | addTrack(track: MediaStreamTrack) {
87 | const index = this._tracks.indexOf(track);
88 | if (index !== -1) {
89 | return;
90 | }
91 | this._tracks.push(track);
92 | WebRTCModule.mediaStreamAddTrack(this._reactTag, track.id);
93 | }
94 |
95 | removeTrack(track: MediaStreamTrack) {
96 | const index = this._tracks.indexOf(track);
97 | if (index === -1) {
98 | return;
99 | }
100 | this._tracks.splice(index, 1);
101 | WebRTCModule.mediaStreamRemoveTrack(this._reactTag, track.id);
102 | }
103 |
104 | getTracks(): Array {
105 | return this._tracks.slice();
106 | }
107 |
108 | getTrackById(trackId): ?MediaStreamTrack {
109 | return this._tracks.find(track => track.id === trackId);
110 | }
111 |
112 | getAudioTracks(): Array {
113 | return this._tracks.filter(track => track.kind === 'audio');
114 | }
115 |
116 | getVideoTracks(): Array {
117 | return this._tracks.filter(track => track.kind === 'video');
118 | }
119 |
120 | clone() {
121 | throw new Error('Not implemented.');
122 | }
123 |
124 | toURL() {
125 | return this._reactTag;
126 | }
127 |
128 | release() {
129 | WebRTCModule.mediaStreamRelease(this._reactTag);
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/MediaStreamError.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export default class MediaStreamError {
4 |
5 | name: string;
6 | message: ?string;
7 | constraintName: ?string;
8 |
9 | constructor(error) {
10 | this.name = error.name;
11 | this.message = error.message;
12 | this.constraintName = error.constraintName;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MediaStreamErrorEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import type MediaStreamError from './MediaStreamError';
4 |
5 | export default class MediaStreamErrorEvent {
6 | type: string;
7 | error: ?MediaStreamError;
8 | constructor(type, eventInitDict) {
9 | this.type = type.toString();
10 | Object.assign(this, eventInitDict);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MediaStreamEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import type MediaStream from './MediaStream';
4 |
5 | export default class MediaStreamEvent {
6 | type: string;
7 | stream: MediaStream;
8 | constructor(type, eventInitDict) {
9 | this.type = type.toString();
10 | Object.assign(this, eventInitDict);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MediaStreamTrack.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {NativeModules} from 'react-native';
4 | import EventTarget from 'event-target-shim';
5 | import MediaStreamErrorEvent from './MediaStreamErrorEvent';
6 |
7 | import type MediaStreamError from './MediaStreamError';
8 |
9 | const {WebRTCModule} = NativeModules;
10 |
11 | const MEDIA_STREAM_TRACK_EVENTS = [
12 | 'ended',
13 | 'mute',
14 | 'unmute',
15 | // see: https://www.w3.org/TR/mediacapture-streams/#constrainable-interface
16 | 'overconstrained',
17 | ];
18 |
19 | type MediaStreamTrackState = "live" | "ended";
20 |
21 | type SourceInfo = {
22 | id: string;
23 | label: string;
24 | facing: string;
25 | kind: string;
26 | };
27 |
28 | class MediaStreamTrack extends EventTarget(MEDIA_STREAM_TRACK_EVENTS) {
29 | _enabled: boolean;
30 | id: string;
31 | kind: string;
32 | label: string;
33 | muted: boolean;
34 | readonly: boolean; // how to decide?
35 | // readyState in java: INITIALIZING, LIVE, ENDED, FAILED
36 | readyState: MediaStreamTrackState;
37 | remote: boolean;
38 |
39 | onended: ?Function;
40 | onmute: ?Function;
41 | onunmute: ?Function;
42 | overconstrained: ?Function;
43 |
44 | constructor(info) {
45 | super();
46 |
47 | let _readyState = info.readyState.toLowerCase();
48 | this._enabled = info.enabled;
49 | this.id = info.id;
50 | this.kind = info.kind;
51 | this.label = info.label;
52 | this.muted = false;
53 | this.readonly = true; // how to decide?
54 | this.remote = info.remote;
55 | this.readyState = (_readyState === "initializing"
56 | || _readyState === "live") ? "live" : "ended";
57 | }
58 |
59 | get enabled(): boolean {
60 | return this._enabled;
61 | }
62 |
63 | set enabled(enabled: boolean): void {
64 | if (enabled === this._enabled) {
65 | return;
66 | }
67 | WebRTCModule.mediaStreamTrackSetEnabled(this.id, !this._enabled);
68 | this._enabled = !this._enabled;
69 | this.muted = !this._enabled;
70 | }
71 |
72 | stop() {
73 | WebRTCModule.mediaStreamTrackSetEnabled(this.id, false);
74 | this.readyState = 'ended';
75 | // TODO: save some stopped flag?
76 | }
77 |
78 | /**
79 | * Private / custom API for switching the cameras on the fly, without the
80 | * need for adding / removing tracks or doing any SDP renegotiation.
81 | *
82 | * This is how the reference application (AppRTCMobile) implements camera
83 | * switching.
84 | */
85 | _switchCamera() {
86 | if (this.remote) {
87 | throw new Error('Not implemented for remote tracks');
88 | }
89 | if (this.kind !== 'video') {
90 | throw new Error('Only implemented for video tracks');
91 | }
92 | WebRTCModule.mediaStreamTrackSwitchCamera(this.id);
93 | }
94 |
95 | applyConstraints() {
96 | throw new Error('Not implemented.');
97 | }
98 |
99 | clone() {
100 | throw new Error('Not implemented.');
101 | }
102 |
103 | getCapabilities() {
104 | throw new Error('Not implemented.');
105 | }
106 |
107 | getConstraints() {
108 | throw new Error('Not implemented.');
109 | }
110 |
111 | getSettings() {
112 | throw new Error('Not implemented.');
113 | }
114 |
115 | release() {
116 | WebRTCModule.mediaStreamTrackRelease(this.id);
117 | }
118 | }
119 |
120 | export default MediaStreamTrack;
121 |
--------------------------------------------------------------------------------
/MediaStreamTrackEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import type MediaStreamTrack from './MediaStreamTrack';
4 |
5 | export default class MediaStreamTrackEvent {
6 | type: string;
7 | track: MediaStreamTrack;
8 | constructor(type, eventInitDict) {
9 | this.type = type.toString();
10 | Object.assign(this, eventInitDict);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/MessageEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export default class MessageEvent {
4 | type: string;
5 | data: string | ArrayBuffer | Blob;
6 | origin: string;
7 | constructor(type, eventInitDict) {
8 | this.type = type.toString();
9 | Object.assign(this, eventInitDict);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Permissions.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import { NativeModules, PermissionsAndroid, Platform } from 'react-native';
4 |
5 | const { WebRTCModule } = NativeModules;
6 |
7 | /**
8 | * Type declaration for a permissions descriptor.
9 | */
10 | type PermissionDescriptor = {
11 | name: string;
12 | }
13 |
14 | /**
15 | * Class implementing a subset of W3C's Permissions API as defined by:
16 | * https://www.w3.org/TR/permissions/
17 | */
18 | class Permissions {
19 | /**
20 | * Possible result values for {@link query}, in accordance with:
21 | * https://www.w3.org/TR/permissions/#status-of-a-permission
22 | */
23 | RESULT = {
24 | DENIED: 'denied',
25 | GRANTED: 'granted',
26 | PROMPT: 'prompt'
27 | };
28 |
29 | /**
30 | * This implementation only supports requesting these permissions, a subset
31 | * of: https://www.w3.org/TR/permissions/#permission-registry
32 | */
33 | VALID_PERMISSIONS = [ 'camera', 'microphone' ];
34 |
35 | _lastReq = Promise.resolve();
36 |
37 | /**
38 | * Helper for requesting Android permissions. On Android only one permission
39 | * can be requested at a time (unless the multi-permission API is used,
40 | * but we are not using that for symmetry with the W3C API for querying)
41 | * so we'll queue them up.
42 | *
43 | * @param {string} perm - The requested permission from
44 | * {@link PermissionsAndroid.PERMISSIONS}
45 | * https://facebook.github.io/react-native/docs/permissionsandroid#permissions-that-require-prompting-the-user
46 | */
47 | _requestPermissionAndroid(perm) {
48 | return new Promise((resolve, reject) => {
49 | PermissionsAndroid.request(perm).then(
50 | granted => resolve(granted === true || granted === PermissionsAndroid.RESULTS.GRANTED),
51 | () => resolve(false));
52 | });
53 | }
54 |
55 | /**
56 | * Validates the given permission descriptor.
57 | */
58 | _validatePermissionDescriptior(permissionDesc) {
59 | if (typeof permissionDesc !== "object") {
60 | throw new TypeError("Argument 1 of Permissions.query is not an object.");
61 | }
62 | if (typeof permissionDesc.name === "undefined") {
63 | throw new TypeError("Missing required 'name' member of PermissionDescriptor.");
64 | }
65 | if (this.VALID_PERMISSIONS.indexOf(permissionDesc.name) === -1) {
66 | throw new TypeError("'name' member of PermissionDescriptor is not a valid value for enumeration PermissionName.");
67 | }
68 | }
69 |
70 | /**
71 | * Method for querying the status of a permission, according to:
72 | * https://www.w3.org/TR/permissions/#permissions-interface
73 | */
74 | query(permissionDesc: PermissionDescriptor) {
75 | try {
76 | this._validatePermissionDescriptior(permissionDesc);
77 | } catch (e) {
78 | return Promise.reject(e);
79 | }
80 | if (Platform.OS === 'android') {
81 | const perm = permissionDesc.name === 'camera'
82 | ? PermissionsAndroid.PERMISSIONS.CAMERA
83 | : PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
84 | return new Promise((resolve, reject) => {
85 | PermissionsAndroid.check(perm).then(
86 | granted => resolve(granted ? this.RESULT.GRANTED : this.RESULT.PROMPT),
87 | () => resolve(this.RESULT.PROMPT));
88 | });
89 | } else if (Platform.OS === 'ios') {
90 | return WebRTCModule.checkPermission(permissionDesc.name);
91 | } else {
92 | return Promise.reject(new TypeError("Unsupported platform."));
93 | }
94 | }
95 |
96 | /**
97 | * Custom method NOT defined by W3C's permissions API, which allows the
98 | * caller to request a permission.
99 | */
100 | request(permissionDesc: PermissionDescriptor) {
101 | try {
102 | this._validatePermissionDescriptior(permissionDesc);
103 | } catch (e) {
104 | return Promise.reject(e);
105 | }
106 | if (Platform.OS === 'android') {
107 | const perm = permissionDesc.name === 'camera'
108 | ? PermissionsAndroid.PERMISSIONS.CAMERA
109 | : PermissionsAndroid.PERMISSIONS.RECORD_AUDIO;
110 | const requestPermission
111 | = () => this._requestPermissionAndroid(perm);
112 | this._lastReq
113 | = this._lastReq.then(requestPermission, requestPermission);
114 | return this._lastReq;
115 | } else if (Platform.OS === 'ios') {
116 | return WebRTCModule.requestPermission(permissionDesc.name);
117 | } else {
118 | return Promise.reject(new TypeError("Unsupported platform."));
119 | }
120 | }
121 | }
122 |
123 | export default new Permissions();
124 |
--------------------------------------------------------------------------------
/RTCDataChannel.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {NativeModules, DeviceEventEmitter} from 'react-native';
4 | import base64 from 'base64-js';
5 | import EventTarget from 'event-target-shim';
6 | import MessageEvent from './MessageEvent';
7 | import RTCDataChannelEvent from './RTCDataChannelEvent';
8 |
9 | const {WebRTCModule} = NativeModules;
10 |
11 | type RTCDataChannelInit = {
12 | ordered?: boolean;
13 | maxPacketLifeTime?: number;
14 | maxRetransmits?: number;
15 | protocol?: string;
16 | negotiated?: boolean;
17 | id?: number;
18 | // deprecated:
19 | maxRetransmitTime?: number,
20 | };
21 |
22 | type RTCDataChannelState =
23 | 'connecting' |
24 | 'open' |
25 | 'closing' |
26 | 'closed';
27 |
28 | const DATA_CHANNEL_EVENTS = [
29 | 'open',
30 | 'message',
31 | 'bufferedamountlow',
32 | 'close',
33 | 'error',
34 | ];
35 |
36 | class ResourceInUse extends Error {}
37 |
38 | export default class RTCDataChannel extends EventTarget(DATA_CHANNEL_EVENTS) {
39 |
40 | _peerConnectionId: number;
41 |
42 | binaryType: 'arraybuffer' = 'arraybuffer'; // we only support 'arraybuffer'
43 | bufferedAmount: number = 0;
44 | bufferedAmountLowThreshold: number = 0;
45 | id: number;
46 | label: string;
47 | maxPacketLifeTime: ?number = null;
48 | maxRetransmits: ?number = null;
49 | negotiated: boolean = false;
50 | ordered: boolean = true;
51 | protocol: string = '';
52 | readyState: RTCDataChannelState = 'connecting';
53 |
54 | onopen: ?Function;
55 | onmessage: ?Function;
56 | onbufferedamountlow: ?Function;
57 | onerror: ?Function;
58 | onclose: ?Function;
59 |
60 | constructor(
61 | peerConnectionId: number,
62 | label: string,
63 | dataChannelDict: RTCDataChannelInit) {
64 | super();
65 |
66 | this._peerConnectionId = peerConnectionId;
67 |
68 | this.label = label;
69 |
70 | // The standard defines dataChannelDict as optional for
71 | // RTCPeerConnection#createDataChannel and that is how we have implemented
72 | // the method in question. However, the method will (1) allocate an
73 | // RTCDataChannel.id if the caller has not specified a value and (2)
74 | // pass it to RTCDataChannel's constructor via dataChannelDict.
75 | // Consequently, dataChannelDict is not optional for RTCDataChannel's
76 | // constructor.
77 | this.id = ('id' in dataChannelDict) ? dataChannelDict.id : -1;
78 | this.ordered = !!dataChannelDict.ordered;
79 | this.maxPacketLifeTime = dataChannelDict.maxPacketLifeTime;
80 | this.maxRetransmits = dataChannelDict.maxRetransmits;
81 | this.protocol = dataChannelDict.protocol || '';
82 | this.negotiated = !!dataChannelDict.negotiated;
83 |
84 | this._registerEvents();
85 | }
86 |
87 | send(data: string | ArrayBuffer | ArrayBufferView) {
88 | if (typeof data === 'string') {
89 | WebRTCModule.dataChannelSend(this._peerConnectionId, this.id, data, 'text');
90 | return;
91 | }
92 |
93 | // Safely convert the buffer object to an Uint8Array for base64-encoding
94 | if (ArrayBuffer.isView(data)) {
95 | data = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
96 | } else if (data instanceof ArrayBuffer) {
97 | data = new Uint8Array(data);
98 | } else {
99 | throw new TypeError('Data must be either string, ArrayBuffer, or ArrayBufferView');
100 | }
101 | WebRTCModule.dataChannelSend(this._peerConnectionId, this.id, base64.fromByteArray(data), 'binary');
102 | }
103 |
104 | close() {
105 | if (this.readyState === 'closing' || this.readyState === 'closed') {
106 | return;
107 | }
108 | this.readyState = 'closing';
109 | WebRTCModule.dataChannelClose(this._peerConnectionId, this.id);
110 | }
111 |
112 | _unregisterEvents() {
113 | this._subscriptions.forEach(e => e.remove());
114 | this._subscriptions = [];
115 | }
116 |
117 | _registerEvents() {
118 | this._subscriptions = [
119 | DeviceEventEmitter.addListener('dataChannelStateChanged', ev => {
120 | if (ev.peerConnectionId !== this._peerConnectionId
121 | || ev.id !== this.id) {
122 | return;
123 | }
124 | this.readyState = ev.state;
125 | if (this.readyState === 'open') {
126 | this.dispatchEvent(new RTCDataChannelEvent('open', {channel: this}));
127 | } else if (this.readyState === 'close') {
128 | this.dispatchEvent(new RTCDataChannelEvent('close', {channel: this}));
129 | this._unregisterEvents();
130 | }
131 | }),
132 | DeviceEventEmitter.addListener('dataChannelReceiveMessage', ev => {
133 | if (ev.peerConnectionId !== this._peerConnectionId
134 | || ev.id !== this.id) {
135 | return;
136 | }
137 | let data = ev.data;
138 | if (ev.type === 'binary') {
139 | data = base64.toByteArray(ev.data).buffer;
140 | }
141 | this.dispatchEvent(new MessageEvent('message', {data}));
142 | }),
143 | ];
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/RTCDataChannelEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import type RTCDataChannel from './RTCDataChannel';
4 |
5 | export default class RTCDataChannelEvent {
6 | type: string;
7 | channel: RTCDataChannel;
8 | constructor(type, eventInitDict) {
9 | this.type = type.toString();
10 | Object.assign(this, eventInitDict);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/RTCEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export default class RTCEvent {
4 | type: string;
5 | constructor(type, eventInitDict) {
6 | this.type = type.toString();
7 | Object.assign(this, eventInitDict);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/RTCIceCandidate.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export default class RTCIceCandidate {
4 | candidate: string;
5 | sdpMLineIndex: number;
6 | sdpMid: string;
7 |
8 | constructor(info) {
9 | this.candidate = info.candidate;
10 | this.sdpMLineIndex = info.sdpMLineIndex;
11 | this.sdpMid = info.sdpMid;
12 | }
13 |
14 | toJSON() {
15 | return {
16 | candidate: this.candidate,
17 | sdpMLineIndex: this.sdpMLineIndex,
18 | sdpMid: this.sdpMid,
19 | };
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/RTCIceCandidateEvent.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import type RTCIceCandidate from './RTCIceCandidate';
4 |
5 | export default class RTCIceCandidateEvent {
6 | type: string;
7 | candidate: RTCIceCandidate;
8 | constructor(type, eventInitDict) {
9 | this.type = type.toString();
10 |
11 | this.candidate = null;
12 | if (eventInitDict && eventInitDict.candidate) {
13 | this.candidate = eventInitDict.candidate;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/RTCSessionDescription.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export default class RTCSessionDescription {
4 | sdp: string;
5 | type: string;
6 |
7 | constructor(info) {
8 | this.sdp = info.sdp;
9 | this.type = info.type;
10 | }
11 | toJSON() {
12 | return {sdp: this.sdp, type: this.type};
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/RTCView.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {
4 | DeviceEventEmitter,
5 | NativeModules,
6 | requireNativeComponent,
7 | } from 'react-native';
8 | import PropTypes from 'prop-types';
9 |
10 | const {WebRTCModule} = NativeModules;
11 |
12 | const RTCView = {
13 | name: 'RTCVideoView',
14 | propTypes: {
15 |
16 | /**
17 | * Indicates whether the video specified by {@link #streamURL} should be
18 | * mirrored during rendering. Commonly, applications choose to mirror the
19 | * user-facing camera.
20 | */
21 | mirror: PropTypes.bool,
22 |
23 | /**
24 | * In the fashion of
25 | * https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
26 | * and https://www.w3.org/TR/html5/rendering.html#video-object-fit,
27 | * resembles the CSS style object-fit.
28 | */
29 | objectFit: PropTypes.oneOf(['contain', 'cover']),
30 |
31 | streamURL: PropTypes.string,
32 |
33 | /**
34 | * Similarly to the CSS property z-index, specifies the z-order of this
35 | * RTCView in the stacking space of all RTCViews. When RTCViews overlap,
36 | * zOrder determines which one covers the other. An RTCView with a larger
37 | * zOrder generally covers an RTCView with a lower one.
38 | *
39 | * Non-overlapping RTCViews may safely share a z-order (because one does not
40 | * have to cover the other).
41 | *
42 | * The support for zOrder is platform-dependent and/or
43 | * implementation-specific. Thus, specifying a value for zOrder is to be
44 | * thought of as giving a hint rather than as imposing a requirement. For
45 | * example, video renderers such as RTCView are commonly implemented using
46 | * OpenGL and OpenGL views may have different numbers of layers in their
47 | * stacking space. Android has three: a layer bellow the window (aka
48 | * default), a layer bellow the window again but above the previous layer
49 | * (aka media overlay), and above the window. Consequently, it is advisable
50 | * to limit the number of utilized layers in the stacking space to the
51 | * minimum sufficient for the desired display. For example, a video call
52 | * application usually needs a maximum of two zOrder values: 0 for the
53 | * remote video(s) which appear in the background, and 1 for the local
54 | * video(s) which appear above the remote video(s).
55 | */
56 | zOrder: PropTypes.number
57 | },
58 | };
59 |
60 | const View = requireNativeComponent('RTCVideoView', RTCView, {nativeOnly: {
61 | testID: true,
62 | accessibilityComponentType: true,
63 | renderToHardwareTextureAndroid: true,
64 | accessibilityLabel: true,
65 | accessibilityLiveRegion: true,
66 | importantForAccessibility: true,
67 | onLayout: true,
68 | nativeID: true,
69 | }});
70 |
71 | export default View;
72 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | def safeExtGet(prop, fallback) {
4 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5 | }
6 |
7 | android {
8 | compileSdkVersion safeExtGet('compileSdkVersion', 23)
9 | buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
10 |
11 | defaultConfig {
12 | minSdkVersion safeExtGet('minSdkVersion', 16)
13 | targetSdkVersion safeExtGet('targetSdkVersion', 22)
14 | versionCode 1
15 | versionName "1.0"
16 | ndk {
17 | abiFilters "armeabi-v7a", "x86"
18 | }
19 | }
20 |
21 | // WebRTC requires Java 8 features
22 | // https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/discuss-webrtc/V1h2uQMDCkA/RA-uzncVAAAJ
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation 'com.facebook.react:react-native:+'
31 | api fileTree(dir: 'libs', include: ['*.jar'])
32 | }
33 |
--------------------------------------------------------------------------------
/android/libs/libjingle_peerconnection.so.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/android/libs/libjingle_peerconnection.so.jar
--------------------------------------------------------------------------------
/android/libs/libwebrtc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jitsi/react-native-webrtc/047b019a7ce1ec93ab4a2f6796e997d7a02e8e5d/android/libs/libwebrtc.jar
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/CameraEventsHandler.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import android.util.Log;
4 |
5 | import org.webrtc.CameraVideoCapturer;
6 |
7 | class CameraEventsHandler implements CameraVideoCapturer.CameraEventsHandler {
8 | /**
9 | * The {@link Log} tag with which {@code CameraEventsHandler} is to log.
10 | */
11 | private final static String TAG = WebRTCModule.TAG;
12 |
13 | // Callback invoked when camera closed.
14 | @Override
15 | public void onCameraClosed() {
16 | Log.d(TAG, "CameraEventsHandler.onFirstFrameAvailable");
17 | }
18 |
19 | // Called when camera is disconnected.
20 | @Override
21 | public void onCameraDisconnected() {
22 | Log.d(TAG, "CameraEventsHandler.onCameraDisconnected");
23 | }
24 |
25 | // Camera error handler - invoked when camera can not be opened or any
26 | // camera exception happens on camera thread.
27 | @Override
28 | public void onCameraError(String errorDescription) {
29 | Log.d(
30 | TAG,
31 | "CameraEventsHandler.onCameraError: errorDescription="
32 | + errorDescription);
33 | }
34 |
35 | // Invoked when camera stops receiving frames
36 | @Override
37 | public void onCameraFreezed(String errorDescription) {
38 | Log.d(
39 | TAG,
40 | "CameraEventsHandler.onCameraFreezed: errorDescription="
41 | + errorDescription);
42 | }
43 |
44 | // Callback invoked when camera is opening.
45 | @Override
46 | public void onCameraOpening(String cameraName) {
47 | Log.d(
48 | TAG,
49 | "CameraEventsHandler.onCameraOpening: cameraName="
50 | + cameraName);
51 | }
52 |
53 | // Callback invoked when first camera frame is available after camera is opened.
54 | @Override
55 | public void onFirstFrameAvailable() {
56 | Log.d(TAG, "CameraEventsHandler.onFirstFrameAvailable");
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/DataChannelObserver.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import java.nio.charset.Charset;
4 |
5 | import android.support.annotation.Nullable;
6 | import android.util.Base64;
7 |
8 | import com.facebook.react.bridge.Arguments;
9 | import com.facebook.react.bridge.WritableMap;
10 |
11 | import org.webrtc.DataChannel;
12 |
13 | class DataChannelObserver implements DataChannel.Observer {
14 |
15 | private final int mId;
16 | private final DataChannel mDataChannel;
17 | private final int peerConnectionId;
18 | private final WebRTCModule webRTCModule;
19 |
20 | DataChannelObserver(
21 | WebRTCModule webRTCModule,
22 | int peerConnectionId,
23 | int id,
24 | DataChannel dataChannel) {
25 | this.webRTCModule = webRTCModule;
26 | this.peerConnectionId = peerConnectionId;
27 | mId = id;
28 | mDataChannel = dataChannel;
29 | }
30 |
31 | @Nullable
32 | private String dataChannelStateString(DataChannel.State dataChannelState) {
33 | switch (dataChannelState) {
34 | case CONNECTING:
35 | return "connecting";
36 | case OPEN:
37 | return "open";
38 | case CLOSING:
39 | return "closing";
40 | case CLOSED:
41 | return "closed";
42 | }
43 | return null;
44 | }
45 |
46 | @Override
47 | public void onBufferedAmountChange(long amount) {
48 | }
49 |
50 | @Override
51 | public void onMessage(DataChannel.Buffer buffer) {
52 | WritableMap params = Arguments.createMap();
53 | params.putInt("id", mId);
54 | params.putInt("peerConnectionId", peerConnectionId);
55 |
56 | byte[] bytes;
57 | if (buffer.data.hasArray()) {
58 | bytes = buffer.data.array();
59 | } else {
60 | bytes = new byte[buffer.data.remaining()];
61 | buffer.data.get(bytes);
62 | }
63 |
64 | String type;
65 | String data;
66 | if (buffer.binary) {
67 | type = "binary";
68 | data = Base64.encodeToString(bytes, Base64.NO_WRAP);
69 | } else {
70 | type = "text";
71 | data = new String(bytes, Charset.forName("UTF-8"));
72 | }
73 | params.putString("type", type);
74 | params.putString("data", data);
75 |
76 | webRTCModule.sendEvent("dataChannelReceiveMessage", params);
77 | }
78 |
79 | @Override
80 | public void onStateChange() {
81 | WritableMap params = Arguments.createMap();
82 | params.putInt("id", mId);
83 | params.putInt("peerConnectionId", peerConnectionId);
84 | params.putString("state", dataChannelStateString(mDataChannel.state()));
85 | webRTCModule.sendEvent("dataChannelStateChanged", params);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/EglUtils.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import android.util.Log;
4 | import android.os.Build.VERSION;
5 |
6 | import org.webrtc.EglBase;
7 |
8 | public class EglUtils {
9 | /**
10 | * The root {@link EglBase} instance shared by the entire application for
11 | * the sake of reducing the utilization of system resources (such as EGL
12 | * contexts). It selects between {@link EglBase10} and {@link EglBase14}
13 | * by performing a runtime check.
14 | */
15 | private static EglBase rootEglBase;
16 |
17 | /**
18 | * Lazily creates and returns the one and only {@link EglBase} which will
19 | * serve as the root for all contexts that are needed.
20 | */
21 | public static synchronized EglBase getRootEglBase() {
22 | if (rootEglBase == null) {
23 | // XXX EglBase14 will report that isEGL14Supported() but its
24 | // getEglConfig() will fail with a RuntimeException with message
25 | // "Unable to find any matching EGL config". Fall back to EglBase10
26 | // in the described scenario.
27 | EglBase eglBase = null;
28 | int[] configAttributes = EglBase.CONFIG_PLAIN;
29 | RuntimeException cause = null;
30 |
31 | try {
32 | // WebRTC internally does this check in isEGL14Supported, but it's no longer exposed
33 | // in the public API
34 | if (VERSION.SDK_INT >= 18) {
35 | eglBase = EglBase.createEgl14(configAttributes);
36 | }
37 | } catch (RuntimeException ex) {
38 | // Fall back to EglBase10.
39 | cause = ex;
40 | }
41 |
42 | if (eglBase == null) {
43 | try {
44 | eglBase = EglBase.createEgl10(configAttributes);
45 | } catch (RuntimeException ex) {
46 | // Neither EglBase14, nor EglBase10 succeeded to initialize.
47 | cause = ex;
48 | }
49 | }
50 |
51 | if (cause != null) {
52 | Log.e(EglUtils.class.getName(), "Failed to create EglBase", cause);
53 | } else {
54 | rootEglBase = eglBase;
55 | }
56 | }
57 |
58 | return rootEglBase;
59 | }
60 |
61 | public static EglBase.Context getRootEglBaseContext() {
62 | EglBase eglBase = getRootEglBase();
63 |
64 | return eglBase == null ? null : eglBase.getEglBaseContext();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/RTCVideoViewManager.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import com.facebook.react.uimanager.annotations.ReactProp;
4 | import com.facebook.react.uimanager.SimpleViewManager;
5 | import com.facebook.react.uimanager.ThemedReactContext;
6 |
7 |
8 | public class RTCVideoViewManager extends SimpleViewManager {
9 | private static final String REACT_CLASS = "RTCVideoView";
10 |
11 | @Override
12 | public String getName() {
13 | return REACT_CLASS;
14 | }
15 |
16 | @Override
17 | public WebRTCView createViewInstance(ThemedReactContext context) {
18 | return new WebRTCView(context);
19 | }
20 |
21 | /**
22 | * Sets the indicator which determines whether a specific {@link WebRTCView}
23 | * is to mirror the video specified by {@code streamURL} during its rendering.
24 | * For more details, refer to the documentation of the {@code mirror} property
25 | * of the JavaScript counterpart of {@code WebRTCView} i.e. {@code RTCView}.
26 | *
27 | * @param view The {@code WebRTCView} on which the specified {@code mirror} is
28 | * to be set.
29 | * @param mirror If the specified {@code WebRTCView} is to mirror the video
30 | * specified by its associated {@code streamURL} during its rendering,
31 | * {@code true}; otherwise, {@code false}.
32 | */
33 | @ReactProp(name = "mirror")
34 | public void setMirror(WebRTCView view, boolean mirror) {
35 | view.setMirror(mirror);
36 | }
37 |
38 | /**
39 | * In the fashion of
40 | * https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth
41 | * and https://www.w3.org/TR/html5/rendering.html#video-object-fit, resembles
42 | * the CSS style {@code object-fit}.
43 | *
44 | * @param view The {@code WebRTCView} on which the specified {@code objectFit}
45 | * is to be set.
46 | * @param objectFit For details, refer to the documentation of the
47 | * {@code objectFit} property of the JavaScript counterpart of
48 | * {@code WebRTCView} i.e. {@code RTCView}.
49 | */
50 | @ReactProp(name = "objectFit")
51 | public void setObjectFit(WebRTCView view, String objectFit) {
52 | view.setObjectFit(objectFit);
53 | }
54 |
55 | @ReactProp(name = "streamURL")
56 | public void setStreamURL(WebRTCView view, String streamURL) {
57 | view.setStreamURL(streamURL);
58 | }
59 |
60 | /**
61 | * Sets the z-order of a specific {@link WebRTCView} in the stacking space of
62 | * all {@code WebRTCView}s. For more details, refer to the documentation of
63 | * the {@code zOrder} property of the JavaScript counterpart of
64 | * {@code WebRTCView} i.e. {@code RTCView}.
65 | *
66 | * @param view The {@code WebRTCView} on which the specified {@code zOrder} is
67 | * to be set.
68 | * @param zOrder The z-order to set on the specified {@code WebRTCView}.
69 | */
70 | @ReactProp(name = "zOrder")
71 | public void setZOrder(WebRTCView view, int zOrder) {
72 | view.setZOrder(zOrder);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/ReactBridgeUtil.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import com.facebook.react.bridge.ReadableMap;
4 | import com.facebook.react.bridge.ReadableType;
5 |
6 | public class ReactBridgeUtil {
7 |
8 | /**
9 | * Reads a value from given ReadableMap and returns it as
10 | * a String. Note that integer value is converted to double, before
11 | * it gets converted to a string.
12 | * @param map the ReadableMap from which the value will be obtained
13 | * @param key the map's key under which the value has been mapped.
14 | * @return a String representation of the value if exists or
15 | * null if there is no value mapped for given key.
16 | */
17 | public static String getMapStrValue(ReadableMap map, String key) {
18 | if(!map.hasKey(key)){
19 | return null;
20 | }
21 | ReadableType type = map.getType(key);
22 | switch (type) {
23 | case Boolean:
24 | return String.valueOf(map.getBoolean(key));
25 | case Number:
26 | // Don't know how to distinguish between Int and Double from
27 | // ReadableType.Number. 'getInt' will fail on double value,
28 | // while 'getDouble' works for both.
29 | // return String.valueOf(map.getInt(key));
30 | return String.valueOf(map.getDouble(key));
31 | case String:
32 | return map.getString(key);
33 | default:
34 | return null;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/ThreadUtils.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import java.util.concurrent.ExecutorService;
4 | import java.util.concurrent.Executors;
5 |
6 | final class ThreadUtils {
7 | /**
8 | * Thread which will be used to call all WebRTC PeerConnection APIs. They
9 | * they don't run on the calling thread anyway, we are deferring the calls
10 | * to this thread to avoid (potentially) blocking the calling thread.
11 | */
12 | private static final ExecutorService executor
13 | = Executors.newSingleThreadExecutor();
14 |
15 | /**
16 | * Runs the given {@link Runnable} on the executor.
17 | * @param runnable
18 | */
19 | public static void runOnExecutor(Runnable runnable) {
20 | executor.execute(runnable);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/android/src/main/java/com/oney/WebRTCModule/WebRTCModulePackage.java:
--------------------------------------------------------------------------------
1 | package com.oney.WebRTCModule;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.NativeModule;
5 | import com.facebook.react.bridge.ReactApplicationContext;
6 | import com.facebook.react.uimanager.ViewManager;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 |
11 | public class WebRTCModulePackage implements ReactPackage {
12 | @Override
13 | public List createNativeModules(
14 | ReactApplicationContext reactContext) {
15 | return Arrays.asList(
16 | new WebRTCModule(reactContext)
17 | );
18 | }
19 |
20 | @Override
21 | public List createViewManagers(
22 | ReactApplicationContext reactContext) {
23 | return Arrays.asList(
24 | new RTCVideoViewManager()
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/getUserMedia.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import {Platform, NativeModules} from 'react-native';
4 | import * as RTCUtil from './RTCUtil';
5 |
6 | import MediaStream from './MediaStream';
7 | import MediaStreamError from './MediaStreamError';
8 | import permissions from './Permissions';
9 |
10 | const { WebRTCModule } = NativeModules;
11 |
12 |
13 | export default function getUserMedia(constraints = {}) {
14 | // According to
15 | // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia,
16 | // the constraints argument is a dictionary of type MediaStreamConstraints.
17 | if (typeof constraints !== 'object') {
18 | return Promise.reject(new TypeError('constraints is not a dictionary'));
19 | }
20 |
21 | if ((typeof constraints.audio === 'undefined' || !constraints.audio)
22 | && (typeof constraints.video === 'undefined' || !constraints.video)) {
23 | return Promise.reject(new TypeError('audio and/or video is required'));
24 | }
25 |
26 | // Normalize constraints.
27 | constraints = RTCUtil.normalizeConstraints(constraints);
28 |
29 | // Request required permissions
30 | const reqPermissions = [];
31 | if (constraints.audio) {
32 | reqPermissions.push(permissions.request({ name: 'microphone' }));
33 | } else {
34 | reqPermissions.push(Promise.resolve(false));
35 | }
36 | if (constraints.video) {
37 | reqPermissions.push(permissions.request({ name: 'camera' }));
38 | } else {
39 | reqPermissions.push(Promise.resolve(false));
40 | }
41 |
42 | return new Promise((resolve, reject) => {
43 | Promise.all(reqPermissions).then(results => {
44 | const [ audioPerm, videoPerm ] = results;
45 |
46 | // Check permission results and remove unneeded permissions.
47 |
48 | if (!audioPerm && !videoPerm) {
49 | // https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-getusermedia
50 | // step 4
51 | const error = {
52 | message: 'Permission denied.',
53 | name: 'SecurityError'
54 | };
55 | reject(new MediaStreamError(error));
56 |
57 | return;
58 | }
59 |
60 | audioPerm || (delete constraints.audio);
61 | videoPerm || (delete constraints.video);
62 |
63 | const success = (id, tracks) => {
64 | const info = {
65 | streamId: id,
66 | streamReactTag: id,
67 | tracks
68 | };
69 |
70 | resolve(new MediaStream(info));
71 | };
72 |
73 | const failure = (type, message) => {
74 | let error;
75 | switch (type) {
76 | case 'TypeError':
77 | error = new TypeError(message);
78 | break;
79 | }
80 | if (!error) {
81 | error = new MediaStreamError({ message, name: type });
82 | }
83 |
84 | reject(error);
85 | };
86 |
87 | WebRTCModule.getUserMedia(constraints, success, failure);
88 | });
89 | });
90 | }
91 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import RTCPeerConnection from './RTCPeerConnection';
4 | import RTCIceCandidate from './RTCIceCandidate';
5 | import RTCSessionDescription from './RTCSessionDescription';
6 | import RTCView from './RTCView';
7 | import MediaStream from './MediaStream';
8 | import MediaStreamTrack from './MediaStreamTrack';
9 | import mediaDevices from './MediaDevices';
10 | import permissions from './Permissions';
11 |
12 | export {
13 | RTCPeerConnection,
14 | RTCIceCandidate,
15 | RTCSessionDescription,
16 | RTCView,
17 | MediaStream,
18 | MediaStreamTrack,
19 | mediaDevices,
20 | permissions
21 | };
22 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/RCTConvert+WebRTC.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 | #import
5 | #import
6 | #import
7 |
8 | @interface RCTConvert (WebRTC)
9 |
10 | + (RTCIceCandidate *)RTCIceCandidate:(id)json;
11 | + (RTCSessionDescription *)RTCSessionDescription:(id)json;
12 | + (RTCIceServer *)RTCIceServer:(id)json;
13 | + (RTCDataChannelConfiguration *)RTCDataChannelConfiguration:(id)json;
14 | + (RTCConfiguration *)RTCConfiguration:(id)json;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/RTCMediaStreamTrack+React.h:
--------------------------------------------------------------------------------
1 |
2 | #import
3 |
4 | #import "VideoCaptureController.h"
5 |
6 | @interface RTCMediaStreamTrack (React)
7 |
8 | @property (strong, nonatomic) VideoCaptureController *videoCaptureController;
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/RTCMediaStreamTrack+React.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "RTCMediaStreamTrack+React.h"
4 |
5 | @implementation RTCMediaStreamTrack (React)
6 |
7 | - (VideoCaptureController *)videoCaptureController {
8 | return objc_getAssociatedObject(self, @selector(videoCaptureController));
9 | }
10 |
11 | - (void)setVideoCaptureController:(VideoCaptureController *)videoCaptureController {
12 | objc_setAssociatedObject(self, @selector(videoCaptureController), videoCaptureController, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
13 | }
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/RTCVideoViewManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RTCVideoViewManager.h
3 | // TestReact
4 | //
5 | // Created by one on 2015/9/25.
6 | // Copyright © 2015年 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface RTCVideoViewManager : RCTViewManager
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/VideoCaptureController.h:
--------------------------------------------------------------------------------
1 |
2 | #import
3 | #import
4 |
5 | @interface VideoCaptureController : NSObject
6 |
7 | -(instancetype)initWithCapturer:(RTCCameraVideoCapturer *)capturer
8 | andConstraints:(NSDictionary *)constraints;
9 | -(void)startCapture;
10 | -(void)stopCapture;
11 | -(void)switchCamera;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/VideoCaptureController.m:
--------------------------------------------------------------------------------
1 |
2 | #import "VideoCaptureController.h"
3 |
4 | #import
5 |
6 |
7 | @implementation VideoCaptureController {
8 | RTCCameraVideoCapturer *_capturer;
9 | NSString *_deviceId;
10 | BOOL _usingFrontCamera;
11 | int _width;
12 | int _height;
13 | int _fps;
14 | }
15 |
16 | -(instancetype)initWithCapturer:(RTCCameraVideoCapturer *)capturer
17 | andConstraints:(NSDictionary *)constraints {
18 | self = [super init];
19 | if (self) {
20 | _capturer = capturer;
21 |
22 | // Default to the front camera.
23 | _usingFrontCamera = YES;
24 |
25 | _deviceId = constraints[@"deviceId"];
26 | _width = [constraints[@"width"] intValue];
27 | _height = [constraints[@"height"] intValue];
28 | _fps = [constraints[@"frameRate"] intValue];
29 |
30 | id facingMode = constraints[@"facingMode"];
31 |
32 | if (facingMode && [facingMode isKindOfClass:[NSString class]]) {
33 | AVCaptureDevicePosition position;
34 | if ([facingMode isEqualToString:@"environment"]) {
35 | position = AVCaptureDevicePositionBack;
36 | } else if ([facingMode isEqualToString:@"user"]) {
37 | position = AVCaptureDevicePositionFront;
38 | } else {
39 | // If the specified facingMode value is not supported, fall back
40 | // to the front camera.
41 | position = AVCaptureDevicePositionFront;
42 | }
43 |
44 | _usingFrontCamera = position == AVCaptureDevicePositionFront;
45 | }
46 | }
47 |
48 | return self;
49 | }
50 |
51 | -(void)startCapture {
52 | AVCaptureDevice *device;
53 | if (_deviceId) {
54 | device = [AVCaptureDevice deviceWithUniqueID:_deviceId];
55 | }
56 | if (!device) {
57 | AVCaptureDevicePosition position
58 | = _usingFrontCamera
59 | ? AVCaptureDevicePositionFront
60 | : AVCaptureDevicePositionBack;
61 | device = [self findDeviceForPosition:position];
62 | }
63 |
64 | if (!device) {
65 | RCTLogWarn(@"[VideoCaptureController] No capture devices found!");
66 |
67 | return;
68 | }
69 |
70 | AVCaptureDeviceFormat *format
71 | = [self selectFormatForDevice:device
72 | withTargetWidth:_width
73 | withTargetHeight:_height];
74 | if (!format) {
75 | RCTLogWarn(@"[VideoCaptureController] No valid formats for device %@", device);
76 |
77 | return;
78 | }
79 |
80 | // Starting the capture happens on another thread. Wait for it.
81 | dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
82 |
83 | [_capturer startCaptureWithDevice:device format:format fps:_fps completionHandler:^(NSError *err) {
84 | if (err) {
85 | RCTLogError(@"[VideoCaptureController] Error starting capture: %@", err);
86 | } else {
87 | RCTLog(@"[VideoCaptureController] Capture started");
88 | }
89 | dispatch_semaphore_signal(semaphore);
90 | }];
91 |
92 | dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
93 | }
94 |
95 | -(void)stopCapture {
96 | // Stopping the capture happens on another thread. Wait for it.
97 | dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
98 |
99 | [_capturer stopCaptureWithCompletionHandler:^{
100 | RCTLog(@"[VideoCaptureController] Capture stopped");
101 | dispatch_semaphore_signal(semaphore);
102 | }];
103 |
104 | dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
105 | }
106 |
107 | -(void)switchCamera {
108 | _usingFrontCamera = !_usingFrontCamera;
109 |
110 | [self startCapture];
111 | }
112 |
113 | #pragma mark Private
114 |
115 | - (AVCaptureDevice *)findDeviceForPosition:(AVCaptureDevicePosition)position {
116 | NSArray *captureDevices = [RTCCameraVideoCapturer captureDevices];
117 | for (AVCaptureDevice *device in captureDevices) {
118 | if (device.position == position) {
119 | return device;
120 | }
121 | }
122 |
123 | return [captureDevices firstObject];
124 | }
125 |
126 | - (AVCaptureDeviceFormat *)selectFormatForDevice:(AVCaptureDevice *)device
127 | withTargetWidth:(int)targetWidth
128 | withTargetHeight:(int)targetHeight {
129 | NSArray *formats =
130 | [RTCCameraVideoCapturer supportedFormatsForDevice:device];
131 | AVCaptureDeviceFormat *selectedFormat = nil;
132 | int currentDiff = INT_MAX;
133 |
134 | for (AVCaptureDeviceFormat *format in formats) {
135 | CMVideoDimensions dimension = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
136 | FourCharCode pixelFormat = CMFormatDescriptionGetMediaSubType(format.formatDescription);
137 | int diff = abs(targetWidth - dimension.width) + abs(targetHeight - dimension.height);
138 | if (diff < currentDiff) {
139 | selectedFormat = format;
140 | currentDiff = diff;
141 | } else if (diff == currentDiff && pixelFormat == [_capturer preferredOutputPixelFormat]) {
142 | selectedFormat = format;
143 | }
144 | }
145 |
146 | return selectedFormat;
147 | }
148 |
149 | @end
150 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule+Permissions.m:
--------------------------------------------------------------------------------
1 |
2 | #import
3 |
4 | #import "WebRTCModule.h"
5 |
6 | static NSString *const PERMISSION_DENIED = @"denied";
7 | static NSString *const PERMISSION_GRANTED = @"granted";
8 | static NSString *const PERMISSION_PROMPT = @"prompt";
9 |
10 | @implementation WebRTCModule (Permissions)
11 |
12 | - (AVMediaType)avMediaType:(NSString* )mediaType {
13 | if ([mediaType isEqualToString:@"microphone"]) {
14 | return AVMediaTypeAudio;
15 | } else if ([mediaType isEqualToString:@"camera"]) {
16 | return AVMediaTypeVideo;
17 | } else {
18 | return nil;
19 | }
20 | }
21 |
22 | RCT_EXPORT_METHOD(checkPermission:(NSString *)mediaType
23 | resolver:(RCTPromiseResolveBlock)resolve
24 | rejecter:(RCTPromiseRejectBlock)reject) {
25 | AVMediaType mediaType_ = [self avMediaType:mediaType];
26 |
27 | if (mediaType_ == nil) {
28 | reject(@"invalid_type", @"Invalid media type", nil);
29 | return;
30 | }
31 |
32 | AVAuthorizationStatus status
33 | = [AVCaptureDevice authorizationStatusForMediaType:mediaType_];
34 | switch (status) {
35 | case AVAuthorizationStatusAuthorized:
36 | resolve(PERMISSION_GRANTED);
37 | break;
38 |
39 | case AVAuthorizationStatusNotDetermined:
40 | resolve(PERMISSION_PROMPT);
41 | break;
42 |
43 | default:
44 | resolve(PERMISSION_DENIED);
45 | break;
46 | }
47 | }
48 |
49 | RCT_EXPORT_METHOD(requestPermission:(NSString *)mediaType
50 | resolver:(RCTPromiseResolveBlock)resolve
51 | rejecter:(RCTPromiseRejectBlock)reject) {
52 | AVMediaType mediaType_ = [self avMediaType:mediaType];
53 |
54 | if (mediaType_ == nil) {
55 | reject(@"invalid_type", @"Invalid media type", nil);
56 | return;
57 | }
58 |
59 | [AVCaptureDevice requestAccessForMediaType:mediaType_
60 | completionHandler:^(BOOL granted) {
61 | resolve(@(granted));
62 | }];
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.h:
--------------------------------------------------------------------------------
1 | #import "WebRTCModule.h"
2 | #import
3 |
4 | @interface RTCDataChannel (React)
5 |
6 | @property (nonatomic, strong) NSNumber *peerConnectionId;
7 |
8 | @end
9 |
10 | @interface WebRTCModule (RTCDataChannel)
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import
4 | #import
5 |
6 | #import "WebRTCModule+RTCDataChannel.h"
7 | #import "WebRTCModule+RTCPeerConnection.h"
8 | #import
9 |
10 | @implementation RTCDataChannel (React)
11 |
12 | - (NSNumber *)peerConnectionId
13 | {
14 | return objc_getAssociatedObject(self, _cmd);
15 | }
16 |
17 | - (void)setPeerConnectionId:(NSNumber *)peerConnectionId
18 | {
19 | objc_setAssociatedObject(self, @selector(peerConnectionId), peerConnectionId, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
20 | }
21 |
22 | @end
23 |
24 | @implementation WebRTCModule (RTCDataChannel)
25 |
26 | RCT_EXPORT_METHOD(createDataChannel:(nonnull NSNumber *)peerConnectionId
27 | label:(NSString *)label
28 | config:(RTCDataChannelConfiguration *)config
29 | {
30 | RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
31 | RTCDataChannel *dataChannel = [peerConnection dataChannelForLabel:label configuration:config];
32 | // XXX RTP data channels are not defined by the WebRTC standard, have been
33 | // deprecated in Chromium, and Google have decided (in 2015) to no longer
34 | // support them (in the face of multiple reported issues of breakages).
35 | if (-1 != dataChannel.channelId) {
36 | dataChannel.peerConnectionId = peerConnectionId;
37 | NSNumber *dataChannelId = [NSNumber numberWithInteger:dataChannel.channelId];
38 | peerConnection.dataChannels[dataChannelId] = dataChannel;
39 | dataChannel.delegate = self;
40 | }
41 | })
42 |
43 | RCT_EXPORT_METHOD(dataChannelClose:(nonnull NSNumber *)peerConnectionId
44 | dataChannelId:(nonnull NSNumber *)dataChannelId
45 | {
46 | RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
47 | NSMutableDictionary *dataChannels = peerConnection.dataChannels;
48 | RTCDataChannel *dataChannel = dataChannels[dataChannelId];
49 | [dataChannel close];
50 | [dataChannels removeObjectForKey:dataChannelId];
51 | })
52 |
53 | RCT_EXPORT_METHOD(dataChannelSend:(nonnull NSNumber *)peerConnectionId
54 | dataChannelId:(nonnull NSNumber *)dataChannelId
55 | data:(NSString *)data
56 | type:(NSString *)type
57 | {
58 | RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
59 | RTCDataChannel *dataChannel = peerConnection.dataChannels[dataChannelId];
60 | NSData *bytes = [type isEqualToString:@"binary"] ?
61 | [[NSData alloc] initWithBase64EncodedString:data options:0] :
62 | [data dataUsingEncoding:NSUTF8StringEncoding];
63 | RTCDataBuffer *buffer = [[RTCDataBuffer alloc] initWithData:bytes isBinary:[type isEqualToString:@"binary"]];
64 | [dataChannel sendData:buffer];
65 | })
66 |
67 | - (NSString *)stringForDataChannelState:(RTCDataChannelState)state
68 | {
69 | switch (state) {
70 | case RTCDataChannelStateConnecting: return @"connecting";
71 | case RTCDataChannelStateOpen: return @"open";
72 | case RTCDataChannelStateClosing: return @"closing";
73 | case RTCDataChannelStateClosed: return @"closed";
74 | }
75 | return nil;
76 | }
77 |
78 | #pragma mark - RTCDataChannelDelegate methods
79 |
80 | // Called when the data channel state has changed.
81 | - (void)dataChannelDidChangeState:(RTCDataChannel*)channel
82 | {
83 | NSDictionary *event = @{@"id": @(channel.channelId),
84 | @"peerConnectionId": channel.peerConnectionId,
85 | @"state": [self stringForDataChannelState:channel.readyState]};
86 | [self.bridge.eventDispatcher sendDeviceEventWithName:@"dataChannelStateChanged"
87 | body:event];
88 | }
89 |
90 | // Called when a data buffer was successfully received.
91 | - (void)dataChannel:(RTCDataChannel *)channel didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer
92 | {
93 | NSString *type;
94 | NSString *data;
95 | if (buffer.isBinary) {
96 | type = @"binary";
97 | data = [buffer.data base64EncodedStringWithOptions:0];
98 | } else {
99 | type = @"text";
100 | // XXX NSData has a length property which means that, when it represents
101 | // text, the value of its bytes property does not have to be terminated by
102 | // null. In such a case, NSString's stringFromUTF8String may fail and return
103 | // nil (which would crash the process when inserting data into NSDictionary
104 | // without the nil protection implemented below).
105 | data = [[NSString alloc] initWithData:buffer.data
106 | encoding:NSUTF8StringEncoding];
107 | }
108 | NSDictionary *event = @{@"id": @(channel.channelId),
109 | @"peerConnectionId": channel.peerConnectionId,
110 | @"type": type,
111 | // XXX NSDictionary will crash the process upon
112 | // attempting to insert nil. Such behavior is
113 | // unacceptable given that protection in such a
114 | // scenario is extremely simple.
115 | @"data": (data ? data : [NSNull null])};
116 | [self.bridge.eventDispatcher sendDeviceEventWithName:@"dataChannelReceiveMessage"
117 | body:event];
118 | }
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.h:
--------------------------------------------------------------------------------
1 | //
2 | // WebRTCModule+RTCPeerConnection.h
3 | //
4 | // Created by one on 2015/9/24.
5 | // Copyright © 2015 One. All rights reserved.
6 | //
7 |
8 | #import "WebRTCModule.h"
9 | #import
10 | #import
11 |
12 | @interface RTCPeerConnection (React)
13 |
14 | @property (nonatomic, strong) NSMutableDictionary *dataChannels;
15 | @property (nonatomic, strong) NSNumber *reactTag;
16 | @property (nonatomic, strong) NSMutableDictionary *remoteStreams;
17 | @property (nonatomic, strong) NSMutableDictionary *remoteTracks;
18 | @property (nonatomic, weak) id webRTCModule;
19 |
20 | @end
21 |
22 | @interface WebRTCModule (RTCPeerConnection)
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.h:
--------------------------------------------------------------------------------
1 |
2 | #import "WebRTCModule.h"
3 | #import
4 |
5 | @interface RTCPeerConnection (VideoTrackAdapter)
6 |
7 | @property (nonatomic, strong) NSMutableDictionary *videoTrackAdapters;
8 |
9 | - (void)addVideoTrackAdapter:(NSString*)streamReactId track:(RTCVideoTrack*)track;
10 | - (void)removeVideoTrackAdapter:(RTCVideoTrack*)track;
11 |
12 | @end
13 |
14 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule.h:
--------------------------------------------------------------------------------
1 | //
2 | // WebRTCModule.h
3 | //
4 | // Created by one on 2015/9/24.
5 | // Copyright © 2015 One. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 |
11 | #import
12 | #import
13 |
14 | #import
15 | #import
16 | #import
17 | #import
18 | #import
19 | #import
20 | #import
21 |
22 | @interface WebRTCModule : NSObject
23 |
24 | @property(nonatomic, strong) dispatch_queue_t workerQueue;
25 |
26 | @property (nonatomic, strong) RTCPeerConnectionFactory *peerConnectionFactory;
27 |
28 | @property (nonatomic, strong) NSMutableDictionary *peerConnections;
29 | @property (nonatomic, strong) NSMutableDictionary *localStreams;
30 | @property (nonatomic, strong) NSMutableDictionary *localTracks;
31 |
32 | - (instancetype)initWithEncoderFactory:(id)encoderFactory
33 | decoderFactory:(id)decoderFactory;
34 |
35 | - (RTCMediaStream*)streamForReactTag:(NSString*)reactTag;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/ios/RCTWebRTC/WebRTCModule.m:
--------------------------------------------------------------------------------
1 | //
2 | // WebRTCModule.m
3 | //
4 | // Created by one on 2015/9/24.
5 | // Copyright © 2015 One. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | #import
11 | #import
12 | #import
13 |
14 | #import
15 | #import
16 |
17 | #import "WebRTCModule.h"
18 | #import "WebRTCModule+RTCPeerConnection.h"
19 |
20 | @interface WebRTCModule ()
21 | @end
22 |
23 | @implementation WebRTCModule
24 |
25 | @synthesize bridge = _bridge;
26 |
27 | + (BOOL)requiresMainQueueSetup
28 | {
29 | return NO;
30 | }
31 |
32 | - (void)dealloc
33 | {
34 | [_localTracks removeAllObjects];
35 | _localTracks = nil;
36 | [_localStreams removeAllObjects];
37 | _localStreams = nil;
38 |
39 | for (NSNumber *peerConnectionId in _peerConnections) {
40 | RTCPeerConnection *peerConnection = _peerConnections[peerConnectionId];
41 | peerConnection.delegate = nil;
42 | [peerConnection close];
43 | }
44 | [_peerConnections removeAllObjects];
45 |
46 | _peerConnectionFactory = nil;
47 | }
48 |
49 | - (instancetype)init
50 | {
51 | return [self initWithEncoderFactory:nil decoderFactory:nil];
52 | }
53 |
54 | - (instancetype)initWithEncoderFactory:(nullable id)encoderFactory
55 | decoderFactory:(nullable id)decoderFactory
56 | {
57 | self = [super init];
58 | if (self) {
59 | if (encoderFactory == nil) {
60 | encoderFactory = [[RTCDefaultVideoEncoderFactory alloc] init];
61 | }
62 | if (decoderFactory == nil) {
63 | decoderFactory = [[RTCDefaultVideoDecoderFactory alloc] init];
64 | }
65 | _peerConnectionFactory
66 | = [[RTCPeerConnectionFactory alloc] initWithEncoderFactory:encoderFactory
67 | decoderFactory:decoderFactory];
68 |
69 | _peerConnections = [NSMutableDictionary new];
70 | _localStreams = [NSMutableDictionary new];
71 | _localTracks = [NSMutableDictionary new];
72 |
73 | dispatch_queue_attr_t attributes =
74 | dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL,
75 | QOS_CLASS_USER_INITIATED, -1);
76 | _workerQueue = dispatch_queue_create("WebRTCModule.queue", attributes);
77 | }
78 | return self;
79 | }
80 |
81 | - (RTCMediaStream*)streamForReactTag:(NSString*)reactTag
82 | {
83 | RTCMediaStream *stream = _localStreams[reactTag];
84 | if (!stream) {
85 | for (NSNumber *peerConnectionId in _peerConnections) {
86 | RTCPeerConnection *peerConnection = _peerConnections[peerConnectionId];
87 | stream = peerConnection.remoteStreams[reactTag];
88 | if (stream) {
89 | break;
90 | }
91 | }
92 | }
93 | return stream;
94 | }
95 |
96 | RCT_EXPORT_MODULE();
97 |
98 | - (dispatch_queue_t)methodQueue
99 | {
100 | return _workerQueue;
101 | }
102 |
103 | @end
104 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCAudioSessionConfiguration.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | RTC_EXTERN const int kRTCAudioSessionPreferredNumberOfChannels;
19 | RTC_EXTERN const double kRTCAudioSessionHighPerformanceSampleRate;
20 | RTC_EXTERN const double kRTCAudioSessionLowComplexitySampleRate;
21 | RTC_EXTERN const double kRTCAudioSessionHighPerformanceIOBufferDuration;
22 | RTC_EXTERN const double kRTCAudioSessionLowComplexityIOBufferDuration;
23 |
24 | // Struct to hold configuration values.
25 | RTC_OBJC_EXPORT
26 | @interface RTCAudioSessionConfiguration : NSObject
27 |
28 | @property(nonatomic, strong) NSString *category;
29 | @property(nonatomic, assign) AVAudioSessionCategoryOptions categoryOptions;
30 | @property(nonatomic, strong) NSString *mode;
31 | @property(nonatomic, assign) double sampleRate;
32 | @property(nonatomic, assign) NSTimeInterval ioBufferDuration;
33 | @property(nonatomic, assign) NSInteger inputNumberOfChannels;
34 | @property(nonatomic, assign) NSInteger outputNumberOfChannels;
35 |
36 | /** Initializes configuration to defaults. */
37 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
38 |
39 | /** Returns the current configuration of the audio session. */
40 | + (instancetype)currentConfiguration;
41 | /** Returns the configuration that WebRTC needs. */
42 | + (instancetype)webRTCConfiguration;
43 | /** Provide a way to override the default configuration. */
44 | + (void)setWebRTCConfiguration:(RTCAudioSessionConfiguration *)configuration;
45 |
46 | @end
47 |
48 | NS_ASSUME_NONNULL_END
49 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCAudioSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCMediaSource.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | RTC_OBJC_EXPORT
19 | @interface RTCAudioSource : RTCMediaSource
20 |
21 | - (instancetype)init NS_UNAVAILABLE;
22 |
23 | // Sets the volume for the RTCMediaSource. |volume| is a gain value in the range
24 | // [0, 10].
25 | // Temporary fix to be able to modify volume of remote audio tracks.
26 | // TODO(kthelgason): Property stays here temporarily until a proper volume-api
27 | // is available on the surface exposed by webrtc.
28 | @property(nonatomic, assign) double volume;
29 |
30 | @end
31 |
32 | NS_ASSUME_NONNULL_END
33 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCAudioTrack.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import "RTCMacros.h"
12 | #import "RTCMediaStreamTrack.h"
13 |
14 | NS_ASSUME_NONNULL_BEGIN
15 |
16 | @class RTCAudioSource;
17 |
18 | RTC_OBJC_EXPORT
19 | @interface RTCAudioTrack : RTCMediaStreamTrack
20 |
21 | - (instancetype)init NS_UNAVAILABLE;
22 |
23 | /** The audio source for this audio track. */
24 | @property(nonatomic, readonly) RTCAudioSource *source;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCVPixelBuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoFrameBuffer.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** RTCVideoFrameBuffer containing a CVPixelBufferRef */
19 | RTC_OBJC_EXPORT
20 | @interface RTCCVPixelBuffer : NSObject
21 |
22 | @property(nonatomic, readonly) CVPixelBufferRef pixelBuffer;
23 | @property(nonatomic, readonly) int cropX;
24 | @property(nonatomic, readonly) int cropY;
25 | @property(nonatomic, readonly) int cropWidth;
26 | @property(nonatomic, readonly) int cropHeight;
27 |
28 | + (NSSet *)supportedPixelFormats;
29 |
30 | - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer;
31 | - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
32 | adaptedWidth:(int)adaptedWidth
33 | adaptedHeight:(int)adaptedHeight
34 | cropWidth:(int)cropWidth
35 | cropHeight:(int)cropHeight
36 | cropX:(int)cropX
37 | cropY:(int)cropY;
38 |
39 | - (BOOL)requiresCropping;
40 | - (BOOL)requiresScalingToWidth:(int)width height:(int)height;
41 | - (int)bufferSizeForCroppingAndScalingToWidth:(int)width height:(int)height;
42 |
43 | /** The minimum size of the |tmpBuffer| must be the number of bytes returned from the
44 | * bufferSizeForCroppingAndScalingToWidth:height: method.
45 | * If that size is 0, the |tmpBuffer| may be nil.
46 | */
47 | - (BOOL)cropAndScaleTo:(CVPixelBufferRef)outputPixelBuffer
48 | withTempBuffer:(nullable uint8_t *)tmpBuffer;
49 |
50 | @end
51 |
52 | NS_ASSUME_NONNULL_END
53 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCallbackLogger.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCLogging.h"
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | typedef void (^RTCCallbackLoggerMessageHandler)(NSString *message);
19 | typedef void (^RTCCallbackLoggerMessageAndSeverityHandler)(NSString *message,
20 | RTCLoggingSeverity severity);
21 |
22 | // This class intercepts WebRTC logs and forwards them to a registered block.
23 | // This class is not threadsafe.
24 | RTC_OBJC_EXPORT
25 | @interface RTCCallbackLogger : NSObject
26 |
27 | // The severity level to capture. The default is kRTCLoggingSeverityInfo.
28 | @property(nonatomic, assign) RTCLoggingSeverity severity;
29 |
30 | // The callback handler will be called on the same thread that does the
31 | // logging, so if the logging callback can be slow it may be a good idea
32 | // to implement dispatching to some other queue.
33 | - (void)start:(nullable RTCCallbackLoggerMessageHandler)handler;
34 | - (void)startWithMessageAndSeverityHandler:
35 | (nullable RTCCallbackLoggerMessageAndSeverityHandler)handler;
36 |
37 | - (void)stop;
38 |
39 | @end
40 |
41 | NS_ASSUME_NONNULL_END
42 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCameraPreviewView.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 |
16 | @class AVCaptureSession;
17 |
18 | /** RTCCameraPreviewView is a view that renders local video from an
19 | * AVCaptureSession.
20 | */
21 | RTC_OBJC_EXPORT
22 | @interface RTCCameraPreviewView : UIView
23 |
24 | /** The capture session being rendered in the view. Capture session
25 | * is assigned to AVCaptureVideoPreviewLayer async in the same
26 | * queue that the AVCaptureSession is started/stopped.
27 | */
28 | @property(nonatomic, strong) AVCaptureSession* captureSession;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCameraVideoCapturer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 | #import "RTCVideoCapturer.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | RTC_OBJC_EXPORT
20 | // Camera capture that implements RTCVideoCapturer. Delivers frames to a RTCVideoCapturerDelegate
21 | // (usually RTCVideoSource).
22 | NS_EXTENSION_UNAVAILABLE_IOS("Camera not available in app extensions.")
23 | @interface RTCCameraVideoCapturer : RTCVideoCapturer
24 |
25 | // Capture session that is used for capturing. Valid from initialization to dealloc.
26 | @property(readonly, nonatomic) AVCaptureSession *captureSession;
27 |
28 | // Returns list of available capture devices that support video capture.
29 | + (NSArray *)captureDevices;
30 | // Returns list of formats that are supported by this class for this device.
31 | + (NSArray *)supportedFormatsForDevice:(AVCaptureDevice *)device;
32 |
33 | // Returns the most efficient supported output pixel format for this capturer.
34 | - (FourCharCode)preferredOutputPixelFormat;
35 |
36 | // Starts the capture session asynchronously and notifies callback on completion.
37 | // The device will capture video in the format given in the `format` parameter. If the pixel format
38 | // in `format` is supported by the WebRTC pipeline, the same pixel format will be used for the
39 | // output. Otherwise, the format returned by `preferredOutputPixelFormat` will be used.
40 | - (void)startCaptureWithDevice:(AVCaptureDevice *)device
41 | format:(AVCaptureDeviceFormat *)format
42 | fps:(NSInteger)fps
43 | completionHandler:(nullable void (^)(NSError *))completionHandler;
44 | // Stops the capture session asynchronously and notifies callback on completion.
45 | - (void)stopCaptureWithCompletionHandler:(nullable void (^)(void))completionHandler;
46 |
47 | // Starts the capture session asynchronously.
48 | - (void)startCaptureWithDevice:(AVCaptureDevice *)device
49 | format:(AVCaptureDeviceFormat *)format
50 | fps:(NSInteger)fps;
51 | // Stops the capture session asynchronously.
52 | - (void)stopCapture;
53 |
54 | @end
55 |
56 | NS_ASSUME_NONNULL_END
57 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCertificate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCCertificate : NSObject
19 |
20 | /** Private key in PEM. */
21 | @property(nonatomic, readonly, copy) NSString *private_key;
22 |
23 | /** Public key in an x509 cert encoded in PEM. */
24 | @property(nonatomic, readonly, copy) NSString *certificate;
25 |
26 | /**
27 | * Initialize an RTCCertificate with PEM strings for private_key and certificate.
28 | */
29 | - (instancetype)initWithPrivateKey:(NSString *)private_key
30 | certificate:(NSString *)certificate NS_DESIGNATED_INITIALIZER;
31 |
32 | - (instancetype)init NS_UNAVAILABLE;
33 |
34 | /** Generate a new certificate for 're' use.
35 | *
36 | * Optional dictionary of parameters. Defaults to KeyType ECDSA if none are
37 | * provided.
38 | * - name: "ECDSA" or "RSASSA-PKCS1-v1_5"
39 | */
40 | + (nullable RTCCertificate *)generateCertificateWithParams:(NSDictionary *)params;
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCodecSpecificInfo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Implement this protocol to pass codec specific info from the encoder.
18 | * Corresponds to webrtc::CodecSpecificInfo.
19 | */
20 | RTC_OBJC_EXPORT
21 | @protocol RTCCodecSpecificInfo
22 | @end
23 |
24 | NS_ASSUME_NONNULL_END
25 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCodecSpecificInfoH264.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCCodecSpecificInfo.h"
14 | #import "RTCMacros.h"
15 |
16 | /** Class for H264 specific config. */
17 | typedef NS_ENUM(NSUInteger, RTCH264PacketizationMode) {
18 | RTCH264PacketizationModeNonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed
19 | RTCH264PacketizationModeSingleNalUnit // Mode 0 - only single NALU allowed
20 | };
21 |
22 | RTC_OBJC_EXPORT
23 | @interface RTCCodecSpecificInfoH264 : NSObject
24 |
25 | @property(nonatomic, assign) RTCH264PacketizationMode packetizationMode;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCCryptoOptions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /**
18 | * Objective-C bindings for webrtc::CryptoOptions. This API had to be flattened
19 | * as Objective-C doesn't support nested structures.
20 | */
21 | RTC_OBJC_EXPORT
22 | @interface RTCCryptoOptions : NSObject
23 |
24 | /**
25 | * Enable GCM crypto suites from RFC 7714 for SRTP. GCM will only be used
26 | * if both sides enable it
27 | */
28 | @property(nonatomic, assign) BOOL srtpEnableGcmCryptoSuites;
29 | /**
30 | * If set to true, the (potentially insecure) crypto cipher
31 | * SRTP_AES128_CM_SHA1_32 will be included in the list of supported ciphers
32 | * during negotiation. It will only be used if both peers support it and no
33 | * other ciphers get preferred.
34 | */
35 | @property(nonatomic, assign) BOOL srtpEnableAes128Sha1_32CryptoCipher;
36 | /**
37 | * If set to true, encrypted RTP header extensions as defined in RFC 6904
38 | * will be negotiated. They will only be used if both peers support them.
39 | */
40 | @property(nonatomic, assign) BOOL srtpEnableEncryptedRtpHeaderExtensions;
41 |
42 | /**
43 | * If set all RtpSenders must have an FrameEncryptor attached to them before
44 | * they are allowed to send packets. All RtpReceivers must have a
45 | * FrameDecryptor attached to them before they are able to receive packets.
46 | */
47 | @property(nonatomic, assign) BOOL sframeRequireFrameEncryption;
48 |
49 | /**
50 | * Initializes CryptoOptions with all possible options set explicitly. This
51 | * is done when converting from a native RTCConfiguration.crypto_options.
52 | */
53 | - (instancetype)initWithSrtpEnableGcmCryptoSuites:(BOOL)srtpEnableGcmCryptoSuites
54 | srtpEnableAes128Sha1_32CryptoCipher:(BOOL)srtpEnableAes128Sha1_32CryptoCipher
55 | srtpEnableEncryptedRtpHeaderExtensions:(BOOL)srtpEnableEncryptedRtpHeaderExtensions
56 | sframeRequireFrameEncryption:(BOOL)sframeRequireFrameEncryption
57 | NS_DESIGNATED_INITIALIZER;
58 |
59 | - (instancetype)init NS_UNAVAILABLE;
60 |
61 | @end
62 |
63 | NS_ASSUME_NONNULL_END
64 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDataChannel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | RTC_OBJC_EXPORT
19 | @interface RTCDataBuffer : NSObject
20 |
21 | /** NSData representation of the underlying buffer. */
22 | @property(nonatomic, readonly) NSData *data;
23 |
24 | /** Indicates whether |data| contains UTF-8 or binary data. */
25 | @property(nonatomic, readonly) BOOL isBinary;
26 |
27 | - (instancetype)init NS_UNAVAILABLE;
28 |
29 | /**
30 | * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data|
31 | * contains UTF-8 or binary data.
32 | */
33 | - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary;
34 |
35 | @end
36 |
37 | @class RTCDataChannel;
38 | RTC_OBJC_EXPORT
39 | @protocol RTCDataChannelDelegate
40 |
41 | /** The data channel state changed. */
42 | - (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel;
43 |
44 | /** The data channel successfully received a data buffer. */
45 | - (void)dataChannel:(RTCDataChannel *)dataChannel
46 | didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer;
47 |
48 | @optional
49 | /** The data channel's |bufferedAmount| changed. */
50 | - (void)dataChannel:(RTCDataChannel *)dataChannel didChangeBufferedAmount:(uint64_t)amount;
51 |
52 | @end
53 |
54 | /** Represents the state of the data channel. */
55 | typedef NS_ENUM(NSInteger, RTCDataChannelState) {
56 | RTCDataChannelStateConnecting,
57 | RTCDataChannelStateOpen,
58 | RTCDataChannelStateClosing,
59 | RTCDataChannelStateClosed,
60 | };
61 |
62 | RTC_OBJC_EXPORT
63 | @interface RTCDataChannel : NSObject
64 |
65 | /**
66 | * A label that can be used to distinguish this data channel from other data
67 | * channel objects.
68 | */
69 | @property(nonatomic, readonly) NSString *label;
70 |
71 | /** Whether the data channel can send messages in unreliable mode. */
72 | @property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE;
73 |
74 | /** Returns whether this data channel is ordered or not. */
75 | @property(nonatomic, readonly) BOOL isOrdered;
76 |
77 | /** Deprecated. Use maxPacketLifeTime. */
78 | @property(nonatomic, readonly) NSUInteger maxRetransmitTime DEPRECATED_ATTRIBUTE;
79 |
80 | /**
81 | * The length of the time window (in milliseconds) during which transmissions
82 | * and retransmissions may occur in unreliable mode.
83 | */
84 | @property(nonatomic, readonly) uint16_t maxPacketLifeTime;
85 |
86 | /**
87 | * The maximum number of retransmissions that are attempted in unreliable mode.
88 | */
89 | @property(nonatomic, readonly) uint16_t maxRetransmits;
90 |
91 | /**
92 | * The name of the sub-protocol used with this data channel, if any. Otherwise
93 | * this returns an empty string.
94 | */
95 | @property(nonatomic, readonly) NSString *protocol;
96 |
97 | /**
98 | * Returns whether this data channel was negotiated by the application or not.
99 | */
100 | @property(nonatomic, readonly) BOOL isNegotiated;
101 |
102 | /** Deprecated. Use channelId. */
103 | @property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE;
104 |
105 | /** The identifier for this data channel. */
106 | @property(nonatomic, readonly) int channelId;
107 |
108 | /** The state of the data channel. */
109 | @property(nonatomic, readonly) RTCDataChannelState readyState;
110 |
111 | /**
112 | * The number of bytes of application data that have been queued using
113 | * |sendData:| but that have not yet been transmitted to the network.
114 | */
115 | @property(nonatomic, readonly) uint64_t bufferedAmount;
116 |
117 | /** The delegate for this data channel. */
118 | @property(nonatomic, weak) id delegate;
119 |
120 | - (instancetype)init NS_UNAVAILABLE;
121 |
122 | /** Closes the data channel. */
123 | - (void)close;
124 |
125 | /** Attempt to send |data| on this data channel's underlying data transport. */
126 | - (BOOL)sendData:(RTCDataBuffer *)data;
127 |
128 | @end
129 |
130 | NS_ASSUME_NONNULL_END
131 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDataChannelConfiguration.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | RTC_OBJC_EXPORT
19 | @interface RTCDataChannelConfiguration : NSObject
20 |
21 | /** Set to YES if ordered delivery is required. */
22 | @property(nonatomic, assign) BOOL isOrdered;
23 |
24 | /** Deprecated. Use maxPacketLifeTime. */
25 | @property(nonatomic, assign) NSInteger maxRetransmitTimeMs DEPRECATED_ATTRIBUTE;
26 |
27 | /**
28 | * Max period in milliseconds in which retransmissions will be sent. After this
29 | * time, no more retransmissions will be sent. -1 if unset.
30 | */
31 | @property(nonatomic, assign) int maxPacketLifeTime;
32 |
33 | /** The max number of retransmissions. -1 if unset. */
34 | @property(nonatomic, assign) int maxRetransmits;
35 |
36 | /** Set to YES if the channel has been externally negotiated and we do not send
37 | * an in-band signalling in the form of an "open" message.
38 | */
39 | @property(nonatomic, assign) BOOL isNegotiated;
40 |
41 | /** Deprecated. Use channelId. */
42 | @property(nonatomic, assign) int streamId DEPRECATED_ATTRIBUTE;
43 |
44 | /** The id of the data channel. */
45 | @property(nonatomic, assign) int channelId;
46 |
47 | /** Set by the application and opaque to the WebRTC implementation. */
48 | @property(nonatomic) NSString* protocol;
49 |
50 | @end
51 |
52 | NS_ASSUME_NONNULL_END
53 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDefaultVideoDecoderFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoDecoderFactory.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** This decoder factory include support for all codecs bundled with WebRTC. If using custom
19 | * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory.
20 | */
21 | RTC_OBJC_EXPORT
22 | @interface RTCDefaultVideoDecoderFactory : NSObject
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDefaultVideoEncoderFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoEncoderFactory.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** This encoder factory include support for all codecs bundled with WebRTC. If using custom
19 | * codecs, create custom implementations of RTCVideoEncoderFactory and RTCVideoDecoderFactory.
20 | */
21 | RTC_OBJC_EXPORT
22 | @interface RTCDefaultVideoEncoderFactory : NSObject
23 |
24 | @property(nonatomic, retain) RTCVideoCodecInfo *preferredCodec;
25 |
26 | + (NSArray *)supportedCodecs;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDispatcher.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | typedef NS_ENUM(NSInteger, RTCDispatcherQueueType) {
16 | // Main dispatcher queue.
17 | RTCDispatcherTypeMain,
18 | // Used for starting/stopping AVCaptureSession, and assigning
19 | // capture session to AVCaptureVideoPreviewLayer.
20 | RTCDispatcherTypeCaptureSession,
21 | // Used for operations on AVAudioSession.
22 | RTCDispatcherTypeAudioSession,
23 | };
24 |
25 | /** Dispatcher that asynchronously dispatches blocks to a specific
26 | * shared dispatch queue.
27 | */
28 | RTC_OBJC_EXPORT
29 | @interface RTCDispatcher : NSObject
30 |
31 | - (instancetype)init NS_UNAVAILABLE;
32 |
33 | /** Dispatch the block asynchronously on the queue for dispatchType.
34 | * @param dispatchType The queue type to dispatch on.
35 | * @param block The block to dispatch asynchronously.
36 | */
37 | + (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType block:(dispatch_block_t)block;
38 |
39 | /** Returns YES if run on queue for the dispatchType otherwise NO.
40 | * Useful for asserting that a method is run on a correct queue.
41 | */
42 | + (BOOL)isOnQueueForType:(RTCDispatcherQueueType)dispatchType;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCDtmfSender.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @protocol RTCDtmfSender
19 |
20 | /**
21 | * Returns true if this RTCDtmfSender is capable of sending DTMF. Otherwise
22 | * returns false. To be able to send DTMF, the associated RTCRtpSender must be
23 | * able to send packets, and a "telephone-event" codec must be negotiated.
24 | */
25 | @property(nonatomic, readonly) BOOL canInsertDtmf;
26 |
27 | /**
28 | * Queues a task that sends the DTMF tones. The tones parameter is treated
29 | * as a series of characters. The characters 0 through 9, A through D, #, and *
30 | * generate the associated DTMF tones. The characters a to d are equivalent
31 | * to A to D. The character ',' indicates a delay of 2 seconds before
32 | * processing the next character in the tones parameter.
33 | *
34 | * Unrecognized characters are ignored.
35 | *
36 | * @param duration The parameter indicates the duration to use for each
37 | * character passed in the tones parameter. The duration cannot be more
38 | * than 6000 or less than 70 ms.
39 | *
40 | * @param interToneGap The parameter indicates the gap between tones.
41 | * This parameter must be at least 50 ms but should be as short as
42 | * possible.
43 | *
44 | * If InsertDtmf is called on the same object while an existing task for this
45 | * object to generate DTMF is still running, the previous task is canceled.
46 | * Returns true on success and false on failure.
47 | */
48 | - (BOOL)insertDtmf:(nonnull NSString *)tones
49 | duration:(NSTimeInterval)duration
50 | interToneGap:(NSTimeInterval)interToneGap;
51 |
52 | /** The tones remaining to be played out */
53 | - (nonnull NSString *)remainingTones;
54 |
55 | /**
56 | * The current tone duration value. This value will be the value last set via the
57 | * insertDtmf method, or the default value of 100 ms if insertDtmf was never called.
58 | */
59 | - (NSTimeInterval)duration;
60 |
61 | /**
62 | * The current value of the between-tone gap. This value will be the value last set
63 | * via the insertDtmf() method, or the default value of 50 ms if insertDtmf() was never
64 | * called.
65 | */
66 | - (NSTimeInterval)interToneGap;
67 |
68 | @end
69 |
70 | NS_ASSUME_NONNULL_END
71 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCEAGLVideoView.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 | #import "RTCVideoRenderer.h"
16 | #import "RTCVideoViewShading.h"
17 |
18 | NS_ASSUME_NONNULL_BEGIN
19 |
20 | @class RTCEAGLVideoView;
21 |
22 | /**
23 | * RTCEAGLVideoView is an RTCVideoRenderer which renders video frames in its
24 | * bounds using OpenGLES 2.0 or OpenGLES 3.0.
25 | */
26 | RTC_OBJC_EXPORT
27 | NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.")
28 | @interface RTCEAGLVideoView : UIView
29 |
30 | @property(nonatomic, weak) id delegate;
31 |
32 | - (instancetype)initWithFrame:(CGRect)frame
33 | shader:(id)shader NS_DESIGNATED_INITIALIZER;
34 |
35 | - (instancetype)initWithCoder:(NSCoder *)aDecoder
36 | shader:(id)shader NS_DESIGNATED_INITIALIZER;
37 |
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCEncodedImage.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoFrame.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** Represents an encoded frame's type. */
19 | typedef NS_ENUM(NSUInteger, RTCFrameType) {
20 | RTCFrameTypeEmptyFrame = 0,
21 | RTCFrameTypeAudioFrameSpeech = 1,
22 | RTCFrameTypeAudioFrameCN = 2,
23 | RTCFrameTypeVideoFrameKey = 3,
24 | RTCFrameTypeVideoFrameDelta = 4,
25 | };
26 |
27 | typedef NS_ENUM(NSUInteger, RTCVideoContentType) {
28 | RTCVideoContentTypeUnspecified,
29 | RTCVideoContentTypeScreenshare,
30 | };
31 |
32 | /** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */
33 | RTC_OBJC_EXPORT
34 | @interface RTCEncodedImage : NSObject
35 |
36 | @property(nonatomic, strong) NSData *buffer;
37 | @property(nonatomic, assign) int32_t encodedWidth;
38 | @property(nonatomic, assign) int32_t encodedHeight;
39 | @property(nonatomic, assign) uint32_t timeStamp;
40 | @property(nonatomic, assign) int64_t captureTimeMs;
41 | @property(nonatomic, assign) int64_t ntpTimeMs;
42 | @property(nonatomic, assign) uint8_t flags;
43 | @property(nonatomic, assign) int64_t encodeStartMs;
44 | @property(nonatomic, assign) int64_t encodeFinishMs;
45 | @property(nonatomic, assign) RTCFrameType frameType;
46 | @property(nonatomic, assign) RTCVideoRotation rotation;
47 | @property(nonatomic, assign) BOOL completeFrame;
48 | @property(nonatomic, strong) NSNumber *qp;
49 | @property(nonatomic, assign) RTCVideoContentType contentType;
50 |
51 | @end
52 |
53 | NS_ASSUME_NONNULL_END
54 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCFieldTrials.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | /** The only valid value for the following if set is kRTCFieldTrialEnabledValue. */
16 | RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweKey;
17 | RTC_EXTERN NSString * const kRTCFieldTrialAudioForceNoTWCCKey;
18 | RTC_EXTERN NSString * const kRTCFieldTrialAudioForceABWENoTWCCKey;
19 | RTC_EXTERN NSString * const kRTCFieldTrialSendSideBweWithOverheadKey;
20 | RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey;
21 | RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key;
22 | RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey;
23 | RTC_EXTERN NSString * const kRTCFieldTrialMinimizeResamplingOnMobileKey;
24 |
25 | /** The valid value for field trials above. */
26 | RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue;
27 |
28 | /** Initialize field trials using a dictionary mapping field trial keys to their
29 | * values. See above for valid keys and values. Must be called before any other
30 | * call into WebRTC. See: webrtc/system_wrappers/include/field_trial.h
31 | */
32 | RTC_EXTERN void RTCInitFieldTrialDictionary(NSDictionary *fieldTrials);
33 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCFileLogger.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) {
16 | RTCFileLoggerSeverityVerbose,
17 | RTCFileLoggerSeverityInfo,
18 | RTCFileLoggerSeverityWarning,
19 | RTCFileLoggerSeverityError
20 | };
21 |
22 | typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) {
23 | RTCFileLoggerTypeCall,
24 | RTCFileLoggerTypeApp,
25 | };
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | // This class intercepts WebRTC logs and saves them to a file. The file size
30 | // will not exceed the given maximum bytesize. When the maximum bytesize is
31 | // reached, logs are rotated according to the rotationType specified.
32 | // For kRTCFileLoggerTypeCall, logs from the beginning and the end
33 | // are preserved while the middle section is overwritten instead.
34 | // For kRTCFileLoggerTypeApp, the oldest log is overwritten.
35 | // This class is not threadsafe.
36 | RTC_OBJC_EXPORT
37 | @interface RTCFileLogger : NSObject
38 |
39 | // The severity level to capture. The default is kRTCFileLoggerSeverityInfo.
40 | @property(nonatomic, assign) RTCFileLoggerSeverity severity;
41 |
42 | // The rotation type for this file logger. The default is
43 | // kRTCFileLoggerTypeCall.
44 | @property(nonatomic, readonly) RTCFileLoggerRotationType rotationType;
45 |
46 | // Disables buffering disk writes. Should be set before |start|. Buffering
47 | // is enabled by default for performance.
48 | @property(nonatomic, assign) BOOL shouldDisableBuffering;
49 |
50 | // Default constructor provides default settings for dir path, file size and
51 | // rotation type.
52 | - (instancetype)init;
53 |
54 | // Create file logger with default rotation type.
55 | - (instancetype)initWithDirPath:(NSString *)dirPath maxFileSize:(NSUInteger)maxFileSize;
56 |
57 | - (instancetype)initWithDirPath:(NSString *)dirPath
58 | maxFileSize:(NSUInteger)maxFileSize
59 | rotationType:(RTCFileLoggerRotationType)rotationType NS_DESIGNATED_INITIALIZER;
60 |
61 | // Starts writing WebRTC logs to disk if not already started. Overwrites any
62 | // existing file(s).
63 | - (void)start;
64 |
65 | // Stops writing WebRTC logs to disk. This method is also called on dealloc.
66 | - (void)stop;
67 |
68 | // Returns the current contents of the logs, or nil if start has been called
69 | // without a stop.
70 | - (nullable NSData *)logData;
71 |
72 | @end
73 |
74 | NS_ASSUME_NONNULL_END
75 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCFileVideoCapturer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCVideoCapturer.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /**
18 | * Error passing block.
19 | */
20 | typedef void (^RTCFileVideoCapturerErrorBlock)(NSError *error);
21 |
22 | /**
23 | * Captures buffers from bundled video file.
24 | *
25 | * See @c RTCVideoCapturer for more info on capturers.
26 | */
27 | RTC_OBJC_EXPORT
28 |
29 | NS_CLASS_AVAILABLE_IOS(10)
30 | @interface RTCFileVideoCapturer : RTCVideoCapturer
31 |
32 | /**
33 | * Starts asynchronous capture of frames from video file.
34 | *
35 | * Capturing is not started if error occurs. Underlying error will be
36 | * relayed in the errorBlock if one is provided.
37 | * Successfully captured video frames will be passed to the delegate.
38 | *
39 | * @param nameOfFile The name of the bundled video file to be read.
40 | * @errorBlock block to be executed upon error.
41 | */
42 | - (void)startCapturingFromFileNamed:(NSString *)nameOfFile
43 | onError:(__nullable RTCFileVideoCapturerErrorBlock)errorBlock;
44 |
45 | /**
46 | * Immediately stops capture.
47 | */
48 | - (void)stopCapture;
49 | @end
50 |
51 | NS_ASSUME_NONNULL_END
52 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCH264ProfileLevelId.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | RTC_OBJC_EXPORT extern NSString *const kRTCVideoCodecH264Name;
16 | RTC_OBJC_EXPORT extern NSString *const kRTCLevel31ConstrainedHigh;
17 | RTC_OBJC_EXPORT extern NSString *const kRTCLevel31ConstrainedBaseline;
18 | RTC_OBJC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedHigh;
19 | RTC_OBJC_EXPORT extern NSString *const kRTCMaxSupportedH264ProfileLevelConstrainedBaseline;
20 |
21 | /** H264 Profiles and levels. */
22 | typedef NS_ENUM(NSUInteger, RTCH264Profile) {
23 | RTCH264ProfileConstrainedBaseline,
24 | RTCH264ProfileBaseline,
25 | RTCH264ProfileMain,
26 | RTCH264ProfileConstrainedHigh,
27 | RTCH264ProfileHigh,
28 | };
29 |
30 | typedef NS_ENUM(NSUInteger, RTCH264Level) {
31 | RTCH264Level1_b = 0,
32 | RTCH264Level1 = 10,
33 | RTCH264Level1_1 = 11,
34 | RTCH264Level1_2 = 12,
35 | RTCH264Level1_3 = 13,
36 | RTCH264Level2 = 20,
37 | RTCH264Level2_1 = 21,
38 | RTCH264Level2_2 = 22,
39 | RTCH264Level3 = 30,
40 | RTCH264Level3_1 = 31,
41 | RTCH264Level3_2 = 32,
42 | RTCH264Level4 = 40,
43 | RTCH264Level4_1 = 41,
44 | RTCH264Level4_2 = 42,
45 | RTCH264Level5 = 50,
46 | RTCH264Level5_1 = 51,
47 | RTCH264Level5_2 = 52
48 | };
49 |
50 | RTC_OBJC_EXPORT
51 | @interface RTCH264ProfileLevelId : NSObject
52 |
53 | @property(nonatomic, readonly) RTCH264Profile profile;
54 | @property(nonatomic, readonly) RTCH264Level level;
55 | @property(nonatomic, readonly) NSString *hexString;
56 |
57 | - (instancetype)initWithHexString:(NSString *)hexString;
58 | - (instancetype)initWithProfile:(RTCH264Profile)profile level:(RTCH264Level)level;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCI420Buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCYUVPlanarBuffer.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Protocol for RTCYUVPlanarBuffers containing I420 data */
18 | RTC_OBJC_EXPORT
19 | @protocol RTCI420Buffer
20 | @end
21 |
22 | NS_ASSUME_NONNULL_END
23 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCIceCandidate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCIceCandidate : NSObject
19 |
20 | /**
21 | * If present, the identifier of the "media stream identification" for the media
22 | * component this candidate is associated with.
23 | */
24 | @property(nonatomic, readonly, nullable) NSString *sdpMid;
25 |
26 | /**
27 | * The index (starting at zero) of the media description this candidate is
28 | * associated with in the SDP.
29 | */
30 | @property(nonatomic, readonly) int sdpMLineIndex;
31 |
32 | /** The SDP string for this candidate. */
33 | @property(nonatomic, readonly) NSString *sdp;
34 |
35 | /** The URL of the ICE server which this candidate is gathered from. */
36 | @property(nonatomic, readonly, nullable) NSString *serverUrl;
37 |
38 | - (instancetype)init NS_UNAVAILABLE;
39 |
40 | /**
41 | * Initialize an RTCIceCandidate from SDP.
42 | */
43 | - (instancetype)initWithSdp:(NSString *)sdp
44 | sdpMLineIndex:(int)sdpMLineIndex
45 | sdpMid:(nullable NSString *)sdpMid NS_DESIGNATED_INITIALIZER;
46 |
47 | @end
48 |
49 | NS_ASSUME_NONNULL_END
50 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCIceServer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) {
16 | RTCTlsCertPolicySecure,
17 | RTCTlsCertPolicyInsecureNoCheck
18 | };
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | RTC_OBJC_EXPORT
23 | @interface RTCIceServer : NSObject
24 |
25 | /** URI(s) for this server represented as NSStrings. */
26 | @property(nonatomic, readonly) NSArray *urlStrings;
27 |
28 | /** Username to use if this RTCIceServer object is a TURN server. */
29 | @property(nonatomic, readonly, nullable) NSString *username;
30 |
31 | /** Credential to use if this RTCIceServer object is a TURN server. */
32 | @property(nonatomic, readonly, nullable) NSString *credential;
33 |
34 | /**
35 | * TLS certificate policy to use if this RTCIceServer object is a TURN server.
36 | */
37 | @property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
38 |
39 | /**
40 | If the URIs in |urls| only contain IP addresses, this field can be used
41 | to indicate the hostname, which may be necessary for TLS (using the SNI
42 | extension). If |urls| itself contains the hostname, this isn't necessary.
43 | */
44 | @property(nonatomic, readonly, nullable) NSString *hostname;
45 |
46 | /** List of protocols to be used in the TLS ALPN extension. */
47 | @property(nonatomic, readonly) NSArray *tlsAlpnProtocols;
48 |
49 | /**
50 | List elliptic curves to be used in the TLS elliptic curves extension.
51 | Only curve names supported by OpenSSL should be used (eg. "P-256","X25519").
52 | */
53 | @property(nonatomic, readonly) NSArray *tlsEllipticCurves;
54 |
55 | - (nonnull instancetype)init NS_UNAVAILABLE;
56 |
57 | /** Convenience initializer for a server with no authentication (e.g. STUN). */
58 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings;
59 |
60 | /**
61 | * Initialize an RTCIceServer with its associated URLs, optional username,
62 | * optional credential, and credentialType.
63 | */
64 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings
65 | username:(nullable NSString *)username
66 | credential:(nullable NSString *)credential;
67 |
68 | /**
69 | * Initialize an RTCIceServer with its associated URLs, optional username,
70 | * optional credential, and TLS cert policy.
71 | */
72 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings
73 | username:(nullable NSString *)username
74 | credential:(nullable NSString *)credential
75 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy;
76 |
77 | /**
78 | * Initialize an RTCIceServer with its associated URLs, optional username,
79 | * optional credential, TLS cert policy and hostname.
80 | */
81 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings
82 | username:(nullable NSString *)username
83 | credential:(nullable NSString *)credential
84 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
85 | hostname:(nullable NSString *)hostname;
86 |
87 | /**
88 | * Initialize an RTCIceServer with its associated URLs, optional username,
89 | * optional credential, TLS cert policy, hostname and ALPN protocols.
90 | */
91 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings
92 | username:(nullable NSString *)username
93 | credential:(nullable NSString *)credential
94 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
95 | hostname:(nullable NSString *)hostname
96 | tlsAlpnProtocols:(NSArray *)tlsAlpnProtocols;
97 |
98 | /**
99 | * Initialize an RTCIceServer with its associated URLs, optional username,
100 | * optional credential, TLS cert policy, hostname, ALPN protocols and
101 | * elliptic curves.
102 | */
103 | - (instancetype)initWithURLStrings:(NSArray *)urlStrings
104 | username:(nullable NSString *)username
105 | credential:(nullable NSString *)credential
106 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
107 | hostname:(nullable NSString *)hostname
108 | tlsAlpnProtocols:(nullable NSArray *)tlsAlpnProtocols
109 | tlsEllipticCurves:(nullable NSArray *)tlsEllipticCurves
110 | NS_DESIGNATED_INITIALIZER;
111 |
112 | @end
113 |
114 | NS_ASSUME_NONNULL_END
115 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCIntervalRange.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | NS_ASSUME_NONNULL_BEGIN
14 |
15 | @interface RTCIntervalRange : NSObject
16 |
17 | @property(nonatomic, readonly) NSInteger min;
18 | @property(nonatomic, readonly) NSInteger max;
19 |
20 | - (instancetype)init;
21 | - (instancetype)initWithMin:(NSInteger)min max:(NSInteger)max NS_DESIGNATED_INITIALIZER;
22 |
23 | @end
24 |
25 | NS_ASSUME_NONNULL_END
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCLegacyStatsReport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** This does not currently conform to the spec. */
18 | RTC_OBJC_EXPORT
19 | @interface RTCLegacyStatsReport : NSObject
20 |
21 | /** Time since 1970-01-01T00:00:00Z in milliseconds. */
22 | @property(nonatomic, readonly) CFTimeInterval timestamp;
23 |
24 | /** The type of stats held by this object. */
25 | @property(nonatomic, readonly) NSString *type;
26 |
27 | /** The identifier for this object. */
28 | @property(nonatomic, readonly) NSString *reportId;
29 |
30 | /** A dictionary holding the actual stats. */
31 | @property(nonatomic, readonly) NSDictionary *values;
32 |
33 | - (instancetype)init NS_UNAVAILABLE;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCLogging.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | // Subset of rtc::LoggingSeverity.
16 | typedef NS_ENUM(NSInteger, RTCLoggingSeverity) {
17 | RTCLoggingSeverityVerbose,
18 | RTCLoggingSeverityInfo,
19 | RTCLoggingSeverityWarning,
20 | RTCLoggingSeverityError,
21 | RTCLoggingSeverityNone,
22 | };
23 |
24 | // Wrapper for C++ RTC_LOG(sev) macros.
25 | // Logs the log string to the webrtc logstream for the given severity.
26 | RTC_EXTERN void RTCLogEx(RTCLoggingSeverity severity, NSString* log_string);
27 |
28 | // Wrapper for rtc::LogMessage::LogToDebug.
29 | // Sets the minimum severity to be logged to console.
30 | RTC_EXTERN void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity);
31 |
32 | // Returns the filename with the path prefix removed.
33 | RTC_EXTERN NSString* RTCFileName(const char* filePath);
34 |
35 | // Some convenience macros.
36 |
37 | #define RTCLogString(format, ...) \
38 | [NSString stringWithFormat:@"(%@:%d %s): " format, RTCFileName(__FILE__), \
39 | __LINE__, __FUNCTION__, ##__VA_ARGS__]
40 |
41 | #define RTCLogFormat(severity, format, ...) \
42 | do { \
43 | NSString* log_string = RTCLogString(format, ##__VA_ARGS__); \
44 | RTCLogEx(severity, log_string); \
45 | } while (false)
46 |
47 | #define RTCLogVerbose(format, ...) \
48 | RTCLogFormat(RTCLoggingSeverityVerbose, format, ##__VA_ARGS__)
49 |
50 | #define RTCLogInfo(format, ...) \
51 | RTCLogFormat(RTCLoggingSeverityInfo, format, ##__VA_ARGS__)
52 |
53 | #define RTCLogWarning(format, ...) \
54 | RTCLogFormat(RTCLoggingSeverityWarning, format, ##__VA_ARGS__)
55 |
56 | #define RTCLogError(format, ...) \
57 | RTCLogFormat(RTCLoggingSeverityError, format, ##__VA_ARGS__)
58 |
59 | #if !defined(NDEBUG)
60 | #define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__)
61 | #else
62 | #define RTCLogDebug(format, ...) \
63 | do { \
64 | } while (false)
65 | #endif
66 |
67 | #define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__)
68 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMTLVideoView.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoFrame.h"
15 | #import "RTCVideoRenderer.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /**
20 | * RTCMTLVideoView is thin wrapper around MTKView.
21 | *
22 | * It has id property that renders video frames in the view's
23 | * bounds using Metal.
24 | * NOTE: always check if metal is available on the running device via
25 | * RTC_SUPPORTS_METAL macro before initializing this class.
26 | */
27 | NS_CLASS_AVAILABLE_IOS(9)
28 |
29 | RTC_OBJC_EXPORT
30 | @interface RTCMTLVideoView : UIView
31 |
32 | @property(nonatomic, weak) id delegate;
33 |
34 | @property(nonatomic) UIViewContentMode videoContentMode;
35 |
36 | /** @abstract Enables/disables rendering.
37 | */
38 | @property(nonatomic, getter=isEnabled) BOOL enabled;
39 |
40 | /** @abstract Wrapped RTCVideoRotation, or nil.
41 | */
42 | @property(nonatomic, nullable) NSValue* rotationOverride;
43 |
44 | @end
45 |
46 | NS_ASSUME_NONNULL_END
47 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMacros.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #ifndef SDK_OBJC_BASE_RTCMACROS_H_
12 | #define SDK_OBJC_BASE_RTCMACROS_H_
13 |
14 | #define RTC_OBJC_EXPORT __attribute__((visibility("default")))
15 |
16 | #if defined(__cplusplus)
17 | #define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
18 | #else
19 | #define RTC_EXTERN extern RTC_OBJC_EXPORT
20 | #endif
21 |
22 | #ifdef __OBJC__
23 | #define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
24 | #else
25 | #define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
26 | #endif
27 |
28 | #endif // SDK_OBJC_BASE_RTCMACROS_H_
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMediaConstraints.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Constraint keys for media sources. */
18 | /** The value for this key should be a base64 encoded string containing
19 | * the data from the serialized configuration proto.
20 | */
21 | RTC_EXTERN NSString *const kRTCMediaConstraintsAudioNetworkAdaptorConfig;
22 |
23 | /** Constraint keys for generating offers and answers. */
24 | RTC_EXTERN NSString *const kRTCMediaConstraintsIceRestart;
25 | RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveAudio;
26 | RTC_EXTERN NSString *const kRTCMediaConstraintsOfferToReceiveVideo;
27 | RTC_EXTERN NSString *const kRTCMediaConstraintsVoiceActivityDetection;
28 |
29 | /** Constraint values for Boolean parameters. */
30 | RTC_EXTERN NSString *const kRTCMediaConstraintsValueTrue;
31 | RTC_EXTERN NSString *const kRTCMediaConstraintsValueFalse;
32 |
33 | RTC_OBJC_EXPORT
34 | @interface RTCMediaConstraints : NSObject
35 |
36 | - (instancetype)init NS_UNAVAILABLE;
37 |
38 | /** Initialize with mandatory and/or optional constraints. */
39 | - (instancetype)
40 | initWithMandatoryConstraints:(nullable NSDictionary *)mandatory
41 | optionalConstraints:(nullable NSDictionary *)optional
42 | NS_DESIGNATED_INITIALIZER;
43 |
44 | @end
45 |
46 | NS_ASSUME_NONNULL_END
47 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMediaSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | typedef NS_ENUM(NSInteger, RTCSourceState) {
16 | RTCSourceStateInitializing,
17 | RTCSourceStateLive,
18 | RTCSourceStateEnded,
19 | RTCSourceStateMuted,
20 | };
21 |
22 | NS_ASSUME_NONNULL_BEGIN
23 |
24 | RTC_OBJC_EXPORT
25 | @interface RTCMediaSource : NSObject
26 |
27 | /** The current state of the RTCMediaSource. */
28 | @property(nonatomic, readonly) RTCSourceState state;
29 |
30 | - (instancetype)init NS_UNAVAILABLE;
31 |
32 | @end
33 |
34 | NS_ASSUME_NONNULL_END
35 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMediaStream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class RTCAudioTrack;
18 | @class RTCPeerConnectionFactory;
19 | @class RTCVideoTrack;
20 |
21 | RTC_OBJC_EXPORT
22 | @interface RTCMediaStream : NSObject
23 |
24 | /** The audio tracks in this stream. */
25 | @property(nonatomic, strong, readonly) NSArray *audioTracks;
26 |
27 | /** The video tracks in this stream. */
28 | @property(nonatomic, strong, readonly) NSArray *videoTracks;
29 |
30 | /** An identifier for this media stream. */
31 | @property(nonatomic, readonly) NSString *streamId;
32 |
33 | - (instancetype)init NS_UNAVAILABLE;
34 |
35 | /** Adds the given audio track to this media stream. */
36 | - (void)addAudioTrack:(RTCAudioTrack *)audioTrack;
37 |
38 | /** Adds the given video track to this media stream. */
39 | - (void)addVideoTrack:(RTCVideoTrack *)videoTrack;
40 |
41 | /** Removes the given audio track to this media stream. */
42 | - (void)removeAudioTrack:(RTCAudioTrack *)audioTrack;
43 |
44 | /** Removes the given video track to this media stream. */
45 | - (void)removeVideoTrack:(RTCVideoTrack *)videoTrack;
46 |
47 | @end
48 |
49 | NS_ASSUME_NONNULL_END
50 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMediaStreamTrack.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | /**
16 | * Represents the state of the track. This exposes the same states in C++.
17 | */
18 | typedef NS_ENUM(NSInteger, RTCMediaStreamTrackState) {
19 | RTCMediaStreamTrackStateLive,
20 | RTCMediaStreamTrackStateEnded
21 | };
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | RTC_EXTERN NSString *const kRTCMediaStreamTrackKindAudio;
26 | RTC_EXTERN NSString *const kRTCMediaStreamTrackKindVideo;
27 |
28 | RTC_OBJC_EXPORT
29 | @interface RTCMediaStreamTrack : NSObject
30 |
31 | /**
32 | * The kind of track. For example, "audio" if this track represents an audio
33 | * track and "video" if this track represents a video track.
34 | */
35 | @property(nonatomic, readonly) NSString *kind;
36 |
37 | /** An identifier string. */
38 | @property(nonatomic, readonly) NSString *trackId;
39 |
40 | /** The enabled state of the track. */
41 | @property(nonatomic, assign) BOOL isEnabled;
42 |
43 | /** The state of the track. */
44 | @property(nonatomic, readonly) RTCMediaStreamTrackState readyState;
45 |
46 | - (instancetype)init NS_UNAVAILABLE;
47 |
48 | @end
49 |
50 | NS_ASSUME_NONNULL_END
51 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMetrics.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCMetricsSampleInfo.h"
15 |
16 | /**
17 | * Enables gathering of metrics (which can be fetched with
18 | * RTCGetAndResetMetrics). Must be called before any other call into WebRTC.
19 | */
20 | RTC_EXTERN void RTCEnableMetrics(void);
21 |
22 | /** Gets and clears native histograms. */
23 | RTC_EXTERN NSArray* RTCGetAndResetMetrics(void);
24 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMetricsSampleInfo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCMetricsSampleInfo : NSObject
19 |
20 | /**
21 | * Example of RTCMetricsSampleInfo:
22 | * name: "WebRTC.Video.InputFramesPerSecond"
23 | * min: 1
24 | * max: 100
25 | * bucketCount: 50
26 | * samples: [29]:2 [30]:1
27 | */
28 |
29 | /** The name of the histogram. */
30 | @property(nonatomic, readonly) NSString *name;
31 |
32 | /** The minimum bucket value. */
33 | @property(nonatomic, readonly) int min;
34 |
35 | /** The maximum bucket value. */
36 | @property(nonatomic, readonly) int max;
37 |
38 | /** The number of buckets. */
39 | @property(nonatomic, readonly) int bucketCount;
40 |
41 | /** A dictionary holding the samples . */
42 | @property(nonatomic, readonly) NSDictionary *samples;
43 |
44 | - (instancetype)init NS_UNAVAILABLE;
45 |
46 | @end
47 |
48 | NS_ASSUME_NONNULL_END
49 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMutableI420Buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCI420Buffer.h"
14 | #import "RTCMutableYUVPlanarBuffer.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** Extension of the I420 buffer with mutable data access */
19 | RTC_OBJC_EXPORT
20 | @protocol RTCMutableI420Buffer
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCMutableYUVPlanarBuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCYUVPlanarBuffer.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Extension of the YUV planar data buffer with mutable data access */
18 | RTC_OBJC_EXPORT
19 | @protocol RTCMutableYUVPlanarBuffer
20 |
21 | @property(nonatomic, readonly) uint8_t *mutableDataY;
22 | @property(nonatomic, readonly) uint8_t *mutableDataU;
23 | @property(nonatomic, readonly) uint8_t *mutableDataV;
24 |
25 | @end
26 |
27 | NS_ASSUME_NONNULL_END
28 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCNativeI420Buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCI420Buffer.h"
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** RTCI420Buffer implements the RTCI420Buffer protocol */
19 | RTC_OBJC_EXPORT
20 | @interface RTCI420Buffer : NSObject
21 | @end
22 |
23 | NS_ASSUME_NONNULL_END
24 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCNativeMutableI420Buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCMutableI420Buffer.h"
15 | #import "RTCNativeI420Buffer.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /** Mutable version of RTCI420Buffer */
20 | RTC_OBJC_EXPORT
21 | @interface RTCMutableI420Buffer : RTCI420Buffer
22 | @end
23 |
24 | NS_ASSUME_NONNULL_END
25 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCPeerConnectionFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class RTCAudioSource;
18 | @class RTCAudioTrack;
19 | @class RTCConfiguration;
20 | @class RTCMediaConstraints;
21 | @class RTCMediaStream;
22 | @class RTCPeerConnection;
23 | @class RTCVideoSource;
24 | @class RTCVideoTrack;
25 | @class RTCPeerConnectionFactoryOptions;
26 | @protocol RTCPeerConnectionDelegate;
27 | @protocol RTCVideoDecoderFactory;
28 | @protocol RTCVideoEncoderFactory;
29 |
30 | RTC_OBJC_EXPORT
31 | @interface RTCPeerConnectionFactory : NSObject
32 |
33 | /* Initialize object with default H264 video encoder/decoder factories */
34 | - (instancetype)init;
35 |
36 | /* Initialize object with injectable video encoder/decoder factories */
37 | - (instancetype)initWithEncoderFactory:(nullable id)encoderFactory
38 | decoderFactory:(nullable id)decoderFactory;
39 |
40 | /** Initialize an RTCAudioSource with constraints. */
41 | - (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints;
42 |
43 | /** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source with no
44 | * constraints.
45 | */
46 | - (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId;
47 |
48 | /** Initialize an RTCAudioTrack with a source and an id. */
49 | - (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source trackId:(NSString *)trackId;
50 |
51 | /** Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer
52 | * implementation, e.g. RTCCameraVideoCapturer, in order to produce frames.
53 | */
54 | - (RTCVideoSource *)videoSource;
55 |
56 | /** Initialize an RTCVideoTrack with a source and an id. */
57 | - (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source trackId:(NSString *)trackId;
58 |
59 | /** Initialize an RTCMediaStream with an id. */
60 | - (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId;
61 |
62 | /** Initialize an RTCPeerConnection with a configuration, constraints, and
63 | * delegate.
64 | */
65 | - (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration
66 | constraints:(RTCMediaConstraints *)constraints
67 | delegate:
68 | (nullable id)delegate;
69 |
70 | /** Set the options to be used for subsequently created RTCPeerConnections */
71 | - (void)setOptions:(nonnull RTCPeerConnectionFactoryOptions *)options;
72 |
73 | /** Start an AecDump recording. This API call will likely change in the future. */
74 | - (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes;
75 |
76 | /* Stop an active AecDump recording */
77 | - (void)stopAecDump;
78 |
79 | @end
80 |
81 | NS_ASSUME_NONNULL_END
82 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCPeerConnectionFactoryOptions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCPeerConnectionFactoryOptions : NSObject
19 |
20 | @property(nonatomic, assign) BOOL disableEncryption;
21 |
22 | @property(nonatomic, assign) BOOL disableNetworkMonitor;
23 |
24 | @property(nonatomic, assign) BOOL ignoreLoopbackNetworkAdapter;
25 |
26 | @property(nonatomic, assign) BOOL ignoreVPNNetworkAdapter;
27 |
28 | @property(nonatomic, assign) BOOL ignoreCellularNetworkAdapter;
29 |
30 | @property(nonatomic, assign) BOOL ignoreWiFiNetworkAdapter;
31 |
32 | @property(nonatomic, assign) BOOL ignoreEthernetNetworkAdapter;
33 |
34 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
35 |
36 | @end
37 |
38 | NS_ASSUME_NONNULL_END
39 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtcpParameters.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCRtcpParameters : NSObject
19 |
20 | /** The Canonical Name used by RTCP. */
21 | @property(nonatomic, readonly, copy) NSString *cname;
22 |
23 | /** Whether reduced size RTCP is configured or compound RTCP. */
24 | @property(nonatomic, assign) BOOL isReducedSize;
25 |
26 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpCodecParameters.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_EXTERN const NSString *const kRTCRtxCodecName;
18 | RTC_EXTERN const NSString *const kRTCRedCodecName;
19 | RTC_EXTERN const NSString *const kRTCUlpfecCodecName;
20 | RTC_EXTERN const NSString *const kRTCFlexfecCodecName;
21 | RTC_EXTERN const NSString *const kRTCOpusCodecName;
22 | RTC_EXTERN const NSString *const kRTCIsacCodecName;
23 | RTC_EXTERN const NSString *const kRTCL16CodecName;
24 | RTC_EXTERN const NSString *const kRTCG722CodecName;
25 | RTC_EXTERN const NSString *const kRTCIlbcCodecName;
26 | RTC_EXTERN const NSString *const kRTCPcmuCodecName;
27 | RTC_EXTERN const NSString *const kRTCPcmaCodecName;
28 | RTC_EXTERN const NSString *const kRTCDtmfCodecName;
29 | RTC_EXTERN const NSString *const kRTCComfortNoiseCodecName;
30 | RTC_EXTERN const NSString *const kRTCVp8CodecName;
31 | RTC_EXTERN const NSString *const kRTCVp9CodecName;
32 | RTC_EXTERN const NSString *const kRTCH264CodecName;
33 |
34 | /** Defined in http://w3c.github.io/webrtc-pc/#idl-def-RTCRtpCodecParameters */
35 | RTC_OBJC_EXPORT
36 | @interface RTCRtpCodecParameters : NSObject
37 |
38 | /** The RTP payload type. */
39 | @property(nonatomic, assign) int payloadType;
40 |
41 | /**
42 | * The codec MIME subtype. Valid types are listed in:
43 | * http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2
44 | *
45 | * Several supported types are represented by the constants above.
46 | */
47 | @property(nonatomic, readonly, nonnull) NSString *name;
48 |
49 | /**
50 | * The media type of this codec. Equivalent to MIME top-level type.
51 | *
52 | * Valid values are kRTCMediaStreamTrackKindAudio and
53 | * kRTCMediaStreamTrackKindVideo.
54 | */
55 | @property(nonatomic, readonly, nonnull) NSString *kind;
56 |
57 | /** The codec clock rate expressed in Hertz. */
58 | @property(nonatomic, readonly, nullable) NSNumber *clockRate;
59 |
60 | /**
61 | * The number of channels (mono=1, stereo=2).
62 | * Set to null for video codecs.
63 | **/
64 | @property(nonatomic, readonly, nullable) NSNumber *numChannels;
65 |
66 | /** The "format specific parameters" field from the "a=fmtp" line in the SDP */
67 | @property(nonatomic, readonly, nonnull) NSDictionary *parameters;
68 |
69 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
70 |
71 | @end
72 |
73 | NS_ASSUME_NONNULL_END
74 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpEncodingParameters.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCRtpEncodingParameters : NSObject
19 |
20 | /** The idenfifier for the encoding layer. This is used in simulcast. */
21 | @property(nonatomic, copy, nullable) NSString *rid;
22 |
23 | /** Controls whether the encoding is currently transmitted. */
24 | @property(nonatomic, assign) BOOL isActive;
25 |
26 | /** The maximum bitrate to use for the encoding, or nil if there is no
27 | * limit.
28 | */
29 | @property(nonatomic, copy, nullable) NSNumber *maxBitrateBps;
30 |
31 | /** The minimum bitrate to use for the encoding, or nil if there is no
32 | * limit.
33 | */
34 | @property(nonatomic, copy, nullable) NSNumber *minBitrateBps;
35 |
36 | /** The maximum framerate to use for the encoding, or nil if there is no
37 | * limit.
38 | */
39 | @property(nonatomic, copy, nullable) NSNumber *maxFramerate;
40 |
41 | /** The requested number of temporal layers to use for the encoding, or nil
42 | * if the default should be used.
43 | */
44 | @property(nonatomic, copy, nullable) NSNumber *numTemporalLayers;
45 |
46 | /** Scale the width and height down by this factor for video. If nil,
47 | * implementation default scaling factor will be used.
48 | */
49 | @property(nonatomic, copy, nullable) NSNumber *scaleResolutionDownBy;
50 |
51 | /** The SSRC being used by this encoding. */
52 | @property(nonatomic, readonly, nullable) NSNumber *ssrc;
53 |
54 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
55 |
56 | @end
57 |
58 | NS_ASSUME_NONNULL_END
59 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpFragmentationHeader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */
18 | RTC_OBJC_EXPORT
19 | @interface RTCRtpFragmentationHeader : NSObject
20 |
21 | @property(nonatomic, strong) NSArray *fragmentationOffset;
22 | @property(nonatomic, strong) NSArray *fragmentationLength;
23 | @property(nonatomic, strong) NSArray *fragmentationTimeDiff;
24 | @property(nonatomic, strong) NSArray *fragmentationPlType;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpHeaderExtension.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCRtpHeaderExtension : NSObject
19 |
20 | /** The URI of the RTP header extension, as defined in RFC5285. */
21 | @property(nonatomic, readonly, copy) NSString *uri;
22 |
23 | /** The value put in the RTP packet to identify the header extension. */
24 | @property(nonatomic, readonly) int id;
25 |
26 | /** Whether the header extension is encrypted or not. */
27 | @property(nonatomic, readonly, getter=isEncrypted) BOOL encrypted;
28 |
29 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
30 |
31 | @end
32 |
33 | NS_ASSUME_NONNULL_END
34 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpParameters.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCRtcpParameters.h"
15 | #import "RTCRtpCodecParameters.h"
16 | #import "RTCRtpEncodingParameters.h"
17 | #import "RTCRtpHeaderExtension.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | RTC_OBJC_EXPORT
22 | @interface RTCRtpParameters : NSObject
23 |
24 | /** A unique identifier for the last set of parameters applied. */
25 | @property(nonatomic, copy) NSString *transactionId;
26 |
27 | /** Parameters used for RTCP. */
28 | @property(nonatomic, readonly, copy) RTCRtcpParameters *rtcp;
29 |
30 | /** An array containing parameters for RTP header extensions. */
31 | @property(nonatomic, readonly, copy) NSArray *headerExtensions;
32 |
33 | /** The currently active encodings in the order of preference. */
34 | @property(nonatomic, copy) NSArray *encodings;
35 |
36 | /** The negotiated set of send codecs in order of preference. */
37 | @property(nonatomic, copy) NSArray *codecs;
38 |
39 | - (instancetype)init NS_DESIGNATED_INITIALIZER;
40 |
41 | @end
42 |
43 | NS_ASSUME_NONNULL_END
44 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpReceiver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCMediaStreamTrack.h"
15 | #import "RTCRtpParameters.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /** Represents the media type of the RtpReceiver. */
20 | typedef NS_ENUM(NSInteger, RTCRtpMediaType) {
21 | RTCRtpMediaTypeAudio,
22 | RTCRtpMediaTypeVideo,
23 | RTCRtpMediaTypeData,
24 | };
25 |
26 | @class RTCRtpReceiver;
27 |
28 | RTC_OBJC_EXPORT
29 | @protocol RTCRtpReceiverDelegate
30 |
31 | /** Called when the first RTP packet is received.
32 | *
33 | * Note: Currently if there are multiple RtpReceivers of the same media type,
34 | * they will all call OnFirstPacketReceived at once.
35 | *
36 | * For example, if we create three audio receivers, A/B/C, they will listen to
37 | * the same signal from the underneath network layer. Whenever the first audio packet
38 | * is received, the underneath signal will be fired. All the receivers A/B/C will be
39 | * notified and the callback of the receiver's delegate will be called.
40 | *
41 | * The process is the same for video receivers.
42 | */
43 | - (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver
44 | didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType;
45 |
46 | @end
47 |
48 | RTC_OBJC_EXPORT
49 | @protocol RTCRtpReceiver
50 |
51 | /** A unique identifier for this receiver. */
52 | @property(nonatomic, readonly) NSString *receiverId;
53 |
54 | /** The currently active RTCRtpParameters, as defined in
55 | * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
56 | *
57 | * The WebRTC specification only defines RTCRtpParameters in terms of senders,
58 | * but this API also applies them to receivers, similar to ORTC:
59 | * http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*.
60 | */
61 | @property(nonatomic, readonly) RTCRtpParameters *parameters;
62 |
63 | /** The RTCMediaStreamTrack associated with the receiver.
64 | * Note: reading this property returns a new instance of
65 | * RTCMediaStreamTrack. Use isEqual: instead of == to compare
66 | * RTCMediaStreamTrack instances.
67 | */
68 | @property(nonatomic, readonly, nullable) RTCMediaStreamTrack *track;
69 |
70 | /** The delegate for this RtpReceiver. */
71 | @property(nonatomic, weak) id delegate;
72 |
73 | @end
74 |
75 | RTC_OBJC_EXPORT
76 | @interface RTCRtpReceiver : NSObject
77 |
78 | - (instancetype)init NS_UNAVAILABLE;
79 |
80 | @end
81 |
82 | NS_ASSUME_NONNULL_END
83 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCRtpSender.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCDtmfSender.h"
14 | #import "RTCMacros.h"
15 | #import "RTCMediaStreamTrack.h"
16 | #import "RTCRtpParameters.h"
17 |
18 | NS_ASSUME_NONNULL_BEGIN
19 |
20 | RTC_OBJC_EXPORT
21 | @protocol RTCRtpSender
22 |
23 | /** A unique identifier for this sender. */
24 | @property(nonatomic, readonly) NSString *senderId;
25 |
26 | /** The currently active RTCRtpParameters, as defined in
27 | * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
28 | */
29 | @property(nonatomic, copy) RTCRtpParameters *parameters;
30 |
31 | /** The RTCMediaStreamTrack associated with the sender.
32 | * Note: reading this property returns a new instance of
33 | * RTCMediaStreamTrack. Use isEqual: instead of == to compare
34 | * RTCMediaStreamTrack instances.
35 | */
36 | @property(nonatomic, copy, nullable) RTCMediaStreamTrack *track;
37 |
38 | /** The RTCDtmfSender accociated with the RTP sender. */
39 | @property(nonatomic, readonly, nullable) id dtmfSender;
40 |
41 | @end
42 |
43 | RTC_OBJC_EXPORT
44 | @interface RTCRtpSender : NSObject
45 |
46 | - (instancetype)init NS_UNAVAILABLE;
47 |
48 | @end
49 |
50 | NS_ASSUME_NONNULL_END
51 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCSSLAdapter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | /**
16 | * Initialize and clean up the SSL library. Failure is fatal. These call the
17 | * corresponding functions in webrtc/rtc_base/ssladapter.h.
18 | */
19 | RTC_EXTERN BOOL RTCInitializeSSL(void);
20 | RTC_EXTERN BOOL RTCCleanupSSL(void);
21 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCSessionDescription.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | /**
16 | * Represents the session description type. This exposes the same types that are
17 | * in C++, which doesn't include the rollback type that is in the W3C spec.
18 | */
19 | typedef NS_ENUM(NSInteger, RTCSdpType) {
20 | RTCSdpTypeOffer,
21 | RTCSdpTypePrAnswer,
22 | RTCSdpTypeAnswer,
23 | };
24 |
25 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | RTC_OBJC_EXPORT
28 | @interface RTCSessionDescription : NSObject
29 |
30 | /** The type of session description. */
31 | @property(nonatomic, readonly) RTCSdpType type;
32 |
33 | /** The SDP string representation of this session description. */
34 | @property(nonatomic, readonly) NSString *sdp;
35 |
36 | - (instancetype)init NS_UNAVAILABLE;
37 |
38 | /** Initialize a session description with a type and SDP string. */
39 | - (instancetype)initWithType:(RTCSdpType)type sdp:(NSString *)sdp NS_DESIGNATED_INITIALIZER;
40 |
41 | + (NSString *)stringForType:(RTCSdpType)type;
42 |
43 | + (RTCSdpType)typeForString:(NSString *)string;
44 |
45 | @end
46 |
47 | NS_ASSUME_NONNULL_END
48 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCTracing.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | RTC_EXTERN void RTCSetupInternalTracer(void);
16 | /** Starts capture to specified file. Must be a valid writable path.
17 | * Returns YES if capture starts.
18 | */
19 | RTC_EXTERN BOOL RTCStartInternalCapture(NSString* filePath);
20 | RTC_EXTERN void RTCStopInternalCapture(void);
21 | RTC_EXTERN void RTCShutdownInternalTracer(void);
22 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoCapturer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import "RTCVideoFrame.h"
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @class RTCVideoCapturer;
18 |
19 | RTC_OBJC_EXPORT
20 | @protocol RTCVideoCapturerDelegate
21 | - (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFrame *)frame;
22 | @end
23 |
24 | RTC_OBJC_EXPORT
25 | @interface RTCVideoCapturer : NSObject
26 |
27 | @property(nonatomic, weak) id delegate;
28 |
29 | - (instancetype)initWithDelegate:(id)delegate;
30 |
31 | @end
32 |
33 | NS_ASSUME_NONNULL_END
34 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoCodecConstants.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | RTC_OBJC_EXPORT extern NSString* const kRTCVideoCodecVp8Name;
16 | RTC_OBJC_EXPORT extern NSString* const kRTCVideoCodecVp9Name;
17 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoCodecInfo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** Holds information to identify a codec. Corresponds to webrtc::SdpVideoFormat. */
18 | RTC_OBJC_EXPORT
19 | @interface RTCVideoCodecInfo : NSObject
20 |
21 | - (instancetype)init NS_UNAVAILABLE;
22 |
23 | - (instancetype)initWithName:(NSString *)name;
24 |
25 | - (instancetype)initWithName:(NSString *)name
26 | parameters:(nullable NSDictionary *)parameters
27 | NS_DESIGNATED_INITIALIZER;
28 |
29 | - (BOOL)isEqualToCodecInfo:(RTCVideoCodecInfo *)info;
30 |
31 | @property(nonatomic, readonly) NSString *name;
32 | @property(nonatomic, readonly) NSDictionary *parameters;
33 |
34 | @end
35 |
36 | NS_ASSUME_NONNULL_END
37 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCCodecSpecificInfo.h"
14 | #import "RTCEncodedImage.h"
15 | #import "RTCMacros.h"
16 | #import "RTCVideoEncoderSettings.h"
17 | #import "RTCVideoFrame.h"
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | /** Callback block for decoder. */
22 | typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame);
23 |
24 | /** Protocol for decoder implementations. */
25 | RTC_OBJC_EXPORT
26 | @protocol RTCVideoDecoder
27 |
28 | - (void)setCallback:(RTCVideoDecoderCallback)callback;
29 | - (NSInteger)startDecodeWithSettings:(RTCVideoEncoderSettings *)settings
30 | numberOfCores:(int)numberOfCores
31 | DEPRECATED_MSG_ATTRIBUTE("use startDecodeWithNumberOfCores: instead");
32 | - (NSInteger)releaseDecoder;
33 | - (NSInteger)decode:(RTCEncodedImage *)encodedImage
34 | missingFrames:(BOOL)missingFrames
35 | codecSpecificInfo:(nullable id)info
36 | renderTimeMs:(int64_t)renderTimeMs;
37 | - (NSString *)implementationName;
38 |
39 | // TODO(andersc): Make non-optional when `startDecodeWithSettings:numberOfCores:` is removed.
40 | @optional
41 | - (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores;
42 |
43 | @end
44 |
45 | NS_ASSUME_NONNULL_END
46 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoderFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoCodecInfo.h"
15 | #import "RTCVideoDecoder.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /** RTCVideoDecoderFactory is an Objective-C version of webrtc::VideoDecoderFactory. */
20 | RTC_OBJC_EXPORT
21 | @protocol RTCVideoDecoderFactory
22 |
23 | - (nullable id)createDecoder:(RTCVideoCodecInfo *)info;
24 | - (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead?
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoderFactoryH264.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoDecoderFactory.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoDecoderFactoryH264 : NSObject
18 | @end
19 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoderH264.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoDecoder.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoDecoderH264 : NSObject
18 | @end
19 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoderVP8.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoDecoder.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoDecoderVP8 : NSObject
18 |
19 | /* This returns a VP8 decoder that can be returned from a RTCVideoDecoderFactory injected into
20 | * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be
21 | * used independently from the RTCPeerConnectionFactory.
22 | */
23 | + (id)vp8Decoder;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoDecoderVP9.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoDecoder.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoDecoderVP9 : NSObject
18 |
19 | /* This returns a VP9 decoder that can be returned from a RTCVideoDecoderFactory injected into
20 | * RTCPeerConnectionFactory. Even though it implements the RTCVideoDecoder protocol, it can not be
21 | * used independently from the RTCPeerConnectionFactory.
22 | */
23 | + (id)vp9Decoder;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCCodecSpecificInfo.h"
14 | #import "RTCEncodedImage.h"
15 | #import "RTCMacros.h"
16 | #import "RTCRtpFragmentationHeader.h"
17 | #import "RTCVideoEncoderQpThresholds.h"
18 | #import "RTCVideoEncoderSettings.h"
19 | #import "RTCVideoFrame.h"
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | /** Callback block for encoder. */
24 | typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame,
25 | id info,
26 | RTCRtpFragmentationHeader *header);
27 |
28 | /** Protocol for encoder implementations. */
29 | RTC_OBJC_EXPORT
30 | @protocol RTCVideoEncoder
31 |
32 | - (void)setCallback:(RTCVideoEncoderCallback)callback;
33 | - (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings
34 | numberOfCores:(int)numberOfCores;
35 | - (NSInteger)releaseEncoder;
36 | - (NSInteger)encode:(RTCVideoFrame *)frame
37 | codecSpecificInfo:(nullable id)info
38 | frameTypes:(NSArray *)frameTypes;
39 | - (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
40 | - (NSString *)implementationName;
41 |
42 | /** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
43 | * keep the QP from the encoded images within the given range. Returning nil from this function
44 | * disables quality scaling. */
45 | - (nullable RTCVideoEncoderQpThresholds *)scalingSettings;
46 |
47 | @end
48 |
49 | NS_ASSUME_NONNULL_END
50 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderFactory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoCodecInfo.h"
15 | #import "RTCVideoEncoder.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | /** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory. */
20 | RTC_OBJC_EXPORT
21 | @protocol RTCVideoEncoderFactory
22 |
23 | - (nullable id)createEncoder:(RTCVideoCodecInfo *)info;
24 | - (NSArray *)supportedCodecs; // TODO(andersc): "supportedFormats" instead?
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderFactoryH264.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoEncoderFactory.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoEncoderFactoryH264 : NSObject
18 | @end
19 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderH264.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoCodecInfo.h"
15 | #import "RTCVideoEncoder.h"
16 |
17 | RTC_OBJC_EXPORT
18 | @interface RTCVideoEncoderH264 : NSObject
19 |
20 | - (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderQpThresholds.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */
18 | RTC_OBJC_EXPORT
19 | @interface RTCVideoEncoderQpThresholds : NSObject
20 |
21 | - (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high;
22 |
23 | @property(nonatomic, readonly) NSInteger low;
24 | @property(nonatomic, readonly) NSInteger high;
25 |
26 | @end
27 |
28 | NS_ASSUME_NONNULL_END
29 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderSettings.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | typedef NS_ENUM(NSUInteger, RTCVideoCodecMode) {
18 | RTCVideoCodecModeRealtimeVideo,
19 | RTCVideoCodecModeScreensharing,
20 | };
21 |
22 | /** Settings for encoder. Corresponds to webrtc::VideoCodec. */
23 | RTC_OBJC_EXPORT
24 | @interface RTCVideoEncoderSettings : NSObject
25 |
26 | @property(nonatomic, strong) NSString *name;
27 |
28 | @property(nonatomic, assign) unsigned short width;
29 | @property(nonatomic, assign) unsigned short height;
30 |
31 | @property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec.
32 | @property(nonatomic, assign) unsigned int maxBitrate;
33 | @property(nonatomic, assign) unsigned int minBitrate;
34 |
35 | @property(nonatomic, assign) uint32_t maxFramerate;
36 |
37 | @property(nonatomic, assign) unsigned int qpMax;
38 | @property(nonatomic, assign) RTCVideoCodecMode mode;
39 |
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderVP8.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoEncoder.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoEncoderVP8 : NSObject
18 |
19 | /* This returns a VP8 encoder that can be returned from a RTCVideoEncoderFactory injected into
20 | * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
21 | * used independently from the RTCPeerConnectionFactory.
22 | */
23 | + (id)vp8Encoder;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoEncoderVP9.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoEncoder.h"
15 |
16 | RTC_OBJC_EXPORT
17 | @interface RTCVideoEncoderVP9 : NSObject
18 |
19 | /* This returns a VP9 encoder that can be returned from a RTCVideoEncoderFactory injected into
20 | * RTCPeerConnectionFactory. Even though it implements the RTCVideoEncoder protocol, it can not be
21 | * used independently from the RTCPeerConnectionFactory.
22 | */
23 | + (id)vp9Encoder;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoFrame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import
13 |
14 | #import "RTCMacros.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | typedef NS_ENUM(NSInteger, RTCVideoRotation) {
19 | RTCVideoRotation_0 = 0,
20 | RTCVideoRotation_90 = 90,
21 | RTCVideoRotation_180 = 180,
22 | RTCVideoRotation_270 = 270,
23 | };
24 |
25 | @protocol RTCVideoFrameBuffer;
26 |
27 | // RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame.
28 | RTC_OBJC_EXPORT
29 | @interface RTCVideoFrame : NSObject
30 |
31 | /** Width without rotation applied. */
32 | @property(nonatomic, readonly) int width;
33 |
34 | /** Height without rotation applied. */
35 | @property(nonatomic, readonly) int height;
36 | @property(nonatomic, readonly) RTCVideoRotation rotation;
37 |
38 | /** Timestamp in nanoseconds. */
39 | @property(nonatomic, readonly) int64_t timeStampNs;
40 |
41 | /** Timestamp 90 kHz. */
42 | @property(nonatomic, assign) int32_t timeStamp;
43 |
44 | @property(nonatomic, readonly) id buffer;
45 |
46 | - (instancetype)init NS_UNAVAILABLE;
47 | - (instancetype) new NS_UNAVAILABLE;
48 |
49 | /** Initialize an RTCVideoFrame from a pixel buffer, rotation, and timestamp.
50 | * Deprecated - initialize with a RTCCVPixelBuffer instead
51 | */
52 | - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
53 | rotation:(RTCVideoRotation)rotation
54 | timeStampNs:(int64_t)timeStampNs
55 | DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead");
56 |
57 | /** Initialize an RTCVideoFrame from a pixel buffer combined with cropping and
58 | * scaling. Cropping will be applied first on the pixel buffer, followed by
59 | * scaling to the final resolution of scaledWidth x scaledHeight.
60 | */
61 | - (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
62 | scaledWidth:(int)scaledWidth
63 | scaledHeight:(int)scaledHeight
64 | cropWidth:(int)cropWidth
65 | cropHeight:(int)cropHeight
66 | cropX:(int)cropX
67 | cropY:(int)cropY
68 | rotation:(RTCVideoRotation)rotation
69 | timeStampNs:(int64_t)timeStampNs
70 | DEPRECATED_MSG_ATTRIBUTE("use initWithBuffer instead");
71 |
72 | /** Initialize an RTCVideoFrame from a frame buffer, rotation, and timestamp.
73 | */
74 | - (instancetype)initWithBuffer:(id)frameBuffer
75 | rotation:(RTCVideoRotation)rotation
76 | timeStampNs:(int64_t)timeStampNs;
77 |
78 | /** Return a frame that is guaranteed to be I420, i.e. it is possible to access
79 | * the YUV data on it.
80 | */
81 | - (RTCVideoFrame *)newI420VideoFrame;
82 |
83 | @end
84 |
85 | NS_ASSUME_NONNULL_END
86 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoFrameBuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @protocol RTCI420Buffer;
18 |
19 | // RTCVideoFrameBuffer is an ObjectiveC version of webrtc::VideoFrameBuffer.
20 | RTC_OBJC_EXPORT
21 | @protocol RTCVideoFrameBuffer
22 |
23 | @property(nonatomic, readonly) int width;
24 | @property(nonatomic, readonly) int height;
25 |
26 | - (id)toI420;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #if TARGET_OS_IPHONE
13 | #import
14 | #endif
15 |
16 | #import "RTCMacros.h"
17 |
18 | NS_ASSUME_NONNULL_BEGIN
19 |
20 | @class RTCVideoFrame;
21 |
22 | RTC_OBJC_EXPORT
23 | @protocol RTCVideoRenderer
24 |
25 | /** The size of the frame. */
26 | - (void)setSize:(CGSize)size;
27 |
28 | /** The frame to be displayed. */
29 | - (void)renderFrame:(nullable RTCVideoFrame *)frame;
30 |
31 | @end
32 |
33 | RTC_OBJC_EXPORT
34 | @protocol RTCVideoViewDelegate
35 |
36 | - (void)videoView:(id)videoView didChangeVideoSize:(CGSize)size;
37 |
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoSource.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCMediaSource.h"
15 | #import "RTCVideoCapturer.h"
16 |
17 | NS_ASSUME_NONNULL_BEGIN
18 |
19 | RTC_OBJC_EXPORT
20 |
21 | @interface RTCVideoSource : RTCMediaSource
22 |
23 | - (instancetype)init NS_UNAVAILABLE;
24 |
25 | /**
26 | * Calling this function will cause frames to be scaled down to the
27 | * requested resolution. Also, frames will be cropped to match the
28 | * requested aspect ratio, and frames will be dropped to match the
29 | * requested fps. The requested aspect ratio is orientation agnostic and
30 | * will be adjusted to maintain the input orientation, so it doesn't
31 | * matter if e.g. 1280x720 or 720x1280 is requested.
32 | */
33 | - (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoTrack.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import "RTCMediaStreamTrack.h"
12 |
13 | #import "RTCMacros.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | @protocol RTCVideoRenderer;
18 | @class RTCPeerConnectionFactory;
19 | @class RTCVideoSource;
20 |
21 | RTC_OBJC_EXPORT
22 | @interface RTCVideoTrack : RTCMediaStreamTrack
23 |
24 | /** The video source for this video track. */
25 | @property(nonatomic, readonly) RTCVideoSource *source;
26 |
27 | - (instancetype)init NS_UNAVAILABLE;
28 |
29 | /** Register a renderer that will render all frames received on this track. */
30 | - (void)addRenderer:(id)renderer;
31 |
32 | /** Deregister a renderer. */
33 | - (void)removeRenderer:(id)renderer;
34 |
35 | @end
36 |
37 | NS_ASSUME_NONNULL_END
38 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCVideoViewShading.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCVideoFrame.h"
14 |
15 | NS_ASSUME_NONNULL_BEGIN
16 |
17 | /**
18 | * RTCVideoViewShading provides a way for apps to customize the OpenGL(ES) shaders used in
19 | * rendering for the RTCEAGLVideoView/RTCNSGLVideoView.
20 | */
21 | RTC_OBJC_EXPORT
22 | @protocol RTCVideoViewShading
23 |
24 | /** Callback for I420 frames. Each plane is given as a texture. */
25 | - (void)applyShadingForFrameWithWidth:(int)width
26 | height:(int)height
27 | rotation:(RTCVideoRotation)rotation
28 | yPlane:(GLuint)yPlane
29 | uPlane:(GLuint)uPlane
30 | vPlane:(GLuint)vPlane;
31 |
32 | /** Callback for NV12 frames. Each plane is given as a texture. */
33 | - (void)applyShadingForFrameWithWidth:(int)width
34 | height:(int)height
35 | rotation:(RTCVideoRotation)rotation
36 | yPlane:(GLuint)yPlane
37 | uvPlane:(GLuint)uvPlane;
38 |
39 | @end
40 |
41 | NS_ASSUME_NONNULL_END
42 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/RTCYUVPlanarBuffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | #import "RTCMacros.h"
14 | #import "RTCVideoFrameBuffer.h"
15 |
16 | NS_ASSUME_NONNULL_BEGIN
17 |
18 | /** Protocol for RTCVideoFrameBuffers containing YUV planar data. */
19 | RTC_OBJC_EXPORT
20 | @protocol RTCYUVPlanarBuffer
21 |
22 | @property(nonatomic, readonly) int chromaWidth;
23 | @property(nonatomic, readonly) int chromaHeight;
24 | @property(nonatomic, readonly) const uint8_t *dataY;
25 | @property(nonatomic, readonly) const uint8_t *dataU;
26 | @property(nonatomic, readonly) const uint8_t *dataV;
27 | @property(nonatomic, readonly) int strideY;
28 | @property(nonatomic, readonly) int strideU;
29 | @property(nonatomic, readonly) int strideV;
30 |
31 | - (instancetype)initWithWidth:(int)width
32 | height:(int)height
33 | dataY:(const uint8_t *)dataY
34 | dataU:(const uint8_t *)dataU
35 | dataV:(const uint8_t *)dataV;
36 | - (instancetype)initWithWidth:(int)width height:(int)height;
37 | - (instancetype)initWithWidth:(int)width
38 | height:(int)height
39 | strideY:(int)strideY
40 | strideU:(int)strideU
41 | strideV:(int)strideV;
42 |
43 | @end
44 |
45 | NS_ASSUME_NONNULL_END
46 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/UIDevice+RTCDevice.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 |
13 | typedef NS_ENUM(NSInteger, RTCDeviceType) {
14 | RTCDeviceTypeUnknown,
15 | RTCDeviceTypeIPhone1G,
16 | RTCDeviceTypeIPhone3G,
17 | RTCDeviceTypeIPhone3GS,
18 | RTCDeviceTypeIPhone4,
19 | RTCDeviceTypeIPhone4Verizon,
20 | RTCDeviceTypeIPhone4S,
21 | RTCDeviceTypeIPhone5GSM,
22 | RTCDeviceTypeIPhone5GSM_CDMA,
23 | RTCDeviceTypeIPhone5CGSM,
24 | RTCDeviceTypeIPhone5CGSM_CDMA,
25 | RTCDeviceTypeIPhone5SGSM,
26 | RTCDeviceTypeIPhone5SGSM_CDMA,
27 | RTCDeviceTypeIPhone6Plus,
28 | RTCDeviceTypeIPhone6,
29 | RTCDeviceTypeIPhone6S,
30 | RTCDeviceTypeIPhone6SPlus,
31 | RTCDeviceTypeIPhone7,
32 | RTCDeviceTypeIPhone7Plus,
33 | RTCDeviceTypeIPhoneSE,
34 | RTCDeviceTypeIPhone8,
35 | RTCDeviceTypeIPhone8Plus,
36 | RTCDeviceTypeIPhoneX,
37 | RTCDeviceTypeIPhoneXS,
38 | RTCDeviceTypeIPhoneXSMax,
39 | RTCDeviceTypeIPhoneXR,
40 | RTCDeviceTypeIPodTouch1G,
41 | RTCDeviceTypeIPodTouch2G,
42 | RTCDeviceTypeIPodTouch3G,
43 | RTCDeviceTypeIPodTouch4G,
44 | RTCDeviceTypeIPodTouch5G,
45 | RTCDeviceTypeIPodTouch6G,
46 | RTCDeviceTypeIPad,
47 | RTCDeviceTypeIPad2Wifi,
48 | RTCDeviceTypeIPad2GSM,
49 | RTCDeviceTypeIPad2CDMA,
50 | RTCDeviceTypeIPad2Wifi2,
51 | RTCDeviceTypeIPadMiniWifi,
52 | RTCDeviceTypeIPadMiniGSM,
53 | RTCDeviceTypeIPadMiniGSM_CDMA,
54 | RTCDeviceTypeIPad3Wifi,
55 | RTCDeviceTypeIPad3GSM_CDMA,
56 | RTCDeviceTypeIPad3GSM,
57 | RTCDeviceTypeIPad4Wifi,
58 | RTCDeviceTypeIPad4GSM,
59 | RTCDeviceTypeIPad4GSM_CDMA,
60 | RTCDeviceTypeIPad5,
61 | RTCDeviceTypeIPad6,
62 | RTCDeviceTypeIPadAirWifi,
63 | RTCDeviceTypeIPadAirCellular,
64 | RTCDeviceTypeIPadAirWifiCellular,
65 | RTCDeviceTypeIPadAir2,
66 | RTCDeviceTypeIPadMini2GWifi,
67 | RTCDeviceTypeIPadMini2GCellular,
68 | RTCDeviceTypeIPadMini2GWifiCellular,
69 | RTCDeviceTypeIPadMini3,
70 | RTCDeviceTypeIPadMini4,
71 | RTCDeviceTypeIPadPro9Inch,
72 | RTCDeviceTypeIPadPro12Inch,
73 | RTCDeviceTypeIPadPro12Inch2,
74 | RTCDeviceTypeIPadPro10Inch,
75 | RTCDeviceTypeSimulatori386,
76 | RTCDeviceTypeSimulatorx86_64,
77 | };
78 |
79 | @interface UIDevice (RTCDevice)
80 |
81 | + (RTCDeviceType)deviceType;
82 | + (BOOL)isIOS11OrLater;
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/ios/WebRTC.framework/Headers/WebRTC.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | #import
12 | #import