mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-app: new RecordingProperties and PublisherSpeakingEvents
parent
859ecfbcdd
commit
6cf14dfce2
|
@ -632,7 +632,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
outputMode: this.sessionProperties.defaultRecordingProperties.outputMode,
|
outputMode: this.sessionProperties.defaultRecordingProperties.outputMode,
|
||||||
recordingLayout: this.sessionProperties.defaultRecordingProperties.recordingLayout,
|
recordingLayout: this.sessionProperties.defaultRecordingProperties.recordingLayout,
|
||||||
customLayout: this.sessionProperties.defaultRecordingProperties.customLayout,
|
customLayout: this.sessionProperties.defaultRecordingProperties.customLayout,
|
||||||
resolution: '1920x1080',
|
resolution: '1280x720',
|
||||||
frameRate: 25,
|
frameRate: 25,
|
||||||
hasAudio: true,
|
hasAudio: true,
|
||||||
hasVideo: true,
|
hasVideo: true,
|
||||||
|
|
|
@ -60,8 +60,10 @@ export class TestScenariosComponent implements OnInit, OnDestroy {
|
||||||
sessionProperties: SessionPropertiesAPI = {
|
sessionProperties: SessionPropertiesAPI = {
|
||||||
mediaMode: MediaMode.ROUTED,
|
mediaMode: MediaMode.ROUTED,
|
||||||
recordingMode: RecordingMode.MANUAL,
|
recordingMode: RecordingMode.MANUAL,
|
||||||
defaultRecordingLayout: RecordingLayout.BEST_FIT,
|
defaultRecordingProperties: {
|
||||||
defaultCustomLayout: '',
|
recordingLayout: RecordingLayout.BEST_FIT,
|
||||||
|
customLayout: ''
|
||||||
|
},
|
||||||
customSessionId: ''
|
customSessionId: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ import {
|
||||||
Publisher,
|
Publisher,
|
||||||
StreamEvent,
|
StreamEvent,
|
||||||
VideoInsertMode,
|
VideoInsertMode,
|
||||||
FilterEvent
|
FilterEvent,
|
||||||
|
PublisherSpeakingEvent
|
||||||
} from 'openvidu-browser';
|
} from 'openvidu-browser';
|
||||||
|
|
||||||
import { EventsDialogComponent } from '../dialogs/events-dialog/events-dialog.component';
|
import { EventsDialogComponent } from '../dialogs/events-dialog/events-dialog.component';
|
||||||
|
@ -81,6 +82,8 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
videoElementCreated: true,
|
videoElementCreated: true,
|
||||||
videoElementDestroyed: true,
|
videoElementDestroyed: true,
|
||||||
streamPlaying: true,
|
streamPlaying: true,
|
||||||
|
publisherStartSpeaking: false,
|
||||||
|
publisherStopSpeaking: false,
|
||||||
streamAudioVolumeChange: false,
|
streamAudioVolumeChange: false,
|
||||||
streamPropertyChanged: false
|
streamPropertyChanged: false
|
||||||
};
|
};
|
||||||
|
@ -88,6 +91,8 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
videoElementCreated: false,
|
videoElementCreated: false,
|
||||||
videoElementDestroyed: false,
|
videoElementDestroyed: false,
|
||||||
streamPlaying: false,
|
streamPlaying: false,
|
||||||
|
publisherStartSpeaking: true,
|
||||||
|
publisherStopSpeaking: true,
|
||||||
streamAudioVolumeChange: true,
|
streamAudioVolumeChange: true,
|
||||||
streamPropertyChanged: true
|
streamPropertyChanged: true
|
||||||
});
|
});
|
||||||
|
@ -98,6 +103,8 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
videoElementCreated: true,
|
videoElementCreated: true,
|
||||||
videoElementDestroyed: true,
|
videoElementDestroyed: true,
|
||||||
streamPlaying: true,
|
streamPlaying: true,
|
||||||
|
publisherStartSpeaking: false,
|
||||||
|
publisherStopSpeaking: false,
|
||||||
streamAudioVolumeChange: false,
|
streamAudioVolumeChange: false,
|
||||||
accessAllowed: true,
|
accessAllowed: true,
|
||||||
accessDenied: true,
|
accessDenied: true,
|
||||||
|
@ -113,6 +120,8 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
videoElementCreated: false,
|
videoElementCreated: false,
|
||||||
videoElementDestroyed: false,
|
videoElementDestroyed: false,
|
||||||
streamPlaying: false,
|
streamPlaying: false,
|
||||||
|
publisherStartSpeaking: true,
|
||||||
|
publisherStopSpeaking: true,
|
||||||
streamAudioVolumeChange: true,
|
streamAudioVolumeChange: true,
|
||||||
accessAllowed: false,
|
accessAllowed: false,
|
||||||
accessDenied: false,
|
accessDenied: false,
|
||||||
|
@ -150,7 +159,7 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
subUnsub() {
|
subUnsub() {
|
||||||
const subscriber: Subscriber = <Subscriber>this.streamManager;
|
const subscriber: Subscriber = <Subscriber>this.streamManager;
|
||||||
if (this.subbed) {
|
if (this.subbed) {
|
||||||
this.streamManager.stream.session.unsubscribe(subscriber);
|
this.streamManager.stream.session.unsubscribe(subscriber).then(() => console.log('Unsubbed'));
|
||||||
this.restartRecorder();
|
this.restartRecorder();
|
||||||
|
|
||||||
this.pubSubVideoIcon = '';
|
this.pubSubVideoIcon = '';
|
||||||
|
@ -165,6 +174,8 @@ 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,
|
||||||
|
publisherStartSpeaking: this.eventCollection.publisherStartSpeaking,
|
||||||
|
publisherStopSpeaking: this.eventCollection.publisherStopSpeaking,
|
||||||
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
||||||
streamPropertyChanged: this.eventCollection.streamPropertyChanged
|
streamPropertyChanged: this.eventCollection.streamPropertyChanged
|
||||||
};
|
};
|
||||||
|
@ -283,6 +294,8 @@ 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,
|
||||||
|
publisherStartSpeaking: !this.eventCollection.publisherStartSpeaking,
|
||||||
|
publisherStopSpeaking: !this.eventCollection.publisherStopSpeaking,
|
||||||
streamAudioVolumeChange: !this.eventCollection.streamAudioVolumeChange,
|
streamAudioVolumeChange: !this.eventCollection.streamAudioVolumeChange,
|
||||||
accessAllowed: !this.eventCollection.accessAllowed,
|
accessAllowed: !this.eventCollection.accessAllowed,
|
||||||
accessDenied: !this.eventCollection.accessDenied,
|
accessDenied: !this.eventCollection.accessDenied,
|
||||||
|
@ -299,12 +312,16 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
otherPublisher.once('accessAllowed', () => {
|
otherPublisher.once('accessAllowed', () => {
|
||||||
if (!this.unpublished) {
|
const publishFunc = () => this.streamManager.stream.session.publish(otherPublisher).then(() => {
|
||||||
this.streamManager.stream.session.unpublish(oldPublisher);
|
|
||||||
}
|
|
||||||
this.streamManager.stream.session.publish(otherPublisher).then(() => {
|
|
||||||
this.streamManager = otherPublisher;
|
this.streamManager = otherPublisher;
|
||||||
});
|
});
|
||||||
|
if (!this.unpublished) {
|
||||||
|
this.streamManager.stream.session.unpublish(oldPublisher).then(() => {
|
||||||
|
publishFunc();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
publishFunc();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.publisherChanged = !this.publisherChanged;
|
this.publisherChanged = !this.publisherChanged;
|
||||||
|
@ -364,6 +381,34 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
sub.off('streamPlaying');
|
sub.off('streamPlaying');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.eventCollection.publisherStartSpeaking) {
|
||||||
|
if (!oldValues.publisherStartSpeaking) {
|
||||||
|
sub.on('publisherStartSpeaking', (event: PublisherSpeakingEvent) => {
|
||||||
|
this.updateEventListInParent.emit({
|
||||||
|
eventName: 'publisherStartSpeaking',
|
||||||
|
eventContent: event.connection.connectionId,
|
||||||
|
event
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sub.off('publisherStartSpeaking');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.eventCollection.publisherStopSpeaking) {
|
||||||
|
if (!oldValues.publisherStopSpeaking) {
|
||||||
|
sub.on('publisherStopSpeaking', (event: PublisherSpeakingEvent) => {
|
||||||
|
this.updateEventListInParent.emit({
|
||||||
|
eventName: 'publisherStopSpeaking',
|
||||||
|
eventContent: event.connection.connectionId,
|
||||||
|
event
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sub.off('publisherStopSpeaking');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.eventCollection.streamAudioVolumeChange) {
|
if (this.eventCollection.streamAudioVolumeChange) {
|
||||||
if (!oldValues.streamAudioVolumeChange) {
|
if (!oldValues.streamAudioVolumeChange) {
|
||||||
sub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
|
sub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
|
||||||
|
@ -582,6 +627,34 @@ export class VideoComponent implements OnInit, OnDestroy {
|
||||||
pub.off('streamPlaying');
|
pub.off('streamPlaying');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.eventCollection.publisherStartSpeaking) {
|
||||||
|
if (!oldValues.publisherStartSpeaking) {
|
||||||
|
pub.on('publisherStartSpeaking', (event: PublisherSpeakingEvent) => {
|
||||||
|
this.updateEventListInParent.emit({
|
||||||
|
eventName: 'publisherStartSpeaking',
|
||||||
|
eventContent: event.connection.connectionId,
|
||||||
|
event
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pub.off('publisherStartSpeaking');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.eventCollection.publisherStopSpeaking) {
|
||||||
|
if (!oldValues.publisherStopSpeaking) {
|
||||||
|
pub.on('publisherStopSpeaking', (event: PublisherSpeakingEvent) => {
|
||||||
|
this.updateEventListInParent.emit({
|
||||||
|
eventName: 'publisherStopSpeaking',
|
||||||
|
eventContent: event.connection.connectionId,
|
||||||
|
event
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pub.off('publisherStopSpeaking');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.eventCollection.streamAudioVolumeChange) {
|
if (this.eventCollection.streamAudioVolumeChange) {
|
||||||
if (!oldValues.streamAudioVolumeChange) {
|
if (!oldValues.streamAudioVolumeChange) {
|
||||||
pub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
|
pub.on('streamAudioVolumeChange', (event: StreamManagerEvent) => {
|
||||||
|
@ -602,6 +675,8 @@ 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,
|
||||||
|
publisherStartSpeaking: this.eventCollection.publisherStartSpeaking,
|
||||||
|
publisherStopSpeaking: this.eventCollection.publisherStopSpeaking,
|
||||||
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
||||||
streamPropertyChanged: this.eventCollection.streamPropertyChanged
|
streamPropertyChanged: this.eventCollection.streamPropertyChanged
|
||||||
};
|
};
|
||||||
|
@ -624,6 +699,8 @@ 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,
|
||||||
|
publisherStartSpeaking: this.eventCollection.publisherStartSpeaking,
|
||||||
|
publisherStopSpeaking: this.eventCollection.publisherStopSpeaking,
|
||||||
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
streamAudioVolumeChange: this.eventCollection.streamAudioVolumeChange,
|
||||||
accessAllowed: this.eventCollection.accessAllowed,
|
accessAllowed: this.eventCollection.accessAllowed,
|
||||||
accessDenied: this.eventCollection.accessDenied,
|
accessDenied: this.eventCollection.accessDenied,
|
||||||
|
|
Loading…
Reference in New Issue