Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MOB-55] Fill information about the package #24

Merged
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Software Mansion <swmansion.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ Monorepo containing mobile SDKs for WHIP/WHEP client
For documentation and examples of usage, check out the [examples](https://github.com/software-mansion-labs/mobile-whep/tree/main/examples) folder. It contains simple apps showing the usage and providing some documentation for each platform.

A WHIP/WHEP server is necessary in order to use the SDKs. We recommend [ex-webrtc](https://github.com/elixir-webrtc/ex_webrtc/tree/master/examples/whip_whep) server as it was used during development and testing.

## License

Licensed under the [MIT License](LICENSE)

## React Native Whip Whep is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme).

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=react-client)](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme)
2 changes: 1 addition & 1 deletion examples/react-native/WhipWhepDemo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ yarn build
3. Run this command in the project root directory to install node_modules, initialize native package directories and install cocoapods:

```
yarn prepare
yarn prepare:example
```

4. Start Metro bundler in `examples/react-native/WhipWhepDemo` directory:
Expand Down
21 changes: 21 additions & 0 deletions packages/android-client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Software Mansion <swmansion.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions packages/android-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ The `examples/android` folder provides an example app that allows to stream medi
## Usage

In order to use the package functionalities and run the example app, a WHIP/WHEP server is necessary. It is recommended to use the [WHIP/WHEP server](https://github.com/elixir-webrtc/ex_webrtc/tree/9e1888185211c8da7128db7309584af8e863fafa/examples/whip_whep) provided by `elixir-webrtc`, as it was utilized during the development.

## License

Licensed under the [MIT License](LICENSE)

## Android Whip Whep is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme).

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=react-client)](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme)
21 changes: 21 additions & 0 deletions packages/ios-client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Software Mansion <swmansion.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions packages/ios-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ The `examples/ios` folder provides an example app that allows to stream media us
## Usage

In order to use the package functionalities and run the example app, a WHIP/WHEP server is necessary. It is recommended to use the [WHIP/WHEP server](https://github.com/elixir-webrtc/ex_webrtc/tree/9e1888185211c8da7128db7309584af8e863fafa/examples/whip_whep) provided by `elixir-webrtc`, as it was utilized during the development.

## License

Licensed under the [MIT License](LICENSE)

## iOS Whip Whep is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme).

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=react-client)](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme)
21 changes: 21 additions & 0 deletions packages/react-native-client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Software Mansion <swmansion.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
112 changes: 109 additions & 3 deletions packages/react-native-client/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,119 @@
# WHIP/WHEP react-native-client
# react-native-whip-whep

An implementation of WHIP and WHEP protocols for React Native. Provides basic methods for establishing a connection in order to stream or receive media.

This repository is an expo module that makes use of native Android and iOS packages and allows to use them in a React Native App with the code provided in `src/ReactNativeMobileWhepClientModule.ts` and the exports in `src/index.ts`. It also provides two simple native views - `WhepClientView` and `WhipClientView` to show the stream or camera preview.

## Examples
## Setup

The `examples/react-native` folder provides an example app that allows to stream media using phone's default video and audio devices and receive remote stream.
```
$ npm install --save react-native-whip-whep
# --- or ---
$ yarn add react-native-whip-whep
```

It is necessary to configure app permissions in order to stream a preview from the camera or sound:

### Android

Modify `app.json` file to request necessary permissions:

```json
{
"expo": {
...
"android": {
...
"permissions": {
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO"
}
}
}
}
```

### iOS

Add the following lines to `app.json`:

```json
{
"expo": {
...
"ios": {
...
"infoPlist": {
"NSCameraUsageDescription": "This application requires camera access to gather information about available video devices.",
"NSMicrophoneUsageDescription": "This application requires microphone access to gather information about available audio devices."
}
},
}
}
```

## Usage

In order to use the package functionalities and run the example app, a WHIP/WHEP server is necessary. It is recommended to use the [WHIP/WHEP server](https://github.com/elixir-webrtc/ex_webrtc/tree/9e1888185211c8da7128db7309584af8e863fafa/examples/whip_whep) provided by `elixir-webrtc`, as it was utilized during the development.

## Examples

The `examples/react-native` folder provides an example app that allows to stream media using phone's default video and audio devices and receive remote stream.

To create a WHEP client able to receive media stream use the following code. It requires a server URL and takes optional parameters, such as `authToken`, `audioEnabled`, `videoEnabled` (both of which defaults to true), `stunServerUrl` and `videoParameters`:

```typescript
createWhepClient(<WHEP_SERVER_URL>, {
authToken: "example",
});
```

To receive a stream, simply connect the client to the server:

```typescript
await connectWhepClient();
```

After the stream is finished, it is recommended to disconnect the client to free the resources:

```typescript
disconnectWhepClient();
```

The process of creating a WHIP client is similar to the WHEP one, but the function takes one more parameter: a `videoDevice` that will be used to stream the video to the server. `react-native-whip-whep` shares a property to obtain all available video devices:

```typescript
import { cameras } from "@mobile-whep/react-native-client";

const availableDevices = cameras;
```

```typescript
createWhipClient(
<WHIP_SERVER_URL>,
{
authToken: "example",
},
availableDevices[0].id,
);
```

The connection and disconnection process is comparable to the WHEP one:

```typescript
await connectWhipClient();
```

```typescript
disconnectWhipClient();
```

## License

Licensed under the [MIT License](LICENSE)

## React Native Whip Whep is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme).

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=react-client)](https://swmansion.com/contact/projects?utm_source=whip-whep-client&utm_medium=mobile-readme)
25 changes: 16 additions & 9 deletions packages/react-native-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mobile-whep/react-native-client",
"version": "0.1.0",
"description": "My new module",
"description": "An implementation of WHIP and WHEP protocols functionalities for React Native.",
"main": "build/index.js",
"types": "build/index.d.ts",
"scripts": {
Expand All @@ -17,17 +17,24 @@
},
"keywords": [
"react-native",
"expo",
"react-native-client",
"ReactNativeMobileWhepClient"
"WHIP",
"WHEP",
"WebRTC",
"streaming",
"video",
"audio"
],
"repository": "https://",
"repository": {
"type": "git",
"url": "git+https://github.com/software-mansion-labs/mobile-whep.git",
"directory": "packages/react-native-client"
},
"bugs": {
"url": "https:///issues"
"url": "https://github.com/software-mansion-labs/mobile-whep/issues"
},
"author": "Software Mansion <[email protected]> ()",
"author": "Software Mansion",
"license": "MIT",
"homepage": "https://#readme",
"homepage": "https://github.com/software-mansion-labs/mobile-whep",
"devDependencies": {
"@types/react": "^18.0.25",
"expo-module-scripts": "^3.5.2",
Expand All @@ -39,4 +46,4 @@
"react": "*",
"react-native": "*"
}
}
}
Loading