@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 CHANGED
@@ -1,22 +1,25 @@
1
+ BSD 2-Clause License
1
2
 
2
- MIT License
3
+ Copyright (c) 2022, Digital Samba
4
+ All rights reserved.
3
5
 
4
- Copyright (c) 2022 Digital Samba
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
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
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
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
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
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
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 defintitions are also available:
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 successfuly initialize an instance of the wrapper one of following combinations needs to be used:
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('*', (data) => {
81
- console.log(data)
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.1"></script>
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="https://localhost:3000/Public" class="if"></iframe>-->
13
+ <!--<iframe allow="camera; microphone; display-capture; autoplay;" src="<>" class="if"></iframe>-->
14
14
 
15
- <div class="log">
15
+ <div class="log">
16
16
 
17
- </div>
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('.isfp');
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
- const api = new DigitalSambaEmbedded({ root: parent, team: 'alex.dev.monza', room: 'Public' });
45
- //const api = new DigitalSambaEmbedded({ frame});
46
- //const api = new DigitalSambaEmbedded({ url: 'https://localhost:3000/Public'}, {reportErrors: true});
47
-
48
- //const api = DigitalSambaEmbedded.createControl({ url: 'https://localhost:3000/Public'});
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 = 700;
53
- api.frame.height = 500;
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 JOINED: ${JSON.stringify(data)}</p>`
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digitalsamba/embedded-sdk",
3
3
  "packageManager": "yarn@3.1.0",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "license" : "BSD-2-Clause",
6
6
  "scripts": {
7
7
  "build": "npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types",