Skip to content

Commit

Permalink
Merge branch 'main' into PBE-5855-feat/react-native-video-design-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian-mkd committed Oct 16, 2024
2 parents 3f48b9a + 1b8a68d commit 4f36656
Show file tree
Hide file tree
Showing 26 changed files with 247 additions and 97 deletions.
7 changes: 7 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.8.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.3...@stream-io/video-client-1.8.4) (2024-10-16)


### Bug Fixes

* ignore camera direction for desktop devices ([#1521](https://github.com/GetStream/stream-video-js/issues/1521)) ([562b5cc](https://github.com/GetStream/stream-video-js/commit/562b5cca77264330d08dff5305eccc489970076a))

## [1.8.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.8.2...@stream-io/video-client-1.8.3) (2024-10-10)


Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-client",
"version": "1.8.3",
"version": "1.8.4",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/client/src/compatibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Checks if the current platform is a mobile device.
*
* See:
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
*/
export const isMobile = () => /Mobi/i.test(navigator.userAgent);
15 changes: 10 additions & 5 deletions packages/client/src/devices/CameraManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InputMediaDeviceManager } from './InputMediaDeviceManager';
import { getVideoDevices, getVideoStream } from './devices';
import { TrackType } from '../gen/video/sfu/models/models';
import { PreferredCodec, PublishOptions } from '../types';
import { isMobile } from '../compatibility';

export class CameraManager extends InputMediaDeviceManager<CameraManagerState> {
private targetResolution = {
Expand Down Expand Up @@ -34,10 +35,14 @@ export class CameraManager extends InputMediaDeviceManager<CameraManagerState> {
* @param direction the direction of the camera to select.
*/
async selectDirection(direction: Exclude<CameraDirection, undefined>) {
this.state.setDirection(direction);
// Providing both device id and direction doesn't work, so we deselect the device
this.state.setDevice(undefined);
await this.applySettingsToStream();
if (isMobile()) {
this.state.setDirection(direction);
// Providing both device id and direction doesn't work, so we deselect the device
this.state.setDevice(undefined);
await this.applySettingsToStream();
} else {
this.logger('warn', 'Camera direction ignored for desktop devices');
}
}

/**
Expand Down Expand Up @@ -131,7 +136,7 @@ export class CameraManager extends InputMediaDeviceManager<CameraManagerState> {
constraints.height = this.targetResolution.height;
// We can't set both device id and facing mode
// Device id has higher priority
if (!constraints.deviceId && this.state.direction) {
if (!constraints.deviceId && this.state.direction && isMobile()) {
constraints.facingMode =
this.state.direction === 'front' ? 'user' : 'environment';
}
Expand Down
7 changes: 7 additions & 0 deletions packages/client/src/devices/__tests__/CameraManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ vi.mock('../../Call.ts', () => {
};
});

vi.mock('../../compatibility.ts', () => {
console.log('MOCKING mobile device');
return {
isMobile: () => true,
};
});

describe('CameraManager', () => {
let manager: CameraManager;

Expand Down
5 changes: 5 additions & 0 deletions packages/react-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.1.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.3...@stream-io/video-react-bindings-1.1.4) (2024-10-16)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.8.4`
## [1.1.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.2...@stream-io/video-react-bindings-1.1.3) (2024-10-10)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-bindings",
"version": "1.1.3",
"version": "1.1.4",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.1.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.1.5...@stream-io/video-react-native-sdk-1.1.6) (2024-10-16)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.8.4`
* `@stream-io/video-react-bindings` updated to version `1.1.4`
## [1.1.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.1.4...@stream-io/video-react-native-sdk-1.1.5) (2024-10-16)


Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-native-sdk",
"version": "1.1.5",
"version": "1.1.6",
"packageManager": "[email protected]",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
Expand Down
12 changes: 12 additions & 0 deletions packages/react-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [1.6.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.6.6...@stream-io/video-react-sdk-1.6.7) (2024-10-16)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.8.4`
* `@stream-io/video-react-bindings` updated to version `1.1.4`
* `@stream-io/video-styling` updated to version `1.1.1`

### Bug Fixes

* PiP video placeholder ([#1509](https://github.com/GetStream/stream-video-js/issues/1509)) ([9eb2936](https://github.com/GetStream/stream-video-js/commit/9eb2936379726923ee43491ce965003e0e7f2c37))

## [1.6.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.6.5...@stream-io/video-react-sdk-1.6.6) (2024-10-14)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,30 @@ const MyApp = () => {

#### Props

| Name | Description | Type |
| ----------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| `groupSize` | The number of participants to display per page | `number` \| `undefined` |
| `excludeLocalParticipant` | Whether to exclude the local participant from the grid | `boolean` \| `undefined` |
| `mirrorLocalParticipantVideo` | Whether to mirror the user's own video (default `true`) | `boolean` \| `undefined` |
| `pageArrowsVisible` | Turns on/off the pagination arrows | `boolean` \| `undefined` |
| `ParticipantViewUI` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `VideoPlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) |
| Name | Description | Type |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `groupSize` | The number of participants to display per page | `number` \| `undefined` |
| `excludeLocalParticipant` | Whether to exclude the local participant from the grid | `boolean` \| `undefined` |
| `mirrorLocalParticipantVideo` | Whether to mirror the user's own video (default `true`) | `boolean` \| `undefined` |
| `pageArrowsVisible` | Turns on/off the pagination arrows | `boolean` \| `undefined` |
| `ParticipantViewUI` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `VideoPlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) |
| `PictureInPicturePlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#pictureinpictureplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#pictureinpictureplaceholder) |

### `SpeakerLayout`

#### Props

| Name | Description | Type |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `participantsBarPosition` | The position of the participants who are not in focus, the default is `bottom`. Providing `null` will hide the bar | `top` \| `bottom` \| `left` \| `right` \| `null` |
| `excludeLocalParticipant` | Whether to exclude the local participant from the layout | `boolean` \| `undefined` |
| `mirrorLocalParticipantVideo` | Whether to mirror the user's own video (default `true`) | `boolean` \| `undefined` |
| `pageArrowsVisible` | Turns on/off the pagination arrows | `boolean` \| `undefined` |
| `ParticipantViewUISpotlight` | The participant UI for the spotlight view, [see `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `ParticipantViewUIBar` | The participant UI for the participants in the bar, [see `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `VideoPlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) |
| Name | Description | Type |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `participantsBarPosition` | The position of the participants who are not in focus, the default is `bottom`. Providing `null` will hide the bar | `top` \| `bottom` \| `left` \| `right` \| `null` |
| `excludeLocalParticipant` | Whether to exclude the local participant from the layout | `boolean` \| `undefined` |
| `mirrorLocalParticipantVideo` | Whether to mirror the user's own video (default `true`) | `boolean` \| `undefined` |
| `pageArrowsVisible` | Turns on/off the pagination arrows | `boolean` \| `undefined` |
| `ParticipantViewUISpotlight` | The participant UI for the spotlight view, [see `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `ParticipantViewUIBar` | The participant UI for the participants in the bar, [see `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#participantviewui) |
| `VideoPlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#videoplaceholder) |
| `PictureInPicturePlaceholder` | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#pictureinpictureplaceholder) | [See `ParticipantView` documentation](../../../ui-components/core/participant-view/#pictureinpictureplaceholder) |

### `LivestreamLayout`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Override the default UI for rendering participant information/actions.

Override the default UI that's visible when a participant turned off their video.

### `PictureInPicturePlaceholder`

| Type |
| ------------------------------------------- |
| `ComponentType` \| `ReactElement` \| `null` |

Override the default UI that's visible when a participant video is playing in picture-in-picture.

### `trackType`

| Type |
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-sdk",
"version": "1.6.6",
"version": "1.6.7",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ type PaginatedGridLayoutGroupProps = {
* The group of participants to render.
*/
group: Array<StreamVideoParticipant>;
} & Pick<ParticipantViewProps, 'VideoPlaceholder' | 'mirror'> &
} & Pick<
ParticipantViewProps,
'VideoPlaceholder' | 'PictureInPicturePlaceholder' | 'mirror'
> &
Required<Pick<ParticipantViewProps, 'ParticipantViewUI'>>;

const PaginatedGridLayoutGroup = ({
group,
mirror,
VideoPlaceholder,
PictureInPicturePlaceholder,
ParticipantViewUI,
}: PaginatedGridLayoutGroupProps) => {
return (
Expand All @@ -46,6 +50,7 @@ const PaginatedGridLayoutGroup = ({
muteAudio
mirror={mirror}
VideoPlaceholder={VideoPlaceholder}
PictureInPicturePlaceholder={PictureInPicturePlaceholder}
ParticipantViewUI={ParticipantViewUI}
/>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export type SpeakerLayoutProps = {
* @default true
*/
pageArrowsVisible?: boolean;
} & Pick<ParticipantViewProps, 'VideoPlaceholder'>;
} & Pick<
ParticipantViewProps,
'VideoPlaceholder' | 'PictureInPicturePlaceholder'
>;

const DefaultParticipantViewUIBar = () => (
<DefaultParticipantViewUI menuPlacement="top-end" />
Expand All @@ -61,6 +64,7 @@ export const SpeakerLayout = ({
ParticipantViewUIBar = DefaultParticipantViewUIBar,
ParticipantViewUISpotlight = DefaultParticipantViewUI,
VideoPlaceholder,
PictureInPicturePlaceholder,
participantsBarPosition = 'bottom',
participantsBarLimit,
mirrorLocalParticipantVideo = true,
Expand Down Expand Up @@ -151,6 +155,7 @@ export const SpeakerLayout = ({
}
ParticipantViewUI={ParticipantViewUISpotlight}
VideoPlaceholder={VideoPlaceholder}
PictureInPicturePlaceholder={PictureInPicturePlaceholder}
/>
)}
</div>
Expand All @@ -176,6 +181,7 @@ export const SpeakerLayout = ({
participant={participantInSpotlight}
ParticipantViewUI={ParticipantViewUIBar}
VideoPlaceholder={VideoPlaceholder}
PictureInPicturePlaceholder={PictureInPicturePlaceholder}
mirror={mirror}
muteAudio={true}
/>
Expand All @@ -190,6 +196,7 @@ export const SpeakerLayout = ({
participant={participant}
ParticipantViewUI={ParticipantViewUIBar}
VideoPlaceholder={VideoPlaceholder}
PictureInPicturePlaceholder={PictureInPicturePlaceholder}
mirror={mirror}
muteAudio={true}
/>
Expand Down
Loading

0 comments on commit 4f36656

Please sign in to comment.