-
Auto join
-
-
+
Auto join
+
+
diff --git a/openvidu-testapp/src/app/components/test-sessions/test-sessions.component.ts b/openvidu-testapp/src/app/components/test-sessions/test-sessions.component.ts
index 691b0a24..8008ec21 100644
--- a/openvidu-testapp/src/app/components/test-sessions/test-sessions.component.ts
+++ b/openvidu-testapp/src/app/components/test-sessions/test-sessions.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { OpenviduParamsService } from '../../services/openvidu-params.service';
+import { TestFeedService } from '../../services/test-feed.service';
import { SessionConf } from '../openvidu-instance/openvidu-instance.component';
@Component({
@@ -14,6 +15,7 @@ export class TestSessionsComponent implements OnInit, OnDestroy {
openviduSecret: string;
paramsSubscription: Subscription;
+ eventsInfoSubscription: Subscription;
// OpenViduInstance collection
users: SessionConf[] = [];
@@ -21,7 +23,7 @@ export class TestSessionsComponent implements OnInit, OnDestroy {
numberSubs = 3;
autoJoin = false;
- constructor(private openviduParamsService: OpenviduParamsService) { }
+ constructor(private openviduParamsService: OpenviduParamsService, private testFeedService: TestFeedService) { }
ngOnInit() {
const openviduParams = this.openviduParamsService.getParams();
@@ -33,6 +35,11 @@ export class TestSessionsComponent implements OnInit, OnDestroy {
this.openviduUrl = params.openviduUrl;
this.openviduSecret = params.openviduSecret;
});
+
+ this.eventsInfoSubscription = this.testFeedService.newLastEvent$.subscribe(
+ newEvent => {
+ (window as any).myEvents += ('
' + JSON.stringify(newEvent));
+ });
}
ngOnDestroy() {
@@ -49,6 +56,14 @@ export class TestSessionsComponent implements OnInit, OnDestroy {
});
}
+ private removeUser(): void {
+ this.users.pop();
+ }
+
+ private removeAllUsers(): void {
+ this.users = [];
+ }
+
private loadSubsPubs(n: number): void {
for (let i = 0; i < n; i++) {
this.users.push({
diff --git a/openvidu-testapp/src/app/services/test-feed.service.spec.ts b/openvidu-testapp/src/app/services/test-feed.service.spec.ts
new file mode 100644
index 00000000..405cc490
--- /dev/null
+++ b/openvidu-testapp/src/app/services/test-feed.service.spec.ts
@@ -0,0 +1,15 @@
+import { TestBed, inject } from '@angular/core/testing';
+
+import { TestFeedService } from './test-feed.service';
+
+describe('TestFeedService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [TestFeedService]
+ });
+ });
+
+ it('should be created', inject([TestFeedService], (service: TestFeedService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/openvidu-testapp/src/app/services/test-feed.service.ts b/openvidu-testapp/src/app/services/test-feed.service.ts
new file mode 100644
index 00000000..a21bc4b6
--- /dev/null
+++ b/openvidu-testapp/src/app/services/test-feed.service.ts
@@ -0,0 +1,21 @@
+import { Injectable } from '@angular/core';
+import { Subject } from 'rxjs/Subject';
+
+@Injectable()
+export class TestFeedService {
+
+ lastEvent;
+ newLastEvent$ = new Subject
();
+
+ constructor() { }
+
+ getLastEvent() {
+ return this.lastEvent;
+ }
+
+ pushNewEvent(session: string, connection: string, event: string, eventContent: string) {
+ this.lastEvent = ({ session: session, connection: connection, event: event, eventContent: eventContent });
+ this.newLastEvent$.next(this.lastEvent);
+ }
+
+}
diff --git a/openvidu-testapp/src/index.html b/openvidu-testapp/src/index.html
index 1fd2f900..9a60cd50 100644
--- a/openvidu-testapp/src/index.html
+++ b/openvidu-testapp/src/index.html
@@ -14,6 +14,10 @@
+
+