Skip to content

Commit 314e7d1

Browse files
committed
add readme
1 parent a9d9b21 commit 314e7d1

File tree

3 files changed

+304
-146
lines changed

3 files changed

+304
-146
lines changed

README.md

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,145 @@
1-
# blastream-node-sdk
1+
2+
# Blastream NodeJS Sdk
3+
4+
All URIs are relative to *https://api.v2.blastream.com/api-docs*
5+
6+
### Install
7+
8+
```
9+
npm install blastream
10+
```
11+
12+
### Init
13+
14+
```js
15+
const Blastream = require('blastream');
16+
let PUBLIC_KEY = 'XXXXXX';
17+
let PRIVATE_KEY = 'YYYYYY';
18+
let blastream = new Blastream(PUBLIC_KEY, PRIVATE_KEY);
19+
```
20+
21+
### Examples
22+
23+
#### createOrGetChannel
24+
```js
25+
let channel = await blastream.createOrGetChannel('my-channel');
26+
let iframe = channel.getIframe(800, 600, {
27+
username: 'admin_user'
28+
});
29+
console.log(iframe);
30+
```
31+
32+
33+
#### createCollaborator
34+
```js
35+
let channel = await blastream.createOrGetChannel('my-channel');
36+
let colaborator = await channel.createOrGetCollaborator('alan', 'animator'); //The collaborator username is unique for a channel
37+
let iframe = colaborator.getIframe(800, 600);
38+
console.log('iframe', iframe);
39+
```
40+
41+
42+
#### createParticipant
43+
```js
44+
let channel = await blastream.createOrGetParticipant('my-channel', 'my-part');
45+
let iframe = channel.getIframe(800, 600);
46+
console.log('iframe', iframe);
47+
```
48+
49+
50+
#### getReplays
51+
```js
52+
let channel = await blastream.createOrGetChannel('my-channel');
53+
let list = await channel.getReplays();
54+
console.log('replays', list);
55+
```
56+
57+
58+
#### registerHook
59+
```js
60+
let res = await blastream.registerHook('https://http.jay.invaders.stream/hook_from_blastream.php');
61+
console.log('res', res);
62+
63+
```
64+
65+
66+
#### updateSubscription
67+
```js
68+
let channel = await blastream.createOrGetChannel('my-channel');
69+
let res = await channel.updateSubscription('pro2', 'hourly');
70+
console.log('res', res);
71+
```
72+
73+
74+
#### setAccessRule
75+
```js
76+
let channel = await blastream.createOrGetChannel('my-channel');
77+
let res = await channel.setAccessRule('PRIVATE', {
78+
knock: 1 //can be knock or password, if you set password you have to put the password value : password => 'my-password'
79+
});
80+
console.log('res', res);
81+
```
82+
83+
84+
#### updateSettings
85+
```js
86+
let channel = await blastream.createOrGetChannel('my-channel');
87+
let res = await channel.updateSettings({
88+
autojoin: 1
89+
});
90+
console.log('res', res);
91+
```
92+
93+
94+
#### updateCollaborator
95+
```js
96+
let channel = await blastream.createOrGetChannel('my-channel');
97+
let colaborator = await channel.createOrGetCollaborator('Collaborator Username', 'moderator');
98+
let res = await colaborator.update('New username', 'animator');
99+
console.log('res', res);
100+
```
101+
102+
103+
#### updateCustom
104+
```js
105+
let channel = await blastream.createOrGetChannel('my-channel');
106+
let upload = await channel.uploadPic('logo.png');
107+
let res = await channel.setCustom({
108+
colors: [
109+
"#ff0000",
110+
"#ff0000",
111+
"#ff0000",
112+
"#ff0000"
113+
],
114+
js: 'alert(\'ok\')',
115+
css: '',
116+
logo: upload.file
117+
});
118+
console.log('res', res)
119+
```
120+
121+
122+
#### updateScene
123+
```js
124+
let channel = await blastream.createOrGetChannel('my-channel');
125+
let scenes = await channel.getScenes();
126+
127+
//can be 'overlay', 'logo' or 'background'
128+
let upload = await channel.uploadScenePic('overlay', 'logo.png');
129+
for(var i in scenes) {
130+
let scene = scenes[i];
131+
if(scene.isDefault()) {
132+
let res = await scene.update({
133+
overlay: {
134+
src: upload['file'],
135+
play: true
136+
},
137+
background: {
138+
color: '#ff0000'
139+
}
140+
});
141+
console.log('res', res);
142+
}
143+
}
144+
```
145+

README_TPL.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# Blastream NodeJS Sdk
3+
4+
All URIs are relative to *https://api.v2.blastream.com/api-docs*
5+
6+
### Install
7+
8+
```
9+
npm install blastream
10+
```
11+
12+
### Init
13+
14+
```js
15+
const Blastream = require('blastream');
16+
let PUBLIC_KEY = 'XXXXXX';
17+
let PRIVATE_KEY = 'YYYYYY';
18+
let blastream = new Blastream(PUBLIC_KEY, PRIVATE_KEY);
19+
```
20+
21+
### Examples
22+
23+
[SAMPLES]

0 commit comments

Comments
 (0)