mirror of https://github.com/OpenVidu/openvidu.git
Do not subscribe to audio-only streams in BEST_FIT layout when video-only COMPOSED recording
parent
656dd15b92
commit
27d770b368
|
@ -8,20 +8,20 @@ import { LayoutBestFitComponent } from 'app/components/layouts/layout-best-fit/l
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: DashboardComponent,
|
component: DashboardComponent
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'session/:sessionId',
|
path: 'session/:sessionId',
|
||||||
component: SessionDetailsComponent,
|
component: SessionDetailsComponent
|
||||||
pathMatch: 'full'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'layout-best-fit/:sessionId/:secret',
|
path: 'layout-best-fit/:sessionId/:secret',
|
||||||
component: LayoutBestFitComponent,
|
component: LayoutBestFitComponent
|
||||||
pathMatch: 'full'
|
},
|
||||||
|
{
|
||||||
|
path: 'layout-best-fit/:sessionId/:secret/:onlyVideo',
|
||||||
|
component: LayoutBestFitComponent
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, { useHash: true });
|
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, { useHash: true });
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
||||||
openviduLayout: OpenViduLayout;
|
openviduLayout: OpenViduLayout;
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
secret: string;
|
secret: string;
|
||||||
|
onlyVideo = false;
|
||||||
|
|
||||||
session: Session;
|
session: Session;
|
||||||
subscribers: Subscriber[] = [];
|
subscribers: Subscriber[] = [];
|
||||||
|
@ -41,6 +42,9 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.sessionId = params.sessionId;
|
this.sessionId = params.sessionId;
|
||||||
this.secret = params.secret;
|
this.secret = params.secret;
|
||||||
|
if (params.onlyVideo !== null) {
|
||||||
|
this.onlyVideo = JSON.parse(params.onlyVideo);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +70,24 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
||||||
this.session = OV.initSession();
|
this.session = OV.initSession();
|
||||||
|
|
||||||
this.session.on('streamCreated', (event: StreamEvent) => {
|
this.session.on('streamCreated', (event: StreamEvent) => {
|
||||||
let changeFixedRatio = false;
|
if (!(this.onlyVideo && !event.stream.hasVideo)) {
|
||||||
if (event.stream.typeOfVideo === 'SCREEN') {
|
let changeFixedRatio = false;
|
||||||
this.numberOfScreenStreams++;
|
if (event.stream.typeOfVideo === 'SCREEN') {
|
||||||
changeFixedRatio = true;
|
this.numberOfScreenStreams++;
|
||||||
|
changeFixedRatio = true;
|
||||||
|
}
|
||||||
|
const subscriber: Subscriber = this.session.subscribe(
|
||||||
|
event.stream,
|
||||||
|
undefined,
|
||||||
|
{ subscribeToAudio: event.stream.hasAudio && !this.onlyVideo }
|
||||||
|
);
|
||||||
|
subscriber.on('streamPlaying', (e: StreamManagerEvent) => {
|
||||||
|
const video: HTMLVideoElement = subscriber.videos[0].video;
|
||||||
|
video.parentElement.parentElement.classList.remove('custom-class');
|
||||||
|
this.updateLayout(changeFixedRatio);
|
||||||
|
});
|
||||||
|
this.addSubscriber(subscriber);
|
||||||
}
|
}
|
||||||
const subscriber: Subscriber = this.session.subscribe(event.stream, undefined);
|
|
||||||
subscriber.on('streamPlaying', (e: StreamManagerEvent) => {
|
|
||||||
const video: HTMLVideoElement = subscriber.videos[0].video;
|
|
||||||
video.parentElement.parentElement.classList.remove('custom-class');
|
|
||||||
this.updateLayout(changeFixedRatio);
|
|
||||||
});
|
|
||||||
this.addSubscriber(subscriber);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.session.on('streamDestroyed', (event: StreamEvent) => {
|
this.session.on('streamDestroyed', (event: StreamEvent) => {
|
||||||
|
|
|
@ -457,7 +457,7 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
} else {
|
} else {
|
||||||
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
|
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
|
||||||
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId
|
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId
|
||||||
+ "/" + secret;
|
+ "/" + secret + "/" + !recording.hasAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalUrl;
|
return finalUrl;
|
||||||
|
|
Loading…
Reference in New Issue