Skip to content

Commit d24c874

Browse files
authored
feat(swift5): use Basic auth instead of Bearer
1 parent e347d29 commit d24c874

11 files changed

+222
-387
lines changed

sdks/livestream/apivideo-android-livestream-module.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ title: Android live stream module
33
meta:
44
description: The official Android live stream module for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
55
---
6-
<!--
7-
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
8-
IF YOU NEED TO CHANGE THIS FILE, CREATE A PR IN THE SOURCE REPOSITORY.
9-
-->
106

117
# api.video Android Live stream module
128

13-
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
9+
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast
10+
video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in
11+
your app.
1412

1513
## Project description
1614

@@ -26,7 +24,7 @@ On build.gradle add the following code in dependencies:
2624

2725
```groovy
2826
dependencies {
29-
implementation 'video.api:android-live-stream:1.3.1'
27+
implementation 'video.api:android-live-stream:1.0.2'
3028
}
3129
```
3230

sdks/livestream/apivideo-flutter-livestream.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ title: Flutter RTMP live stream client
33
meta:
44
description: The official Flutter RTMP live stream client for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
55
---
6-
<!--
7-
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
8-
IF YOU NEED TO CHANGE THIS FILE, CREATE A PR IN THE SOURCE REPOSITORY.
9-
-->
106

117
# Flutter RTMP Live stream Client
128

13-
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
9+
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast
10+
video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in
11+
your app.
1412

1513
## Project description
1614

@@ -24,7 +22,7 @@ In your pubspec.yaml file, add the following:
2422

2523
```yaml
2624
dependencies:
27-
apivideo_live_stream: ^1.1.3
25+
apivideo_live_stream: ^1.1.1
2826
```
2927
3028
In your dart file, import the package:
@@ -165,5 +163,4 @@ use [issues](https://github.com/apivideo/api.video-flutter-live-stream/issues).
165163

166164
[StreamPack]: <https://github.com/ThibaultBee/StreamPack>
167165

168-
[HaishinKit]: <https://github.com/shogo4405/HaishinKit.swift>
169-
166+
[HaishinKit]: <https://github.com/shogo4405/HaishinKit.swift>

sdks/livestream/react-native-livestream-component.md

Lines changed: 60 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -3,107 +3,83 @@ title: React Native live stream component
33
meta:
44
description: The official React Native live stream component for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
55
---
6-
<!--
7-
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT!
8-
IF YOU NEED TO CHANGE THIS FILE, CREATE A PR IN THE SOURCE REPOSITORY.
9-
-->
106

11-
# React Native Livestream Component
7+
React Native Livestream Component
8+
=================================
129

1310
[api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
1411

1512
## Project description
1613

17-
This module is made for broadcasting rtmp live stream from smartphone camera
14+
This module is made for broadcasting rtmp livestream from smartphone camera
1815

1916
## Getting started
2017

21-
:warning: **The React Native Live Stream SDK is designed for 0.69.1 version of React Native. Using the SDK with >0.69.1 of React Native can cause unexpected behaviour**
22-
23-
2418
### Installation
2519

2620
```sh
2721
npm install @api.video/react-native-livestream
2822
```
29-
3023
or
31-
3224
```sh
3325
yarn add @api.video/react-native-livestream
3426
```
35-
3627
_Note: if you are on iOS, you will need two extra steps:_
37-
38-
1. Don't forget to install the native dependencies with Cocoapods
39-
28+
1) Don't forget to install the native dependencies with Cocoapods
4029
```sh
4130
cd ios && pod install
4231
```
43-
44-
1. This project contains swift code, and if it's your first dependency with swift code, you need to create an empty swift file in your project (with the bridging header) from XCode. [Find how to do that](https://github.com/apivideo/api.video-reactnative-live-stream/blob/main/docs/install_swift_dependency.md)
32+
2) This project contains swift code, and if it's your first dependency with swift code, you need to create an empty swift file in your project (with the bridging header) from XCode. [Find how to do that](https://github.com/apivideo/api.video-reactnative-live-stream/blob/main/docs/install_swift_dependency.md)
4533

4634
### Permissions
35+
To be able to broadcast,
4736

48-
To be able to broadcast, you must:
49-
50-
1. On Android: ask for internet, camera and microphone permissions:
37+
1) On Android you must ask for internet, camera and microphone permissions:
5138

52-
```xml
53-
<manifest>
39+
```java
5440
<uses-permission android:name="android.permission.INTERNET" />
5541
<uses-permission android:name="android.permission.RECORD_AUDIO" />
5642
<uses-permission android:name="android.permission.CAMERA" />
57-
</manifest>
5843
```
5944

60-
Your application must dynamically require android.permission.CAMERA and android.permission.RECORD_AUDIO.
61-
62-
2. On iOS: update Info.plist with a usage description for camera and microphone
45+
2) On iOS, you must update Info.plist with a usage description for camera and microphone
6346

6447
```xml
48+
...
6549
<key>NSCameraUsageDescription</key>
6650
<string>Your own description of the purpose</string>
6751

6852
<key>NSMicrophoneUsageDescription</key>
6953
<string>Your own description of the purpose</string>
54+
...
55+
7056
```
71-
72-
3. On react-native you must handle the permissions requests before starting your livestream. If permissions are not accepted you will not be able to broadcast.
57+
3) On react-native you must handle the permissions requests before starting your livestream. If permissions are not accepted you will not be able to broadcast.
7358

7459
### Code sample
7560

76-
7761
{% raw %}
78-
79-
```jsx
62+
```js
8063
import React, { useRef, useState } from 'react';
8164
import { View, TouchableOpacity } from 'react-native';
82-
import { LiveStreamView } from '@api.video/react-native-livestream';
65+
import { LivestreamView } from '@api.video/react-native-livestream';
8366

8467
const App = () => {
8568
const ref = useRef(null);
8669
const [streaming, setStreaming] = useState(false);
8770

8871
return (
8972
<View style={{ flex: 1, alignItems: 'center' }}>
90-
<LiveStreamView
73+
<LivestreamView
9174
style={{ flex: 1, backgroundColor: 'black', alignSelf: 'stretch' }}
9275
ref={ref}
93-
camera="back"
94-
enablePinchedZoom={true}
9576
video={{
9677
fps: 30,
9778
resolution: '720p',
98-
bitrate: 2*1024*1024, // # 2 Mbps
99-
gopDuration: 1, // 1 second
100-
}}
101-
audio={{
102-
bitrate: 128000,
103-
sampleRate: 44100,
104-
isStereo: true,
79+
camera: 'front',
80+
orientation: 'portrait',
10581
}}
106-
isMuted={false}
82+
liveStreamKey="your-livestrem-key"
10783
onConnectionSuccess={() => {
10884
//do what you want
10985
}}
@@ -127,7 +103,7 @@ const App = () => {
127103
ref.current?.stopStreaming();
128104
setStreaming(false);
129105
} else {
130-
ref.current?.startStreaming('YOUR_STREAM_KEY');
106+
ref.current?.startStreaming();
131107
setStreaming(true);
132108
}
133109
}}
@@ -139,127 +115,74 @@ const App = () => {
139115

140116
export default App;
141117
```
142-
143118
{% endraw %}
144119
145120
## Documentation
146121
147122
### Props & Methods
148123
149124
```ts
150-
type LiveStreamProps = {
125+
type ReactNativeLivestreamProps = {
151126
// Styles for the view containing the preview
152127
style: ViewStyle;
153-
// camera facing orientation
154-
camera?: 'front' | 'back';
128+
// Your Streaming key, we will append this to the rtmpServerUrl
129+
liveStreamKey: string;
130+
// RTMP server url, default: rtmp://broadcast.api.video/s
131+
rtmpServerUrl?: string;
155132
video: {
156-
// frame rate
133+
// default: 30
157134
fps: number;
158-
// resolution
159-
resolution: '240p' | '360p' | '480p' | '720p' | '1080p';
160-
// video bitrate. depends on resolutions.
161-
bitrate: number;
162-
// duration between 2 key frames in seconds
163-
gopDuration: number;
135+
// default: '720p'
136+
resolution: '240p' | '360p' | '480p' | '720p' | '1080p' | '2160p';
137+
// If omitted we will infer it from the resolution
138+
bitrate?: number;
139+
// default: 'back'
140+
camera?: 'front' | 'back';
141+
// default: 'landscape'
142+
orientation?: 'landscape' | 'portrait';
164143
};
165-
audio: {
166-
// sample rate. Only for Android. Recommended: 44100
167-
sampleRate: 44100;
168-
// true for stereo, false for mono. Only for Android. Recommended: true
169-
isStereo: true;
170-
// audio bitrate. Recommended: 128000
171-
bitrate: number;
144+
audio?: {
145+
// default: false
146+
muted?: boolean;
147+
// default: 128000
148+
bitrate?: number;
172149
};
173-
// Mute/unmute microphone
174-
isMuted: false;
175-
// Enables/disables the zoom gesture handled natively
176-
enablePinchedZoom?: boolean;
177150
// will be called when the connection is successful
178-
onConnectionSuccess?: () => void;
179-
// will be called when connection failed
180-
onConnectionFailed?: (code: string) => void;
151+
onConnectionSuccess?: (event: NativeSyntheticEvent<{ }>) => void;
152+
// will be called on connection's error
153+
onConnectionFailed?: (event: NativeSyntheticEvent<{ code: string }>) => void;
181154
// will be called when the live-stream is stopped
182-
onDisconnect?: () => void;
155+
onDisconnect?: (event: NativeSyntheticEvent<{ }>) => void;
156+
183157
};
184158

185-
type LiveStreamMethods = {
159+
type ReactNativeLivestreamMethods = {
186160
// Start the stream
187-
// streamKey: your live stream RTMP key
188-
// url: RTMP server url, default: rtmp://broadcast.api.video/s
189-
startStreaming: (streamKey: string, url?: string) => void;
161+
startStreaming: () => void;
190162
// Stops the stream
191163
stopStreaming: () => void;
192-
// Sets the zoomRatio
193-
// Intended for use with React Native Gesture Handler, a slider or similar.
194-
setZoomRatio: (zoomRatio) => void;
195164
};
196165
```
197166
198-
## Example App
199-
200-
You can try our [example app](https://github.com/apivideo/api.video-reactnative-live-stream/tree/main/example), feel free to test it.
201-
202-
### Setup
203-
204-
Be sure to follow the [React Native installation steps](https://reactnative.dev/docs/environment-setup) before anything.
205-
206-
1. Open a new terminal
207-
2. Clone the repository and go into it
208-
209-
```shell
210-
git clone https://github.com/apivideo/api.video-reactnative-live-stream.git livestream_example_app && cd livestream_example_app
211-
```
212-
213-
#### Android
214-
215-
Install the packages and launch the application
216-
217-
```shell
218-
yarn && yarn example android
219-
```
220-
221-
#### iOS
222-
223-
1. Install the packages
224-
225-
```shell
226-
yarn install
227-
```
228-
229-
2. Go into `/example/ios` and install the Pods
230-
231-
```shell
232-
cd /example/ios && pod install
233-
```
234-
235-
3. Sign your application
236-
237-
Open Xcode, click on "Open a project or file" and open the `Example.xcworkspace` file.
238-
<br />You can find it in `YOUR_PROJECT_NAME/example/ios`.
239-
<br />Click on Example, go in `Signin & Capabilities` tab, add your team and create a unique
240-
bundle identifier.
241-
242-
4. Launch the application, from the root of your project
243-
244-
```shell
245-
yarn example ios
246-
```
247-
248167
## Plugins
249168
250-
api.video live stream library is using external native library for broadcasting
169+
API.Video LiveStream module is using external native library for broadcasting
251170
252-
| Plugin | README |
253-
| ---------- | ------------ |
254-
| StreamPack | [StreamPack] |
171+
| Plugin | README |
172+
| ------ | ------ |
173+
| rtmp-rtsp-stream-client-java | [rtmp-rtsp-stream-client-java] |
255174
| HaishinKit | [HaishinKit] |
256175
257176
## FAQ
258-
259-
If you have any questions, ask us here: https://community.api.video .
177+
If you have any questions, ask us here: https://community.api.video .
260178
Or use [Issues].
261179
262-
[//]: # "These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax"
263-
[streampack]: https://github.com/ThibaultBee/StreamPack
264-
[haishinkit]: https://github.com/shogo4405/HaishinKit.swift
265-
[issues]: https://github.com/apivideo/api.video-reactnative-live-stream/issues
180+
## Example App
181+
You can try our [example app](https://github.com/apivideo/api.video-reactnative-live-stream/tree/main/example), feel free to test it.
182+
183+
184+
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
185+
186+
[rtmp-rtsp-stream-client-java]: <https://github.com/pedroSG94/rtmp-rtsp-stream-client-java>
187+
[HaishinKit]: <https://github.com/shogo4405/HaishinKit.swift>
188+
[Issues]: <https://github.com/apivideo/api.video-reactnative-live-stream/issues>

0 commit comments

Comments
 (0)