@cloudflare/realtimekit-angular-ui 0.0.0 → 1.0.0-staging.2

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/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # RealtimeKit UI
2
+
3
+ **RealtimeKit UI** provides pre-built, ready-to-use UI components for integrating with [Cloudflare RealtimeKit](https://npmjs.com/package/@cloudflare/realtimekit).
4
+
5
+ If you're using a specific framework (or no framework - see HTML), we also offer dedicated packages:
6
+
7
+ - [React](https://npmjs.com/package/@cloudflare/realtimekit-react-ui)
8
+ - [Vue](https://npmjs.com/package/@cloudflare/realtimekit-vue-ui)
9
+ - [HTML (Web Components)](https://npmjs.com/package/@cloudflare/realtimekit-ui)
10
+
11
+ ## Usage
12
+
13
+ First, install RealtimeKit UI along with [RealtimeKit](https://npmjs.com/package/@cloudflare/realtimekit):
14
+
15
+ > `@cloudflare/realtimekit` is the core package that offers APIs to handle meetings in the client side.
16
+ > You use it to access and perform actions in a meeting.
17
+
18
+ ```sh
19
+ npm i @cloudflare/realtimekit-ui @cloudflare/realtimekit
20
+ ```
21
+
22
+ Then you'll need to initialize a meeting object once you've received an `authToken` of a participant from your APIs.
23
+
24
+ > You call the RealtimeKit Add Participant API from your own backend API to get this `authToken`
25
+ > to use with RealtimeKit.
26
+
27
+ ```js
28
+ import RealtimeKit from '@cloudflare/realtimekit';
29
+
30
+ const meeting = await RealtimeKit.init({
31
+ authToken: '<your-auth-token>',
32
+ defaults: {
33
+ video: true,
34
+ audio: true,
35
+ },
36
+ });
37
+ ```
38
+
39
+ ### Simple Usage
40
+
41
+ Load the component in your template file (component.html):
42
+
43
+ ```html
44
+ <rtk-meeting #myid></rtk-meeting>
45
+ ```
46
+
47
+ Then initialize and pass the meeting object to the component:
48
+
49
+ ```tsx
50
+ import { RtkMeeting } from '@cloudflare/realtimekit-ui';
51
+ import RealtimeKit from '@cloudflare/realtimekit';
52
+
53
+ class AppComponent {
54
+ title = 'MyProject';
55
+ @ViewChild('myid') meetingComponent: RtkMeeting;
56
+ rtkMeeting: RtkClient;
57
+
58
+ async ngAfterViewInit() {
59
+ const meeting = await RealtimeKit.init({
60
+ authToken: '<auth-token>',
61
+ defaults: {
62
+ video: true,
63
+ audio: true,
64
+ },
65
+ });
66
+ meeting.joinRoom();
67
+ this.rtkMeeting = meeting;
68
+ if (this.meetingComponent) this.meetingComponent.meeting = meeting;
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Using RtkUiProvider
74
+
75
+ If you wish to use individual UI components to build your desired UI, you can use the `RtkUiProvider` component to provide the meeting instance to all child components to make development easier.
76
+
77
+ ```html
78
+ <rtk-ui-provider #myid>
79
+ <rtk-simple-grid />
80
+ </rtk-ui-provider>
81
+ ```
82
+
83
+ Then initialize and pass the meeting object to the component:
84
+
85
+ ```tsx
86
+ import { RtkMeeting } from '@cloudflare/realtimekit-ui';
87
+ import RealtimeKit from '@cloudflare/realtimekit';
88
+
89
+ class AppComponent {
90
+ title = 'MyProject';
91
+ @ViewChild('myid') uiProvider: RtkUiProvider;
92
+ rtkMeeting: RtkClient;
93
+
94
+ async ngAfterViewInit() {
95
+ const meeting = await RealtimeKit.init({
96
+ authToken: '<auth-token>',
97
+ defaults: {
98
+ video: true,
99
+ audio: true,
100
+ },
101
+ });
102
+ meeting.joinRoom();
103
+ this.rtkMeeting = meeting;
104
+ if (this.uiProvider) this.uiProvider.meeting = meeting;
105
+ }
106
+ }
107
+ ```