Skip to content

Commit

Permalink
[MOB-65] Add small fixes to the documentation and code (#35)
Browse files Browse the repository at this point in the history
- Removed string interpolation from iOS example
- Added info about installing `expo-modules`
  • Loading branch information
gredajustyna authored Oct 1, 2024
1 parent 8275bb4 commit 2139772
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/ios/WhipWhepDemo/WhipWhepDemo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ struct ContentView: View {
}
}
@State var whepBroadcaster = WhepClient(serverUrl: URL(string: "https://broadcaster.elixir-webrtc.org/api/whep")!, configurationOptions: ConfigurationOptions(authToken: "example"))
@State var whepPlayer = WhepClient(serverUrl: URL(string: "\(Bundle.main.infoDictionary?["WhepServerUrl"] as? String ?? "")")!, configurationOptions: ConfigurationOptions(authToken: "example"))
@State var whipPlayer = WhipClient(serverUrl: URL(string: "\(Bundle.main.infoDictionary?["WhipServerUrl"] as? String ?? "")")!, configurationOptions: ConfigurationOptions(authToken: "example"), videoDevice: WhipClient.getCaptureDevices().first)
@State var whepPlayer = WhepClient(serverUrl: URL(string: Bundle.main.infoDictionary?["WhepServerUrl"] as? String ?? "")!, configurationOptions: ConfigurationOptions(authToken: "example"))
@State var whipPlayer = WhipClient(serverUrl: URL(string: Bundle.main.infoDictionary?["WhipServerUrl"] as? String ?? "")!, configurationOptions: ConfigurationOptions(authToken: "example"), videoDevice: WhipClient.getCaptureDevices().first)

var body: some View {
VStack {
Expand Down
48 changes: 44 additions & 4 deletions packages/react-native-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ This repository is an expo module that makes use of native Android and iOS packa

## Setup

Install the package using `npm` or `yarn`:

```
$ npm install --save react-native-whip-whep
# --- or ---
$ yarn add react-native-whip-whep
```

### With Expo

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

### Android
#### Android

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

Expand All @@ -24,16 +28,16 @@ Modify `app.json` file to request necessary permissions:
...
"android": {
...
"permissions": {
"permissions": [
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO"
}
]
}
}
}
```

### iOS
#### iOS

Add the following lines to `app.json`:

Expand All @@ -52,6 +56,42 @@ Add the following lines to `app.json`:
}
```

### Without Expo

If the project is a bare React Native project, it is required to install `expo-modules`:

```
$ npx install-expo-modules
```

For more information and troubleshooting, visit [expo-modules documentation](https://docs.expo.dev/bare/installing-expo-modules/).

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

#### Android

Modify `AndroidManifest.xml` file to request necessary permissions:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
...
</manifest>
```

#### iOS

Add the following lines to `info.plist`:

```plist
<key>NSCameraUsageDescription</key>
<string>This application requires camera access to gather information about available video devices.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This application requires microphone access to gather information about available audio devices.</string>
```

## 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.
Expand Down

0 comments on commit 2139772

Please sign in to comment.