1- const qiniu = require ( " ../index.js" ) ;
1+ const qiniu = require ( ' ../index.js' )
22
3- //ak, sk 获取参考 https://developer.qiniu.com/dora/kb/3702/QiniuToken
4- var ACCESS_KEY = "ak" ;
5- var SECRET_KEY = "sk" ;
6- var credentials = new qiniu . Credentials ( ACCESS_KEY , SECRET_KEY ) ;
3+ // ak, sk 获取参考 https://developer.qiniu.com/dora/kb/3702/QiniuToken
4+ var ACCESS_KEY = 'ak'
5+ var SECRET_KEY = 'sk'
6+ var credentials = new qiniu . Credentials ( ACCESS_KEY , SECRET_KEY )
77
8-
9- //参考 https://github.com/pili-engineering/QNRTC-Server/blob/master/docs/api.md
8+ // 参考 https://github.com/pili-engineering/QNRTC-Server/blob/master/docs/api.md
109
1110var data = {
12- " hub" : " your hub" ,
13- " title" : " your title" ,
14- " maxUsers" : 10 ,
15- " noAutoKickUser" : true
16- } ;
11+ ' hub' : ' your hub' ,
12+ ' title' : ' your title' ,
13+ ' maxUsers' : 10 ,
14+ ' noAutoKickUser' : true
15+ }
1716
1817qiniu . app . createApp ( data , credentials , function ( err , res ) {
19- if ( err ) {
20- console . log ( err ) ;
21- } else {
22- console . log ( res ) ;
23- }
24- } ) ;
18+ if ( err ) {
19+ console . log ( err )
20+ } else {
21+ console . log ( res )
22+ }
23+ } )
2524
26- qiniu . app . getApp ( " appId" , credentials , function ( err , res ) {
27- if ( err ) {
28- console . log ( err ) ;
29- } else {
30- console . log ( res ) ;
31- }
32- } ) ;
25+ qiniu . app . getApp ( ' appId' , credentials , function ( err , res ) {
26+ if ( err ) {
27+ console . log ( err )
28+ } else {
29+ console . log ( res )
30+ }
31+ } )
3332
34- qiniu . app . deleteApp ( " appId" , credentials , function ( err , res ) {
35- if ( err ) {
36- console . log ( err )
37- } else {
38- console . log ( res )
39- }
40- } ) ;
33+ qiniu . app . deleteApp ( ' appId' , credentials , function ( err , res ) {
34+ if ( err ) {
35+ console . log ( err )
36+ } else {
37+ console . log ( res )
38+ }
39+ } )
4140
4241var data1 = {
43- "hub" : "your hub" ,
44- "title" : "your title" ,
45- "maxUsers" : 10 ,
46- "noAutoKickUser" : true ,
47- "mergePublishRtmp" :{
48- "enable" : true ,
49- "audioOnly" : true ,
50- "height" : 1920 ,
51- "width" : 1080 ,
52- "fps" : 60 ,
53- "kbps" : 1000 ,
54- "url" : "rtmp://xxx.example.com/test" ,
55- "streamTitle" : "meeting"
56- }
57- } ;
58-
59-
60- qiniu . app . updateApp ( "appId" , data1 , credentials , function ( err , res ) {
61- if ( err ) {
62- console . log ( err ) ;
63- } else {
64- console . log ( res ) ;
65- }
42+ 'hub' : 'your hub' ,
43+ 'title' : 'your title' ,
44+ 'maxUsers' : 10 ,
45+ 'noAutoKickUser' : true ,
46+ 'mergePublishRtmp' : {
47+ 'enable' : true ,
48+ 'audioOnly' : true ,
49+ 'height' : 1920 ,
50+ 'width' : 1080 ,
51+ 'fps' : 60 ,
52+ 'kbps' : 1000 ,
53+ 'url' : 'rtmp://xxx.example.com/test' ,
54+ 'streamTitle' : 'meeting'
55+ }
56+ }
57+ qiniu . app . updateApp ( 'appId' , data1 , credentials , function ( err , res ) {
58+ if ( err ) {
59+ console . log ( err )
60+ } else {
61+ console . log ( res )
62+ }
6663} )
67-
68-
69- qiniu . room . listUser ( "appId" , "roomName" , credentials , function ( err , res ) {
70- if ( err ) {
71- console . log ( err ) ;
72- } else {
73- console . log ( res ) ;
74- }
64+ qiniu . room . listUser ( 'appId' , 'roomName' , credentials , function ( err , res ) {
65+ if ( err ) {
66+ console . log ( err )
67+ } else {
68+ console . log ( res )
69+ }
7570} )
7671
77- qiniu . room . kickUser ( " appId" , " roomName" , " userId" , credentials , function ( err , res ) {
78- if ( err ) {
79- console . log ( err ) ;
80- } else {
81- console . log ( res ) ;
82- }
72+ qiniu . room . kickUser ( ' appId' , ' roomName' , ' userId' , credentials , function ( err , res ) {
73+ if ( err ) {
74+ console . log ( err )
75+ } else {
76+ console . log ( res )
77+ }
8378} )
8479
85- //type of(offset limit) = Num such as 5 10
86- qiniu . room . listActiveRoom ( " appId" , " prefix" , " offset" , " limit" , credentials , function ( err , res ) {
87- if ( err ) {
88- console . log ( err ) ;
89- } else {
90- console . log ( res ) ;
91- }
80+ // type of(offset limit) = Num such as 5 10
81+ qiniu . room . listActiveRoom ( ' appId' , ' prefix' , ' offset' , ' limit' , credentials , function ( err , res ) {
82+ if ( err ) {
83+ console . log ( err )
84+ } else {
85+ console . log ( res )
86+ }
9287} )
9388
94-
95- //expireAt = 1524128577 or empty
89+ // expireAt = 1524128577 or empty
9690var roomAccess = {
97- " appId" : " your appId" ,
98- " roomName" : " your roomName" ,
99- " userId" : " userId" ,
100- " expireAt" : 1524128577 ,
101- " permission" : " admin"
91+ ' appId' : ' your appId' ,
92+ ' roomName' : ' your roomName' ,
93+ ' userId' : ' userId' ,
94+ ' expireAt' : 1524128577 ,
95+ ' permission' : ' admin'
10296}
10397
104- Console . log ( qiniu . room . roomToken ( roomAccess , credentials ) ) ;
98+ console . log ( qiniu . room . roomToken ( roomAccess , credentials ) )
0 commit comments