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

feat(react-native): live stream components for host and viewer #1135

Merged
merged 24 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9534c6a
feat(react-native): live stream components
khushal87 Oct 9, 2023
b867990
chore: resolve conflicts from main
khushal87 Oct 10, 2023
8db1024
feat: add live stream layout component and prop documentation and the…
khushal87 Oct 10, 2023
353b3e2
feat: enable HLS support on host end
khushal87 Oct 10, 2023
9458afb
docs: livestream component docs
khushal87 Oct 11, 2023
414510b
docs: improve docs and floating participant view
khushal87 Oct 11, 2023
8c0f4ed
fix: landscape mode styles in livestream dogfood app
khushal87 Oct 11, 2023
c012232
fix: change screen shots
khushal87 Oct 11, 2023
4d3c32d
docs: fix vale lint issue
khushal87 Oct 11, 2023
e2893b7
refactor: change variable name
khushal87 Oct 12, 2023
06e71a9
chore: resolve conflicts from main
khushal87 Oct 12, 2023
dc6a007
Merge branch 'main' of github.com:GetStream/stream-video-js into khus…
khushal87 Oct 13, 2023
1541d46
docs(react-native): props variable case
khushal87 Oct 16, 2023
6899e12
refactor: simplify container in topview and call controls
khushal87 Oct 17, 2023
7b9249b
docs: update screenshots
khushal87 Oct 17, 2023
251f33d
refactor: change component names
khushal87 Oct 17, 2023
b850dc1
docs: highlight line syntax
khushal87 Oct 17, 2023
ac2cefc
docs: improve documentation of host and viewer livestream
khushal87 Oct 17, 2023
2839745
docs: improve description for host and viewer livestream
khushal87 Oct 18, 2023
283d8fd
fix: vale linting issues
khushal87 Oct 18, 2023
1b46573
Merge branch 'main' of github.com:GetStream/stream-video-js into khus…
khushal87 Oct 19, 2023
1cb5256
refactor: duration logic in DurationBadge
khushal87 Oct 19, 2023
07185f9
refactor: duration logic in DurationBadge
khushal87 Oct 19, 2023
8939b77
refactor: theme variables
khushal87 Oct 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ await myCall.join({ create: true });

To create the first call object, specify the call type as **livestream** and provide a unique `callId`. The `livestream` call type comes with default settings that are usually suitable for live streams, but you can customize features, permissions, and settings in the dashboard. Additionally, the dashboard allows you to create new call types as required.

Finally, using `call.join(create = true)` will not only create the call object on our servers but also initiate the real-time transport for audio and video. This allows for seamless and immediate engagement in the live stream.
Finally, using `call.join({ create: true })` will not only create the call object on our servers but also initiate the real-time transport for audio and video. This allows for seamless and immediate engagement in the live stream.
khushal87 marked this conversation as resolved.
Show resolved Hide resolved

Note that you can also add members to a call and assign them different roles. For more information, see the [Joining & Creating Calls](../../core/joining-and-creating-calls/) docs.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Livestream",
"position": 3
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
id: host-livestream
title: HostLivestream
---

import ImageShowcase from '@site/src/components/ImageShowcase';
import HostLivestreamStart from '../../assets/04-ui-components/livestream/host-livestream-start.png';
import HostLivestreamEnd from '../../assets/04-ui-components/livestream/host-livestream-end.png';

import HostLivestreamTopView from '../../common-content/ui-components/livestream/host-livestream/host-livestream-top-view.mdx';
import LivestreamLayout from '../../common-content/ui-components/livestream/livestream-layout.mdx';
import HostLivestreamControls from '../../common-content/ui-components/livestream/host-livestream/host-livestream-controls.mdx';
import DurationBadge from '../../common-content/ui-components/livestream/duration-badge.mdx';
import FollowerCount from '../../common-content/ui-components/livestream/follower-count.mdx';
import LiveIndicator from '../../common-content/ui-components/livestream/live-indicator.mdx';
import HostStartStreamButton from '../../common-content/ui-components/livestream/host-livestream/host-start-stream-button.mdx';
import LiveStreamMediaControls from '../../common-content/ui-components/livestream/livestream-media-controls.mdx';
import OnStartStreamHandler from '../../common-content/ui-components/livestream/host-livestream/on-start-stream-handler.mdx';
import OnEndStreamHandler from '../../common-content/ui-components/livestream/host-livestream/on-end-stream-handler.mdx';

The `HostLivestream` is the UI component that allows you to show the live stream view in the app on the host's end with minimal efforts. So you don't need to take care much about each feature that you need to build a video live stream call screen with this component.
khushal87 marked this conversation as resolved.
Show resolved Hide resolved

Basically what you can do with the `HostLivestream` is:

- A complete live stream UI with ability to stream host's video.
- Duration of the live stream with live indicator.
- Whether the stream is live and number of participant's watching the stream.
- Media controls to control publish and un-publish stream.
Copy link
Contributor

@vishalnarkhede vishalnarkhede Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Media controls to control publish and un-publish stream.
- Media controls to start and end the livestream.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅


<ImageShowcase
items={[
{
image: HostLivestreamStart,
caption: 'Host Live Stream Start',
alt: 'Host Live Stream Start',
},
{
image: HostLivestreamEnd,
caption: 'Host Live Stream End',
alt: 'Host Live Stream End',
},
]}
/>

## General usage

Let's see how to show the `HostLivestream` UI:

```tsx
import {
Call,
StreamCall,
HostLivestream,
} from '@stream-io/video-react-native-sdk';

const VideoCallUI = () => {
let call: Call;
// your logic to create a new call or get an existing call

return (
<StreamCall call={call}>
// highlight-next-line
<HostLivestream />
</StreamCall>
);
};
```

## Props

### `hls`

Enable HTTP live streaming

| Type | Default |
| --------- | ------- |
| `boolean` | false |

### `HostLivestreamTopView`

<HostLivestreamTopView />

### `LivestreamLayout`

<LivestreamLayout />

### `HostLivestreamControls`

<HostLivestreamControls />

### `DurationBadge`

<DurationBadge />

### `FollowerCount`

<FollowerCount />

### `LiveIndicator`

<LiveIndicator />

### `HostStartStreamButton`

<HostStartStreamButton />

### `LivestreamMediaControls`

<LiveStreamMediaControls />

### `onStartStreamHandler`

<OnStartStreamHandler />

### `onEndStreamHandler`

<OnEndStreamHandler />
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
id: viewer-livestream
title: ViewerLivestream
---

import ImageShowcase from '@site/src/components/ImageShowcase';
import ViewerLivestream from '../../assets/04-ui-components/livestream/viewer-livestream.png';
import ViewerLivestreamScreenShare from '../../assets/04-ui-components/livestream/viewer-livestream-screenshare.png';

import ViewerLivestreamTopView from '../../common-content/ui-components/livestream/viewer-livestream/viewer-livestream-top-view.mdx';
import LivestreamLayout from '../../common-content/ui-components/livestream/livestream-layout.mdx';
import ViewerLivestreamControls from '../../common-content/ui-components/livestream/viewer-livestream/viewer-livestream-controls.mdx';
import DurationBadge from '../../common-content/ui-components/livestream/duration-badge.mdx';
import FollowerCount from '../../common-content/ui-components/livestream/follower-count.mdx';
import LiveIndicator from '../../common-content/ui-components/livestream/live-indicator.mdx';
import FloatingParticipantView from '../../common-content/ui-components/call/call-content/floating-participant-view.mdx';
import ViewerLeaveStreamButton from '../../common-content/ui-components/livestream/viewer-livestream/viewer-leave-stream-button.mdx';
import OnLeaveStreamHandler from '../../common-content/ui-components/livestream/viewer-livestream/on-leave-stream-handler.mdx';

The `ViewerLivestream` is the UI component that allows you to show the live stream view in the app with minimal efforts. So you don't need to take care much about each feature that you need to build a video live stream call screen with this component.
khushal87 marked this conversation as resolved.
Show resolved Hide resolved

Basically what you can do with the `ViewerLivestream` is:

- A complete live stream UI with host's video and screen sharing stream.
- Duration of the stream.
- Whether the stream is live and number of participant's watching the stream.

<ImageShowcase
items={[
{
image: ViewerLivestream,
caption: 'Viewer Live Stream',
alt: 'Viewer Live Stream',
},
{
image: ViewerLivestreamScreenShare,
caption: 'Viewer Live Stream Screen Share',
alt: 'Viewer Live Stream Screen Share',
},
]}
/>

## General usage

Let's see how to show the `ViewerLivestream` UI:

```tsx {13}
import {
Call,
StreamCall,
ViewerLivestream,
} from '@stream-io/video-react-native-sdk';

const VideoCallUI = () => {
let call: Call;
// your logic to create a new call or get an existing call

return (
<StreamCall call={call}>
<ViewerLivestream />
</StreamCall>
);
};
```

## Props

### `ViewerLivestreamTopView`

<ViewerLivestreamTopView />

### `LivestreamLayout`

<LivestreamLayout />

### `ViewerLivestreamControls`

<ViewerLivestreamControls />

### `DurationBadge`

<DurationBadge />

### `FollowerCount`

<FollowerCount />

### `LiveIndicator`

<LiveIndicator />

### `ViewerLeaveStreamButton`

<ViewerLeaveStreamButton />

### `FloatingParticipantView`

<FloatingParticipantView />

### `onLeaveStreamHandler`

<OnLeaveStreamHandler />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the Duration badge component on the viewer's live stream's top view.

| Type | Default Value |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`DurationBadge`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamTopView/DurationBadge.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the Follower count indicator on the viewer's live stream's top view.

| Type | Default Value |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`FollowerCount`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamTopView/FollowerCount.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the bottom view controls at the host's live stream.

| Type | Default Value |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ComponentType`\| `undefined` | [`HostLiveStreamControls`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamControls/HostLiveStreamControls.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the top view at the host's live stream.

| Type | Default Value |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`HostLiveStreamTopView`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamTopView/HostLiveStreamTopView.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the host's start/end live stream button.

| Type | Default Value |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`HostStartStreamButton`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamControls/HostStartStreamButton.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Handler to be called when the End Stream button is pressed.

| Type |
| --------------------------- |
| `() => void` \| `undefined` |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Handler to be called when the Start Stream button is pressed.

| Type |
| --------------------------- |
| `() => void` \| `undefined` |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the Live indicator on the viewer's live stream's top view.

| Type | Default Value |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`LiveIndicator`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamTopView/LiveIndicator.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the live stream video layout.

| Type | Default Value |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`LiveStreamLayout`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamLayout/LiveStreamLayout.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the host's media control(audio/video) buttons.

| Type | Default Value |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`LiveStreamMediaControls`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamControls/LiveStreamMediaControls.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Handler to be called when the viewer's leave stream button is called.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Handler to be called when the viewer's leave stream button is called.
Handler to be called when the leave stream button is pressed by the viewer.


| Type |
| --------------------------- |
| `() => void` \| `undefined` |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the leave stream button on the viewer's end live stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Component to customize the leave stream button on the viewer's end live stream.
Component to customize the leave stream button for the viewer.

Just simplifying the language


| Type | Default Value |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`ViewerLeaveStreamButton`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamControls/ViewerLeaveStreamButton.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the bottom view controls at the viewer's live stream.

| Type | Default Value |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`ViewerLiveStreamControls`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamControls/ViewerLiveStreamControls.tsx) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Component to customize the top view at the viewer's live stream.

| Type | Default Value |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ComponentType`\| `undefined` | [`ViewerLiveStreamTopView`](https://github.com/GetStream/stream-video-js/blob/main/packages/react-native-sdk/src/components/Livestream/LiveStreamTopView/ViewerLiveStreamTopView.tsx) |
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const CallContent = ({
};

return (
<View style={[styles.container, callContent.container, landscapeStyles]}>
<View style={[styles.container, landscapeStyles, callContent.container]}>
<View style={[styles.container, callContent.callParticipantsContainer]}>
<View
style={[styles.view, callContent.topContainer]}
Expand Down
Loading