openvidu-testapp: streamAudioVolumeChange event added

pull/173/head
pabloFuente 2018-12-07 11:42:02 +01:00
parent 5ac41f3471
commit 5f1565cac0
2 changed files with 37 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import {
import { import {
OpenVidu, Session, Subscriber, Publisher, VideoInsertMode, StreamEvent, ConnectionEvent, OpenVidu, Session, Subscriber, Publisher, VideoInsertMode, StreamEvent, ConnectionEvent,
SessionDisconnectedEvent, SignalEvent, RecordingEvent, SessionDisconnectedEvent, SignalEvent, RecordingEvent,
PublisherSpeakingEvent, PublisherProperties, StreamPropertyChangedEvent, OpenViduError, FilterEvent PublisherSpeakingEvent, PublisherProperties, StreamPropertyChangedEvent, OpenViduError
} from 'openvidu-browser'; } from 'openvidu-browser';
import { import {
OpenVidu as OpenViduAPI, OpenVidu as OpenViduAPI,

View File

@ -76,12 +76,14 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: true, videoElementCreated: true,
videoElementDestroyed: true, videoElementDestroyed: true,
streamPlaying: true, streamPlaying: true,
streamAudioVolumeChange: false,
streamPropertyChanged: false streamPropertyChanged: false
}; };
this.updateSubscriberEvents({ this.updateSubscriberEvents({
videoElementCreated: false, videoElementCreated: false,
videoElementDestroyed: false, videoElementDestroyed: false,
streamPlaying: false, streamPlaying: false,
streamAudioVolumeChange: true,
streamPropertyChanged: true streamPropertyChanged: true
}); });
@ -91,6 +93,7 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: true, videoElementCreated: true,
videoElementDestroyed: true, videoElementDestroyed: true,
streamPlaying: true, streamPlaying: true,
streamAudioVolumeChange: false,
accessAllowed: true, accessAllowed: true,
accessDenied: true, accessDenied: true,
accessDialogOpened: true, accessDialogOpened: true,
@ -105,6 +108,7 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: false, videoElementCreated: false,
videoElementDestroyed: false, videoElementDestroyed: false,
streamPlaying: false, streamPlaying: false,
streamAudioVolumeChange: true,
accessAllowed: false, accessAllowed: false,
accessDenied: false, accessDenied: false,
accessDialogOpened: false, accessDialogOpened: false,
@ -156,6 +160,7 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: this.eventCollection.videoElementCreated, videoElementCreated: this.eventCollection.videoElementCreated,
videoElementDestroyed: this.eventCollection.videoElementDestroyed, videoElementDestroyed: this.eventCollection.videoElementDestroyed,
streamPlaying: this.eventCollection.streamPlaying, streamPlaying: this.eventCollection.streamPlaying,
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
streamPropertyChanged: this.eventCollection.streamPropertyChanged streamPropertyChanged: this.eventCollection.streamPropertyChanged
}; };
this.streamManager = this.streamManager.stream.session.subscribe(subscriber.stream, undefined); this.streamManager = this.streamManager.stream.session.subscribe(subscriber.stream, undefined);
@ -273,6 +278,7 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: !this.eventCollection.videoElementCreated, videoElementCreated: !this.eventCollection.videoElementCreated,
videoElementDestroyed: !this.eventCollection.videoElementDestroyed, videoElementDestroyed: !this.eventCollection.videoElementDestroyed,
streamPlaying: !this.eventCollection.streamPlaying, streamPlaying: !this.eventCollection.streamPlaying,
streamAudioVolumeChange: !this.eventCollection.streamAudioVolumeChange,
accessAllowed: !this.eventCollection.accessAllowed, accessAllowed: !this.eventCollection.accessAllowed,
accessDenied: !this.eventCollection.accessDenied, accessDenied: !this.eventCollection.accessDenied,
accessDialogOpened: !this.eventCollection.accessDialogOpened, accessDialogOpened: !this.eventCollection.accessDialogOpened,
@ -350,6 +356,19 @@ export class VideoComponent implements OnInit, OnDestroy {
sub.off('streamPlaying'); sub.off('streamPlaying');
} }
if (this.eventCollection.streamAudioVolumeChange) {
if (!oldValues.streamAudioVolumeChange) {
sub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
this.updateEventListInParent.emit({
event: 'streamAudioVolumeChange',
content: event.value['newValue']
});
});
}
} else {
sub.off('streamAudioVolumeChange');
}
if (this.eventCollection.streamPropertyChanged) { if (this.eventCollection.streamPropertyChanged) {
if (!oldValues.streamPropertyChanged) { if (!oldValues.streamPropertyChanged) {
sub.on('streamPropertyChanged', (e: StreamPropertyChangedEvent) => { sub.on('streamPropertyChanged', (e: StreamPropertyChangedEvent) => {
@ -508,6 +527,19 @@ export class VideoComponent implements OnInit, OnDestroy {
} else { } else {
pub.off('streamPlaying'); pub.off('streamPlaying');
} }
if (this.eventCollection.streamAudioVolumeChange) {
if (!oldValues.streamAudioVolumeChange) {
pub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
this.updateEventListInParent.emit({
event: 'streamAudioVolumeChange',
content: event.value['newValue']
});
});
}
} else {
pub.off('streamAudioVolumeChange');
}
} }
openSubscriberEventsDialog() { openSubscriberEventsDialog() {
@ -515,6 +547,7 @@ export class VideoComponent implements OnInit, OnDestroy {
videoElementCreated: this.eventCollection.videoElementCreated, videoElementCreated: this.eventCollection.videoElementCreated,
videoElementDestroyed: this.eventCollection.videoElementDestroyed, videoElementDestroyed: this.eventCollection.videoElementDestroyed,
streamPlaying: this.eventCollection.streamPlaying, streamPlaying: this.eventCollection.streamPlaying,
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
streamPropertyChanged: this.eventCollection.streamPropertyChanged streamPropertyChanged: this.eventCollection.streamPropertyChanged
}; };
const dialogRef = this.dialog.open(EventsDialogComponent, { const dialogRef = this.dialog.open(EventsDialogComponent, {
@ -522,7 +555,7 @@ export class VideoComponent implements OnInit, OnDestroy {
eventCollection: this.eventCollection, eventCollection: this.eventCollection,
target: 'Subscriber' target: 'Subscriber'
}, },
width: '280px', width: '295px',
autoFocus: false, autoFocus: false,
disableClose: true disableClose: true
}); });
@ -531,12 +564,12 @@ export class VideoComponent implements OnInit, OnDestroy {
}); });
} }
openPublisherEventsDialog() { openPublisherEventsDialog() {
const oldValues = { const oldValues = {
videoElementCreated: this.eventCollection.videoElementCreated, videoElementCreated: this.eventCollection.videoElementCreated,
videoElementDestroyed: this.eventCollection.videoElementDestroyed, videoElementDestroyed: this.eventCollection.videoElementDestroyed,
streamPlaying: this.eventCollection.streamPlaying, streamPlaying: this.eventCollection.streamPlaying,
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
accessAllowed: this.eventCollection.accessAllowed, accessAllowed: this.eventCollection.accessAllowed,
accessDenied: this.eventCollection.accessDenied, accessDenied: this.eventCollection.accessDenied,
accessDialogOpened: this.eventCollection.accessDialogOpened, accessDialogOpened: this.eventCollection.accessDialogOpened,
@ -550,7 +583,7 @@ export class VideoComponent implements OnInit, OnDestroy {
eventCollection: this.eventCollection, eventCollection: this.eventCollection,
target: 'Publisher' target: 'Publisher'
}, },
width: '280px', width: '295px',
autoFocus: false, autoFocus: false,
disableClose: true disableClose: true
}); });