Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2022-06-20 14:38:47 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2022-06-20 19:38:04 +0300
commit4eee6dfb961fd45a82f6a080fac2c2357b5aeb9a (patch)
tree39b4ae7e389d340c7ebdb0fcea5973a922fb84a1 /docs
parent114f4522f69f0ec8e42e869c93be9b4079483594 (diff)
Add helper methods to join calls and leave calls and rooms
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/Talkbuchet.js66
1 files changed, 63 insertions, 3 deletions
diff --git a/docs/Talkbuchet.js b/docs/Talkbuchet.js
index dc706d322..51ff7d3ce 100644
--- a/docs/Talkbuchet.js
+++ b/docs/Talkbuchet.js
@@ -216,7 +216,8 @@ const conversationApiVersion = extractFeatureVersion('conversation')
const talkOcsApiUrl = host + '/ocs/v2.php/apps/spreed/api/'
const signalingSettingsUrl = talkOcsApiUrl + 'v' + signalingApiVersion + '/signaling/settings'
const signalingBackendUrl = talkOcsApiUrl + 'v' + signalingApiVersion + '/signaling/backend'
-let joinRoomUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/room/' + token + '/participants/active'
+let joinLeaveRoomUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/room/' + token + '/participants/active'
+let joinLeaveCallUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/call/' + token
const publishers = []
const subscribers = []
@@ -399,7 +400,7 @@ class Signaling extends EventTarget {
fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + appToken)
}
- const joinRoomResponse = await fetch(joinRoomUrl, fetchOptions)
+ const joinRoomResponse = await fetch(joinLeaveRoomUrl, fetchOptions)
const joinRoomResult = await joinRoomResponse.json()
const nextcloudSessionId = joinRoomResult.ocs.data.sessionId
@@ -411,6 +412,64 @@ class Signaling extends EventTarget {
},
})
}
+
+ async joinCall(flags) {
+ const fetchOptions = {
+ headers: {
+ 'OCS-ApiRequest': true,
+ 'Accept': 'json',
+ },
+ method: 'POST',
+ body: new URLSearchParams({
+ flags,
+ }),
+ }
+
+ if (user) {
+ fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + appToken)
+ }
+
+ await fetch(joinLeaveCallUrl, fetchOptions)
+ }
+
+ async leaveCall() {
+ const fetchOptions = {
+ headers: {
+ 'OCS-ApiRequest': true,
+ 'Accept': 'json',
+ },
+ method: 'DELETE',
+ }
+
+ if (user) {
+ fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + appToken)
+ }
+
+ await fetch(joinLeaveCallUrl, fetchOptions)
+ }
+
+ async leaveRoom() {
+ const fetchOptions = {
+ headers: {
+ 'OCS-ApiRequest': true,
+ 'Accept': 'json',
+ },
+ method: 'DELETE',
+ }
+
+ if (user) {
+ fetchOptions.headers['Authorization'] = 'Basic ' + btoa(user + ':' + appToken)
+ }
+
+ await fetch(joinLeaveRoomUrl, fetchOptions)
+
+ this.send({
+ 'type': 'room',
+ 'room': {
+ 'roomid': '',
+ },
+ })
+ }
}
/**
@@ -861,7 +920,8 @@ const setCredentials = function(userToSet, appTokenToSet) {
const setToken = function(tokenToSet) {
token = tokenToSet
- joinRoomUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/room/' + token + '/participants/active'
+ joinLeaveRoomUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/room/' + token + '/participants/active'
+ joinLeaveCallUrl = talkOcsApiUrl + 'v' + conversationApiVersion + '/call/' + token
}
const setPublishersAndSubscribersCount = function(publishersCountToSet, subscribersPerPublisherCountToSet) {