-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.1 documentation review feedback (#290)
- Loading branch information
Showing
16 changed files
with
499 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
docusaurus/video/docusaurus/docs/api/_common_/create-call.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
You can create a call by providing the call type and an ID: | ||
|
||
- The [call type](/api/call_types/builtin) controls which features are enabled and sets up permissions. Call type settings and permissions can be set from API, or using the [Stream Dashboard](https://dashboard.getstream.io/). | ||
- Calls IDs can be reused, which means they can be joined multiple times, so it's possible to set up recurring calls. | ||
|
||
You can optionally restrict call access by providing a list of existing users. | ||
|
||
It's also possible to store any custom data with the call object. | ||
|
||
<Tabs groupId="examples"> | ||
<TabItem value="js" label="JavaScript"> | ||
|
||
```js | ||
const callType = 'default'; | ||
const callId = 'my-first-call'; | ||
const call = client.video.call(callType, callId); | ||
|
||
call.create({ data: { created_by_id: 'john' } }); | ||
|
||
// optionally provide additional data | ||
call.create({ | ||
data: { | ||
created_by_id: 'john', | ||
// Call members need to be existing users | ||
members: [{ user_id: 'john', role: 'admin' }, { user_id: 'jack' }], | ||
custom: { | ||
color: 'blue', | ||
}, | ||
}, | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="py" label="Python"> | ||
|
||
```py | ||
from getstream.models.call_request import CallRequest | ||
|
||
call = client.video.call("default", "id") | ||
response = call.create( | ||
data=CallRequest( | ||
created_by_id="sacha", | ||
), | ||
) | ||
|
||
# optionally provide additional data | ||
response = call.create( | ||
data=CallRequest( | ||
created_by_id="sacha", | ||
# Call members need to be existing users | ||
members=[ | ||
MemberRequest(user_id: "john", role: "admin"), | ||
MemberRequest(user_id: "jack"), | ||
], | ||
custom={"color": "blue"}, | ||
), | ||
) | ||
``` | ||
|
||
</TabItem> | ||
|
||
<TabItem value="curl" label="cURL"> | ||
|
||
```bash | ||
curl -X POST "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_key=${API_KEY}" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: ${JWT_TOKEN}" \ | ||
-d '{ | ||
"data": { | ||
"created_by_id": "[email protected]", | ||
"settings_override": { "audio": { "access_request_enabled": false } } | ||
}, | ||
"members": [ { "role": "speaker", "user_id": "[email protected]" } ] | ||
}' | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
docusaurus/video/docusaurus/docs/api/_common_/manage-call-members.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
You can restrict call access by defining a list of members who are allowed to join the call. Call members need to be existing users. Every call member has a call-level role, [you can configure roles](/api/call_types/permissions/) on the call type. | ||
|
||
Call members can receive [push notifications](/api/call_types/settings/#push-notifications-settings). | ||
|
||
<Tabs groupId="examples"> | ||
<TabItem value="js" label="JavaScript"> | ||
|
||
```js | ||
// Call members need to be existing users | ||
call.updateCallMembers({ | ||
// You can add new members | ||
// You can also update the role of existing members | ||
update_members: [{ user_id: 'sara' }, { user_id: 'emily', role: 'admin' }], | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="py" label="Python"> | ||
|
||
```py | ||
# Call members need to be existing users | ||
# You can also update the role of existing members | ||
call.update_members(update_members=[ | ||
MemberRequest(user_id: "sara"), | ||
MemberRequest(user_id: "emily", role: "admin")]) | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="curl" label="cURL"> | ||
|
||
```bash | ||
curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}/members?api_key=${API_KEY}" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: ${JWT_TOKEN}" \ | ||
-d '{ | ||
"update_members": [ | ||
{ "user_id": "sara" }, | ||
{ "user_id": "emily", "role": "admin" } | ||
] | ||
}' | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
You can also remove call members: | ||
|
||
<Tabs groupId="examples"> | ||
<TabItem value="js" label="JavaScript"> | ||
|
||
```js | ||
call.updateCallMembers({ | ||
remove_members: ['sara'], | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="py" label="Python"> | ||
|
||
```py | ||
call.update_members( | ||
remove_members=[ | ||
MemberRequest(user_id: 'jack', role: 'admin') | ||
] | ||
) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,50 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
|
||
<Tabs groupId="examples"> | ||
<TabItem value="js" label="JavaScript"> | ||
|
||
```js | ||
const resp = await call.getOrCreate({ data: { created_by_id: 'john' } }); | ||
// user ID of an existing user | ||
const resp = await call.get(); | ||
|
||
// userId of existing user | ||
const userId = 'jane'; | ||
await client.upsertUsers({ | ||
users: { | ||
[userId]: { | ||
id: userId, | ||
}, | ||
}, | ||
}); | ||
const token = client.createToken(userId); | ||
const rtmpURL = resp.call.ingress.rtmp.address; | ||
const streamKey = token; | ||
|
||
const address = resp.call.ingress.rtmp.address.replace( | ||
'<your_token_here>', | ||
token, | ||
); | ||
console.log(rtmpURL, streamKey); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="py" label="Python"> | ||
|
||
```py | ||
response = call.create(GetOrCreateCallRequest( | ||
data=CallRequest( | ||
created_by_id="sacha", | ||
), | ||
),) | ||
resp = call.get() | ||
# user ID of an existing user | ||
user_id = 'jane' | ||
client.upsert_users( | ||
users={ | ||
user_id: {'id': user_id} | ||
} | ||
) | ||
|
||
# the token will be valid for 1 hour | ||
exp = int(time.time()) + 60 * 60 | ||
|
||
token = client.create_token(user_id,expiration=exp) | ||
|
||
rtmp_url = response.data().call.ingress.rtmp.address | ||
stream_key = token | ||
print(rtmp_url, stream_key) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
</Tabs> |
55 changes: 55 additions & 0 deletions
55
docusaurus/video/docusaurus/docs/api/_common_/update-call.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
Default call settings are inherited from the [call type](/api/call_types/settings/). These settings can be overridden if necessary. | ||
|
||
<Tabs groupId="examples"> | ||
<TabItem value="js" label="JavaScript"> | ||
|
||
```js | ||
call.update({ | ||
settings_override: { | ||
audio: { mic_default_on: true, default_device: 'speaker' }, | ||
}, | ||
}); | ||
|
||
// or to update custom data | ||
call.update({ custom: { color: 'red' } }); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="py" label="Python"> | ||
|
||
```py | ||
call.update( | ||
settings_override=CallSettingsRequest( | ||
audio=AudioSettingsRequest( | ||
mic_default_on=True, | ||
default_device="speaker", | ||
), | ||
) | ||
) | ||
|
||
# or to update custom data | ||
call.update(custom= { 'color': 'red' }) | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="curl" label="cURL"> | ||
|
||
```bash | ||
curl -X PUT "https://video.stream-io-api.com/video/call/default/${CALL_ID}?api_key=${API_KEY}" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: ${JWT_TOKEN}" \ | ||
-d '{ | ||
"settings_override": { | ||
"audio": { | ||
"mic_default_on": true | ||
} | ||
} | ||
}' | ||
|
||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
Oops, something went wrong.