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 = [
|
||||
{
|
||||
path: '',
|
||||
component: DashboardComponent,
|
||||
pathMatch: 'full'
|
||||
component: DashboardComponent
|
||||
},
|
||||
{
|
||||
path: 'session/:sessionId',
|
||||
component: SessionDetailsComponent,
|
||||
pathMatch: 'full'
|
||||
component: SessionDetailsComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-best-fit/:sessionId/:secret',
|
||||
component: LayoutBestFitComponent,
|
||||
pathMatch: 'full'
|
||||
component: LayoutBestFitComponent
|
||||
},
|
||||
{
|
||||
path: 'layout-best-fit/:sessionId/:secret/:onlyVideo',
|
||||
component: LayoutBestFitComponent
|
||||
}
|
||||
];
|
||||
|
||||
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, { useHash: true });
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
|||
openviduLayout: OpenViduLayout;
|
||||
sessionId: string;
|
||||
secret: string;
|
||||
onlyVideo = false;
|
||||
|
||||
session: Session;
|
||||
subscribers: Subscriber[] = [];
|
||||
|
@ -41,6 +42,9 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
|
|||
this.route.params.subscribe(params => {
|
||||
this.sessionId = params.sessionId;
|
||||
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.on('streamCreated', (event: StreamEvent) => {
|
||||
let changeFixedRatio = false;
|
||||
if (event.stream.typeOfVideo === 'SCREEN') {
|
||||
this.numberOfScreenStreams++;
|
||||
changeFixedRatio = true;
|
||||
if (!(this.onlyVideo && !event.stream.hasVideo)) {
|
||||
let changeFixedRatio = false;
|
||||
if (event.stream.typeOfVideo === 'SCREEN') {
|
||||
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) => {
|
||||
|
|
|
@ -457,7 +457,7 @@ public class ComposedRecordingService extends RecordingService {
|
|||
} else {
|
||||
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
|
||||
finalUrl = "https://OPENVIDUAPP:" + secret + "@" + location + "/#/layout-" + layout + "/" + shortSessionId
|
||||
+ "/" + secret;
|
||||
+ "/" + secret + "/" + !recording.hasAudio();
|
||||
}
|
||||
|
||||
return finalUrl;
|
||||
|
|
Loading…
Reference in New Issue