@digitalsamba/embedded-sdk 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -17
- package/README.md +12 -7
- package/dist/index.html +19 -16
- package/package.json +1 -1
package/LICENSE
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
+
BSD 2-Clause License
|
1
2
|
|
2
|
-
|
3
|
+
Copyright (c) 2022, Digital Samba
|
4
|
+
All rights reserved.
|
3
5
|
|
4
|
-
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
5
8
|
|
6
|
-
|
7
|
-
of
|
8
|
-
in the Software without restriction, including without limitation the rights
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
11
|
-
furnished to do so, subject to the following conditions:
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
15
|
|
16
|
-
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
@@ -21,7 +21,7 @@ const DigitalSambaEmbedded = require('@digitalsamba/embedded-sdk')
|
|
21
21
|
import DigitalSambaEmbedded from '@digitalsamba/embedded-sdk'
|
22
22
|
```
|
23
23
|
|
24
|
-
This package is written in TypeScript, so type
|
24
|
+
This package is written in TypeScript, so type definitions are also available:
|
25
25
|
|
26
26
|
```ts
|
27
27
|
import { SendMessageType, ReceiveMessageType, /* ...etc */} from '@digitalsamba/embedded-sdk'
|
@@ -56,9 +56,9 @@ api.load(InstanceProperties /* optional */)
|
|
56
56
|
* `url` - full URL to be applied as frame src. Must include protocol and `token` query param for private rooms;
|
57
57
|
* `team` - team name string
|
58
58
|
* `room` - room identifier string
|
59
|
-
* `token` - optional string, for private rooms
|
59
|
+
* `token` - optional string for authentication, mainly for private rooms
|
60
60
|
|
61
|
-
To
|
61
|
+
To successfully initialize an instance of the wrapper one of following combinations needs to be used:
|
62
62
|
|
63
63
|
* `root + team + room` - will create a controlled frame inside `root` element
|
64
64
|
* `frame + team + room` - will attach to existing frame
|
@@ -77,14 +77,19 @@ Remember to always specify `allow="camera; microphone; display-capture; autoplay
|
|
77
77
|
To listen for events, attach listener for any of supported events:
|
78
78
|
|
79
79
|
```js
|
80
|
-
api.on('
|
81
|
-
|
80
|
+
api.on('userJoined', (data) => {
|
81
|
+
// ...
|
82
82
|
});
|
83
83
|
|
84
|
-
|
85
|
-
api.on('userJoined', (data) => {
|
84
|
+
api.on('userLeft', (data) => {
|
86
85
|
// ...
|
87
86
|
});
|
87
|
+
|
88
|
+
// you can also listen to all events simultaneously
|
89
|
+
api.on('*', (data) => {
|
90
|
+
console.log(data)
|
91
|
+
});
|
92
|
+
|
88
93
|
```
|
89
94
|
Also see `dist/index.html` for more examples.
|
90
95
|
|
package/dist/index.html
CHANGED
@@ -5,16 +5,16 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
6
6
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
7
7
|
<title>Document</title>
|
8
|
-
<script src="https://unpkg.com/@digitalsamba/embedded-sdk@0.0.
|
8
|
+
<script src="https://unpkg.com/@digitalsamba/embedded-sdk@0.0.5"></script>
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div class="ifp" style="display: flex">
|
12
12
|
|
13
|
-
<!--<iframe allow="camera; microphone; display-capture; autoplay;" src="
|
13
|
+
<!--<iframe allow="camera; microphone; display-capture; autoplay;" src="<>" class="if"></iframe>-->
|
14
14
|
|
15
|
-
|
15
|
+
<div class="log">
|
16
16
|
|
17
|
-
|
17
|
+
</div>
|
18
18
|
|
19
19
|
</div>
|
20
20
|
<div class="div" style=" border: 1px solid yellow">
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<button class="c8">stopScreenshare</button>
|
30
30
|
</div>
|
31
31
|
<script async defer>
|
32
|
-
const parent = document.querySelector('.
|
32
|
+
const parent = document.querySelector('.ifp');
|
33
33
|
const frame = document.querySelector('.if');
|
34
34
|
const btn0 = document.querySelector('.c0');
|
35
35
|
const btn1 = document.querySelector('.c1');
|
@@ -40,17 +40,22 @@
|
|
40
40
|
const btn6 = document.querySelector('.c6');
|
41
41
|
const btn7 = document.querySelector('.c7');
|
42
42
|
const btn8 = document.querySelector('.c8');
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
|
44
|
+
// change these values to connect to your room
|
45
|
+
const TEAM = 'some-team';
|
46
|
+
const ROOM = 'some-room';
|
47
|
+
const ROOM_URL = 'https://localhost:3000/Public'
|
48
|
+
|
49
|
+
//const api = new DigitalSambaEmbedded({ root: parent, team: TEAM, room: ROOM});
|
50
|
+
//const api = new DigitalSambaEmbedded({ frame});
|
51
|
+
//const api = new DigitalSambaEmbedded({ url: ROOM_URL}, {reportErrors: true});
|
52
|
+
|
53
|
+
const api = DigitalSambaEmbedded.createControl({ url: ROOM_URL});
|
49
54
|
|
50
55
|
const log = document.querySelector('.log');
|
51
56
|
|
52
|
-
api.frame.width =
|
53
|
-
api.frame.height =
|
57
|
+
api.frame.width = 900;
|
58
|
+
api.frame.height = 700;
|
54
59
|
|
55
60
|
btn0.onclick = () => {api.load({ frameAttributes: {style: "border: 5px solid red"}, reportErrors: true })}
|
56
61
|
btn1.onclick = () => {api.toggleVideo()}
|
@@ -72,11 +77,9 @@
|
|
72
77
|
});
|
73
78
|
|
74
79
|
api.on('userLeft', (data) => {
|
75
|
-
log.innerHTML += `<p>${Number(new Date)}: USER
|
80
|
+
log.innerHTML += `<p>${Number(new Date)}: USER LEFT: ${JSON.stringify(data)}</p>`
|
76
81
|
});
|
77
82
|
|
78
|
-
|
79
|
-
|
80
83
|
</script>
|
81
84
|
|
82
85
|
</body>
|
package/package.json
CHANGED