This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
846 lines (747 loc) · 28.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link href="https://fonts.googleapis.com/css?family=PT+Sans&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/all.min.css">
<!-- <link rel="stylesheet" href="css/theme/black.css"> -->
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/asciinema-player.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/monokai.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-background="images/background.png">
<h1>
<div><img src="images/petsapp.svg" width="10%" class="plain" style="background: none"></div>
<div>PetsApp</div>
</h1>
<h2 class="subtitle">How i started my fake startup with the <b>Janus Mobile SDK</b></h2>
<div style="margin-top: 100px">
<div style="width: 80%; margin-left: auto; margin-right: auto">
<div style="width: 45%; display: inline-block">
<img src="images/januscon.png" height="75px">
</div>
<div style="width: 45%; margin-left: 5%; display: inline-block">
<div style="display: table-row">
<div style="display: table-cell">
<img src="images/me.png" style="border-radius: 50%" height="75px">
</div>
<div style="display: table-cell; padding-left: 25px; padding-top: 10px; vertical-align: top">
<ul class="plain">
<li><div style="text-align: center; width: 15px; display: inline-block"><i class="far fa-id-badge"></i></div> Pasquale Boemio</li>
<li><div style="text-align: center; width: 15px; display: inline-block"><i class="far fa-envelope"></i></div> <a href="mailto:[email protected]">[email protected]</a></li>
<li><div style="text-align: center; width: 15px; display: inline-block"><i class="fab fa-github"></i></div> <a href="https://github.com/helloiampau">@helloiampau</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div style="margin-top: 75px">
<ul style="font-size: 15px">
<li style="text-align: center"><div style="text-align: center; width: 30px; display: inline-block"><i class="fas fa-map-marked-alt"></i></div> Naples (IT)</li>
<li style="text-align: center"><div style="text-align: center; width: 30px; display: inline-block"><i class="far fa-calendar-alt"></i></div> September 23rd-25th 2019</li>
</ul>
</div>
</section>
<section>
<h1><i class="far fa-handshake"></i> Hello!</h1>
<aside class="notes">
Hello, my name is Pasquale. I'm a software engineer for Statwolf.
</aside>
</section>
<section data-background-color="#303F4C">
<a href="https://www.statwolf.com"><img src="images/statwolf.svg" width="30%"></a>
<aside class="notes">
In this talk, I'd like to introduce you to my flatmate Boris, a little red shark living in my sitting room.
</aside>
</section>
<section data-state="boris">
<h1><i class="fas fa-fish"></i> Boris</h1>
<video id="boris" style="border-radius: 5%" loop="true" muted="true" autoplay="true" width="30%">
<source src="images/boris.mp4">
</video>
<aside class="notes">
Boris and I used to have a problem: working for an Irish company from home, very often, like once or twice per month, I have to go to my company headquarter to meet my colleagues. Of course, Boris can't come with me, and it is always complaining about the fact it is still alone.
But Boris is a lucky guy: I have a background in real-time communication, and I approached the problem in a modern way: I created a startup!
</aside>
</section>
<!-- <section> -->
<!-- <img src="/images/trip.png" width="80%" style="border-radius: 3%;"> -->
<!-- </section> -->
<section>
<h1>
<div><img src="images/petsapp.svg" width="10%" class="plain" style="background: none"></div>
<div>PetsApp</div>
</h1>
<h2>A video chat for puppies</h2>
<aside class="notes">
With PetsApp, an owner can communicate with his house pet with a real-time audio video chat.
In this way, Boris can call me every time it feels alone.
</aside>
</section>
<section>
<h1><i class="fas fa-cogs"></i> Application requirements</h1>
<ul>
<li class="fragment"><i class="far fa-user"></i> A user should connect to his own room</li>
<li class="fragment"><i class="fas fa-paw"></i> Each pet should have a streaming device</li>
<li class="fragment"><i class="fas fa-video"></i>The user should watch all the pet feeds at the same time</li>
</ul>
<h1 class="fragment">A basic video room!</h1>
<aside class="notes">
We want this thig to be great, that's why we used WebRTC
</aside>
</section>
<section>
<img src="images/webrtc.png">
</section>
<section>
<h1><i class="fas fa-gift"></i> Minimum viable product</h1>
<img src="images/complete-mvp.svg">
</section>
<section data-transition="slide-in none-out">
<h1><i class="fas fa-server"></i> Server requirements</h1>
<div style="height: 200px">
<ul>
<li class="fragment"><i class="fas fa-users"></i> { User, Room } Management API</li>
<li class="fragment"><i class="fas fa-phone"></i> WebRTC Signaling Server</li>
<li class="fragment"><i class="fas fa-random"></i> { MC, SF } Unit</li>
</ul>
</div>
</section>
<section data-transition="none-in slide-out">
<h1><i class="fas fa-server"></i> Server requirements</h1>
<div style="height: 200px">
<img src="images/janus.png">
</div>
</section>
<section>
<h1><i class="fas fa-gift"></i> Minimum viable product</h1>
<img src="images/janus-mvp.svg">
</section>
<section>
<img src="images/serverless.jpg">
</section>
<!-- <section data-state="run-janus"> -->
<!-- <asciinema-player id="run-janus" src="/cast/runjanus.cast" preload="true" idle-time-limit="1" rows="40"></asciinema> -->
<!-- </section> -->
<section>
<h1><i class="fas fa-server"></i> Client requirements</h1>
<ul>
<li class="fragment"><i class="fas fa-user-friends"></i> Cross-Platform application (iOS, Android, Linux)</li>
<li class="fragment"><i class="fas fa-exclamation"></i><b>Native Application</b></li>
<li class="fragment"><i class="fas fa-thumbs-down"></i>No vendor lock-in</li>
</ul>
</section>
<section>
<h1><i class="fas fa-heart-broken"></i> No solutions available...</h1>
<h1 class="fragment">UNTIL NOW!</h1>
</section>
<section data-transition="fade-out slide-in">
<h1><a href="https://github.com/helloiampau/janus-client">janus-client SDK</a></h1>
<h2>handcrafted with <i class="fas fa-heart"></i> by @helloiampau and Meetecho S.R.L.</h2>
</section>
<section data-background-video="images/party.mp4" data-background-video-loop="true" data-transition="fade-in slide-out">
<h1><a href="https://github.com/helloiampau/janus-client" style="color: white;">janus-client SDK</a></h1>
<h2 style="color: white;">handcrafted with <i class="fas fa-heart"></i> by @helloiampau and Meetecho S.R.L.</h2>
</section>
<section>
<h1><a href="https://github.com/helloiampau/janus-client">janus-client SDK</a></h1>
<ul>
<li class="fragment"><i class="fas fa-check"></i> Cross-Platform SDK</li>
<li class="fragment"><i class="fas fa-mobile"></i> Mobile-First (iOS, Android)</li>
<li class="fragment"><i class="fas fa-box-open"></i> Supports Janus API out-of-the-box</li>
<li class="fragment"><i class="fas fa-stream"></i> Extensible with custom protocols and plugins</li>
<li class="fragment"><i class="fab fa-github"></i>Open Source</li>
</ul>
</section>
<section>
<img src="images/wat.jpg">
</section>
<section>
<img src="images/schema.svg">
<aside class="notes">
I want to tell you a story: have you ever tried to integrate c++ code in mobile applications?
for objective-c world the thing is quite straightforward... the apple compiler understand both c++ and objective c and you can write a mixed module in objective-c++ that looks like a languages frankestein.
for jni the thing is a little different: I'll show you how a JNI code looks like
</aside>
</section>
<section>
<img src="images/jni.jpg">
</section>
<section>
<div>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ZcBtF-JWJhM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</section>
<section>
<h1><a href="https://helloiampau/dropbox/djinni">Djinni</a></h1>
<h2 style="margin-bottom: 25px;">by <i class="fab fa-dropbox"></i> Dropbox</h2>
<h2 class="fragment">
Djinni is a tool for generating cross-language type declarations and interface bindings. It's designed to connect C++ with either Java or Objective-C.
</h2>
<h2 class="fragment">
Djinni can be used to interface cross-platform C++ library code with platform-specific Java and Objective-C on Android and iOS.
</h2>
</section>
<section>
<h1><i class="far fa-file-code"></i> <div class="inline-code">janus-client.djinni</div></h1>
<pre>
<code style="height: 500px" data-no-escape data-trim>
ice_server = record {
url: string;
username: string;
password: string;
}
janus_conf = interface +j +o {
url(): string;
iceServers(): list<ice_server>;
webrtc(): map<string, string>;
}
arg_bundle = interface +c {
setString(key: string, value: string);
getString(key: string): string;
setInt(key: string, value: i32);
getInt(key: string): i32;
setLong(key: string, value: i64);
getLong(key: string): i64;
setBool(key: string, value: bool);
getBool(key: string): bool;
static create(): arg_bundle;
}
transport_delegate = interface +j +o {
onMessage(response: string, context: arg_bundle);
}
transport_type = enum {
HTTP;
}
ready_state = enum {
OFF;
INIT;
READY;
CLOSING;
ERROR;
}
info = record {
name: string;
version: i32;
}
constraints = record {
audio: bool;
video: bool;
offerToReceiveAudio: bool;
offerToReceiveVideo: bool;
}
command = interface +j +o {
action(signaling: signaling, peer: peer, data: string);
}
janus_event = interface +c {
data(): string;
jsep(): jsep;
}
plugin_delegate = interface +j +o {
onEvent(data: janus_event, context: arg_bundle);
onMediaChanged(media: media);
onHangup();
onDetach();
onOffer(sdp: string): string;
onAnswer(sdp: string): string;
}
plugin = interface +c +j +o {
init(signaling: signaling, peer: peer);
detach();
hangup();
setDelegate(delegate: plugin_delegate);
dispatch(name: string, data: arg_bundle);
onEvent(data: janus_event, context: arg_bundle);
onMediaChanged(media: media);
onHangup();
onDetach();
onOffer(sdp: string, context: arg_bundle);
onAnswer(sdp: string, context: arg_bundle);
onIceCandidate(candidate: candidate);
}
plugin_factory = interface +j +o {
info(): janus_plugin_info;
create(): plugin;
}
peer_factory = interface +j +o {
create(conf: janus_conf, delegate: plugin): peer;
}
camera_device = enum {
FRONT;
REAR;
}
local_video_track = interface +j +o {
start(camera: camera_device, width: i32, height: i32, fps: i32);
stop();
changeResolution(width: i32, height: i32, fps: i32);
switchCamera();
}
local_audio_track = interface +j +o {
start();
stop();
}
remote_video_track = interface +j +o {}
audio_device = enum {
EARPIECE;
SPEAKER;
}
remote_audio_track = interface +j +o {
setOutputDevice(device: audio_device);
}
media = interface +j +o {
localVideoTrack(): local_video_track;
localAudioTrack(): local_audio_track;
remoteVideoTrack(): remote_video_track;
remoteAudioTrack(): remote_audio_track;
}
peer = interface +j +o {
createOffer(constraints: constraints, context: arg_bundle);
createAnswer(constraints: constraints, context: arg_bundle);
setLocalDescription(jsep: jsep);
setRemoteDescription(jsep: jsep);
addIceCandidate(candidate: candidate);
getMedia(): media;
close();
}
janus_plugin_info = record {
id: string;
name: string;
version: i32;
}
jsep = interface +c {
type(): string;
sdp(): string;
hasMedia(media: string): bool;
static create(type: string, sdp: string): jsep;
}
candidate = record {
sdpMid: string;
sdpMLineIndex: i32;
candidate: string;
completed: bool;
}
signaling = interface +j +o {
message(body: string, context: arg_bundle);
jsep(body: string, jsep: jsep, context: arg_bundle);
trickle(candidate: candidate);
attach(id: string, context: arg_bundle);
detach();
hangup();
}
protocol = interface +j +o {
info(): info;
readyState(): ready_state;
close();
plugins(): list<janus_plugin_info>;
attach(pluginId: string, context: arg_bundle);
}
protocol_factory = interface +j +o {
bootstrap(conf: janus_conf, platform: platform, delegate: janus_delegate): protocol;
}
janus_error = record {
code: i32;
reason: string;
}
janus_delegate = interface +j +o {
onJanusError(error: janus_error);
onPluginEnabled(id: string, handle: plugin, context: arg_bundle);
}
platform = interface +c {
static create(): platform;
registerProtocolFactory(factory: protocol_factory);
getProtocol(conf: janus_conf, delegate: janus_delegate): protocol;
registerPeerFactory(factory: peer_factory);
createPeer(conf: janus_conf, delegate: plugin): peer;
registerPluginFactory(pluginFactory: plugin_factory);
getPlugin(id: string): plugin;
getPlugins(): list<janus_plugin_info>;
}
janus = interface +c {
static create(platform: platform): janus;
init(conf: janus_conf, delegate: janus_delegate): ready_state;
close(): ready_state;
readyState(): ready_state;
plugins(): list<janus_plugin_info>;
attach(pluginId: string, context: arg_bundle);
}
</code>
</pre>
</section>
<section>
<img src="images/djinni-schema.svg">
</section>
<section>
<h1>
<div><img src="images/petsapp.svg" width="10%" class="plain" style="background: none"></div>
<div>PetsApp</div>
</h1>
</section>
<section data-state="initialize-code">
<asciinema-player id="initialize-code" src="cast/initialize.cast" preload="true" idle-time-limit="1" rows="40"></asciinema>
</section>
<section>
<h1><i class="far fa-file-code"></i> <div class="inline-code">settings.gradle</div></h1>
<pre>
<code data-line-numbers="3,4" data-trim data-no-escape>
include ':app'
include ':janus'
project(':janus').projectDir = new File(settingsDir, './third_party/janus-client/platforms/android/janus')
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> <div class="inline-code">app/build.gradle</div></h1>
<pre>
<code data-line-numbers="30,19-26,7" data-trim data-no-escape>
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.helloiampau.petsapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(path: ':janus')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> <div class="inline-code">app/AndroidManifest.xml</div></h1>
<pre>
<code data-trim data-no-escape data-line-numbers="4-9">
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.helloiampau.petsapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> Code</h1>
<img src="images/studio.png" width="10%">
</section>
<section>
<h1><i class="fas fa-user-friends"></i> Entities</h2>
<ul>
<li><i class="fas fa-dice-one"></i> Base Service</li>
<li><i class="fas fa-puzzle-piece"></i> Plugins</li>
</ul>
<h2 class="fragment">Communication is event driven based on delegate pattern.</h2>
</section>
<section data-transition="slide-in fade-out">
<h1><i class="far fa-file-code"></i> Initialization Code</h1>
<pre>
<code class="hljava" data-line-numbers="1" data-trim data-no-escape>
Janus janus = JanusFactory.create(Commands._context);
JanusConfImpl conf = new JanusConfImpl();
conf.url("http://janus.helloiampau.com/janus");
ReadyState readyState = janus.init(conf, new PetsAppJanusDelegate(janus));
if(readyState != ReadyState.READY) {
Status.get().error("Unable to connect");
return;
}
janus.attach("janus.plugin.videoroom", ArgBundle.create());
</code>
</pre>
</section>
<section data-transition="fade-in fade-out">
<h1><i class="far fa-file-code"></i> Initialization Code</h1>
<pre>
<code class="hljava" data-line-numbers="2-5" data-trim data-no-escape>
Janus janus = JanusFactory.create(Commands._context);
JanusConfImpl conf = new JanusConfImpl();
conf.url("http://janus.helloiampau.com/janus");
ReadyState readyState = janus.init(conf, new PetsAppJanusDelegate(janus));
if(readyState != ReadyState.READY) {
Status.get().error("Unable to connect");
return;
}
janus.attach("janus.plugin.videoroom", ArgBundle.create());
</code>
</pre>
</section>
<section data-transition="fade-in slide-out">
<h1><i class="far fa-file-code"></i> Initialization Code</h1>
<pre>
<code class="hljava" data-line-numbers="12" data-trim data-no-escape>
Janus janus = JanusFactory.create(Commands._context);
JanusConfImpl conf = new JanusConfImpl();
conf.url("http://janus.helloiampau.com/janus");
ReadyState readyState = janus.init(conf, new PetsAppJanusDelegate(janus));
if(readyState != ReadyState.READY) {
Status.get().error("Unable to connect");
return;
}
janus.attach("janus.plugin.videoroom", ArgBundle.create());
</code>
</pre>
</section>
<section data-transition="slide-in fade-out">
<h1><i class="far fa-file-code"></i> JanusDelegate</h1>
<pre>
<code class="hljava" data-line-numbers="1-2,4,6-7,30" data-trim data-no-escape>
@Override
public void onJanusError(JanusError error) {
Status.get().error(error.getReason());
}
@Override
public void onPluginEnabled(String id, Plugin handle, ArgBundle context) {
if(id.equals("janus.plugin.videoroom")) {
Status status = Status.get();
handle.setDelegate(new PublisherPluginDelegate());
status.plugin(handle);
status.session(this._janus);
return;
}
if(id.equals("janus.plugin.videoroom.subscriber")) {
Status status = Status.get();
String subscriberid = context.getString("subscriber-id");
handle.setDelegate(new SubscriberPluginDelegate(subscriberid));
Pet pet = status.pets().getValue().get(subscriberid);
pet.setHandle(handle);
return;
}
}
</code>
</pre>
</section>
<section data-transition="slide-out fade-in">
<h1><i class="far fa-file-code"></i> JanusDelegate</h1>
<pre>
<code class="hljava" data-line-numbers="6-8,17,11,30" data-trim data-no-escape>
@Override
public void onJanusError(JanusError error) {
Status.get().error(error.getReason());
}
@Override
public void onPluginEnabled(String id, Plugin handle, ArgBundle context) {
if(id.equals("janus.plugin.videoroom")) {
Status status = Status.get();
handle.setDelegate(new PublisherPluginDelegate());
status.plugin(handle);
status.session(this._janus);
return;
}
if(id.equals("janus.plugin.videoroom.subscriber")) {
Status status = Status.get();
String subscriberid = context.getString("subscriber-id");
handle.setDelegate(new SubscriberPluginDelegate(subscriberid));
Pet pet = status.pets().getValue().get(subscriberid);
pet.setHandle(handle);
return;
}
}
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> PluginDelegate</h1>
<pre>
<code class="hljava" data-line-numbers="14-33,1-2" data-trim data-no-escape>
@Override
public void onEvent(JanusEvent data, ArgBundle context) {
try {
JSONObject event = new JSONObject(data.data());
if(event.getString("videoroom").equals("joined")) {
Commands.updatePets(event.getJSONArray("publishers"));
Commands.route("room");
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onMediaChanged(Media media) {}
@Override
public void onHangup() {}
@Override
public void onDetach() {}
@Override
public String onOffer(String sdp) {
return sdp;
}
@Override
public String onAnswer(String sdp) {
return sdp;
}
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> Send Commands</h1>
<pre>
<code class="hljava" data-line-numbers="4-8" data-trim data-no-escape>
Status status = Status.get();
Plugin handle = status.plugin().getValue();
ArgBundle bundle = ArgBundle.create();
bundle.setString("display", username);
bundle.setInt("room", 1234);
handle.dispatch("join", bundle);
</code>
</pre>
</section>
<section>
<h1><i class="fas fa-puzzle-piece"></i> Supported plugins</h1>
<ul>
<li><i class="fas fa-check"></i> Echo Test</li>
<li><i class="fas fa-check"></i> Videoroom</li>
<li><i class="fas fa-check"></i> Streaming</li>
</ul>
</section>
<section>
<h1><i class="far fa-file-code"></i> Media View</h1>
<pre>
<code data-trim data-line-numbers="7-9" class="hlxml">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/logo"
android:layout_width="98dp"
android:layout_height="40dp"
app:srcCompat="@drawable/fish" />
<TextView
android:id="@+id/petname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="30dp"/>
</LinearLayout>
<com.github.helloiampau.janus.rtc.MediaView
android:id="@+id/petvideo"
android:layout_width="match_parent"
android:layout_height="240dp">
</com.github.helloiampau.janus.rtc.MediaView>
</LinearLayout>
</code>
</pre>
</section>
<section>
<h1><i class="far fa-file-code"></i> Media View</h1>
<img src="images/mediaview.png" width="50%">
</section>
<section>
<h1><i class="far fa-file-code"></i> Code</h1>
<img src="images/studio.png" width="10%">
</section>
<section data-state="app">
<video id="app" style="border-radius: 5%" muted="true" autoplay="true" width="30%">
<source src="images/app.mp4">
</video>
</section>
<section>
<img src="images/thanks.jpg">
</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
hash: true,
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true }
]
});
</script>
<script src="js/asciinema-player.js"></script>
<script>
Reveal.addEventListener('run-janus', function() {
const p = document.getElementById('run-janus');
p.currentTime = 0;
p.play();
});
Reveal.addEventListener('initialize-code', function() {
const p = document.getElementById('initialize-code');
p.currentTime = 0;
p.play();
});
Reveal.addEventListener('boris', function() {
const v = document.getElementById('boris');
v.currentTime = 0;
v.play();
});
Reveal.addEventListener('app', function() {
const v = document.getElementById('app');
v.currentTime = 0;
v.play();
});
</script>
</body>
</html>