Skip to content

Commit

Permalink
Merge branch 'main' into perf/computed-observables-share-replay
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz authored Sep 26, 2023
2 parents 91d9734 + ca0b540 commit bd32297
Show file tree
Hide file tree
Showing 20 changed files with 260 additions and 114 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).

### [0.3.22](https://github.com/GetStream/stream-video-js/compare/client0.3.21...client0.3.22) (2023-09-25)


### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.3.21](https://github.com/GetStream/stream-video-js/compare/client0.3.20...client0.3.21) (2023-09-20)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Joining a call from a link
description: Learn how you can add a flow where users can join from a link.
---

Many video calling apps that offer video and audio conferencing features, support joining a call from a link.
This is a great way to allow users to join a call without having to go through many complex steps.

In the next few steps, we will show how such a flow can be implemented using the Stream's Video SDKs.

## Define the URL structure

The first step is to define the URL structure that will be used to join a call.
Typically, the URL will contain the following information:

- your app's domain
- an optional route pointing to the calling features of your app
- the call ID
- optional call type information, in case your app supports multiple call types

In our example, we will use the following URL structure:

- `https://myapp.com/join?call_id=123&call_type=default`

## Get call information and join a call

Once the user opens the link, your app needs to read the call ID and call type from the URL as they are required parameters for our SDK.
Next, we will use the call information to setup and join the call.

In the example below, we will use standard browser APIs to read the call ID and call type from the URL.

```ts
import { StreamVideoClient } from '@stream-io/video-client';

const urlParams = new URLSearchParams(window.location.search);
const callId = urlParams.get('call_id');
const callType = urlParams.get('call_type') || 'default'; // or your custom call type

// initialize the client, call and join the call
const client = new StreamVideoClient({ apiKey, user, token });
const call = client.call(callType, callId);
await call.join();
```
5 changes: 2 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-client",
"version": "0.3.21",
"version": "0.3.22",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down Expand Up @@ -48,15 +48,14 @@
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-typescript": "^11.1.2",
"@types/jsonwebtoken": "^9.0.1",
"@types/rimraf": "^3.0.2",
"@types/sdp-transform": "^2.4.6",
"@types/ua-parser-js": "^0.7.36",
"@types/ws": "^8.5.4",
"@vitest/coverage-v8": "^0.34.4",
"dotenv": "^16.3.1",
"happy-dom": "^11.0.2",
"prettier": "^2.8.4",
"rimraf": "^3.0.2",
"rimraf": "^5.0.1",
"rollup": "^3.28.1",
"typescript": "^4.9.5",
"vite": "^4.4.9",
Expand Down
30 changes: 18 additions & 12 deletions packages/client/src/helpers/DynascaleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { ViewportTracker } from './ViewportTracker';
import { getLogger } from '../logger';
import { getSdkInfo } from '../client-details';
import { isFirefox, isSafari } from './browsers';

const DEFAULT_VIEWPORT_VISIBILITY_STATE: Record<
VideoTrackType,
Expand Down Expand Up @@ -274,6 +275,14 @@ export class DynascaleManager {
}
});

videoElement.autoplay = true;
videoElement.playsInline = true;

// explicitly marking the element as muted will allow autoplay to work
// without prior user interaction:
// https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
videoElement.muted = true;

const streamSubscription = participant$
.pipe(
distinctUntilKeyChanged(
Expand All @@ -284,22 +293,19 @@ export class DynascaleManager {
const source =
trackType === 'videoTrack' ? p.videoStream : p.screenShareStream;
if (videoElement.srcObject === source) return;
setTimeout(() => {
videoElement.srcObject = source ?? null;
if (videoElement.srcObject) {
videoElement.srcObject = source ?? null;
if (isSafari() || isFirefox()) {
setTimeout(() => {
videoElement.srcObject = source ?? null;
videoElement.play().catch((e) => {
this.logger('warn', `Failed to play stream`, e);
});
}
}, 0);
// we add extra delay until we attempt to force-play
// the participant's media stream in Firefox and Safari,
// as they seem to have some timing issues
}, 25);
}
});
videoElement.playsInline = true;
videoElement.autoplay = true;

// explicitly marking the element as muted will allow autoplay to work
// without prior user interaction:
// https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
videoElement.muted = true;

return () => {
requestTrackWithDimensions(DebounceType.FAST, undefined);
Expand Down
7 changes: 7 additions & 0 deletions packages/i18n/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).

### [0.1.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/i18n-0.1.1...@stream-io/i18n-0.1.2) (2023-09-25)


### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.1.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/i18n-0.1.0...@stream-io/i18n-0.1.1) (2023-07-17)


Expand Down
4 changes: 2 additions & 2 deletions packages/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"i18next": "^22.4.15"
},
"devDependencies": {
"rimraf": "^5.0.0",
"rimraf": "^5.0.1",
"typescript": "^4.9.5"
},
"version": "0.1.1"
"version": "0.1.2"
}
11 changes: 11 additions & 0 deletions packages/react-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

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

### [0.2.23](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.2.22...@stream-io/video-react-bindings-0.2.23) (2023-09-25)

### Dependency Updates

* `@stream-io/i18n` updated to version `0.1.2`
* `@stream-io/video-client` updated to version `0.1.0`

### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.2.22](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.2.21...@stream-io/video-react-bindings-0.2.22) (2023-09-20)

### Dependency Updates
Expand Down
5 changes: 2 additions & 3 deletions 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": "0.2.22",
"version": "0.2.23",
"packageManager": "[email protected]",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -31,9 +31,8 @@
"@stream-io/i18n": "workspace:^",
"@stream-io/video-client": "workspace:^",
"@types/react": "^18.0.26",
"@types/rimraf": "^3.0.2",
"react": "^18.2.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.1",
"typescript": "^4.9.5"
}
}
12 changes: 12 additions & 0 deletions packages/react-native-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).

### [0.0.20](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.19...@stream-io/video-react-native-sdk-0.0.20) (2023-09-25)

### Dependency Updates

* `@stream-io/i18n` updated to version `0.1.2`
* `@stream-io/video-client` updated to version `0.1.0`
* `@stream-io/video-react-bindings` updated to version `0.2.23`

### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.0.19](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.18...@stream-io/video-react-native-sdk-0.0.19) (2023-09-20)

### Dependency Updates
Expand Down
5 changes: 2 additions & 3 deletions 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": "0.0.19",
"version": "0.0.20",
"packageManager": "[email protected]",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
Expand Down Expand Up @@ -106,7 +106,6 @@
"@types/react-native": "^0.70.4",
"@types/react-native-incall-manager": "^3.2.1",
"@types/react-test-renderer": "^18",
"@types/rimraf": "^3.0.2",
"jest": "^29.5.0",
"react-native": "0.71.8",
"react-native-builder-bob": "^0.21.3",
Expand All @@ -117,7 +116,7 @@
"react-native-svg": "^13.6.0",
"react-native-voip-push-notification": "3.3.1",
"react-test-renderer": "^18.2.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
Expand Down
13 changes: 13 additions & 0 deletions packages/react-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

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

### [0.3.26](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.3.25...@stream-io/video-react-sdk-0.3.26) (2023-09-25)

### Dependency Updates

* `@stream-io/i18n` updated to version `0.1.2`
* `@stream-io/video-client` updated to version `0.1.0`
* `@stream-io/video-react-bindings` updated to version `0.2.23`
* `@stream-io/video-styling` updated to version `0.1.8`

### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.3.25](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.3.24...@stream-io/video-react-sdk-0.3.25) (2023-09-20)

### Dependency Updates
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: Joining a call from a link
description: Learn how you can add a flow where users can join from a link.
---

Many video calling apps that offer video and audio conferencing features, support joining a call from a link.
This is a great way to allow users to join a call without having to go through many complex steps.

In the next few steps, we will show how such a flow can be implemented using the Stream's React Video SDKs.

## Define the URL structure

The first step is to define the URL structure that will be used to join a call.
Typically, the URL will contain the following information:

- your app's domain
- an optional route pointing to the calling features of your app
- the call ID
- optional call type information, in case your app supports multiple call types

In our example, we will use the following URL structure:

- `https://myapp.com/join?call_id=123&call_type=default`

## Get call information and join a call

Once the user opens the link, your app needs to read the call ID and call type from the URL as they are required parameters for our SDK.
Next, we will use the call information to setup and join the call.

In the example below, we will use standard browser APIs to read the call ID and call type from the URL.

```tsx
import {
CallControls,
SpeakerLayout,
StreamCall,
StreamVideo,
StreamVideoClient,
} from '@stream-io/video-react-sdk';

const urlParams = new URLSearchParams(window.location.search);
const callId = urlParams.get('call_id');
const callType = urlParams.get('call_type') || 'default'; // or your custom call type

// initialize the client, call and join the call
const client = new StreamVideoClient({ apiKey, user, token });
const call = client.call(callType, callId);
await call.join();

export const MyCallingApp = () => {
return (
<StreamVideo client={client}>
<StreamCall call={call}>
<SpeakerLayout />
<CallControls />
</StreamCall>
</StreamVideo>
);
};
```

## Integration popular routing libraries

In the React ecosystem, there are many routing libraries that can be used to handle routing in your app.
In the next few steps, we will show how you can integrate the Stream's React Video SDKs with some of the most popular routing libraries.

### React Router

[React Router](https://reactrouter.com) provides a [`useParams`](https://reactrouter.com/en/main/hooks/use-params) hook that can be used to read the call ID and call type from the URL.

### Next.js Router

[Next.js](https://nextjs.org) provides a [`useRouter`](https://nextjs.org/docs/api-reference/next/router#userouter) hook that can be used to read the call ID and call type from the URL.

Alternatively, you can use the [`useParams`](https://nextjs.org/docs/app/api-reference/functions/use-params) hook in case it is more convenient for your use case.
5 changes: 2 additions & 3 deletions 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": "0.3.25",
"version": "0.3.26",
"packageManager": "[email protected]",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -46,10 +46,9 @@
"devDependencies": {
"@stream-io/video-styling": "workspace:^",
"@types/prop-types": "^15.7.5",
"@types/rimraf": "^3.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.1",
"typescript": "^4.9.5"
}
}
7 changes: 7 additions & 0 deletions packages/styling/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).

### [0.1.8](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-styling-0.1.7...@stream-io/video-styling-0.1.8) (2023-09-25)


### Bug Fixes

* Add extra delay before attempting to play video in Safari and Firefox ([#1106](https://github.com/GetStream/stream-video-js/issues/1106)) ([5b4a589](https://github.com/GetStream/stream-video-js/commit/5b4a58918240a7b63807726609d6d54b92cfe1d2))

### [0.1.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-styling-0.1.6...@stream-io/video-styling-0.1.7) (2023-09-20)


Expand Down
5 changes: 2 additions & 3 deletions packages/styling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"build": "sass index.scss ./dist/css/styles.css"
},
"devDependencies": {
"@types/rimraf": "^3.0.2",
"rimraf": "^3.0.2",
"rimraf": "^5.0.1",
"sass": "^1.62.1"
},
"version": "0.1.7"
"version": "0.1.8"
}
Loading

0 comments on commit bd32297

Please sign in to comment.