Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions app/services/platforms/youtube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ interface IYoutubeServiceState extends IPlatformState {
broadcastStatus: TBroadcastLifecycleStatus | '';
settings: IYoutubeStartStreamOptions;
categories: IYoutubeCategory[];
backupStreamSettings?: IBackUpStreamSettings;
}

interface IBackUpStreamSettings {
service: string;
key: string;
server: string;
streamType: 'rtmp_common' | 'rtmp_custom' | 'whip_custom';
context: TDisplayType;
}

export interface IYoutubeStartStreamOptions extends IExtraBroadcastSettings {
Expand Down Expand Up @@ -537,6 +546,17 @@ export class YoutubeService
// setup key and platform type in the OBS settings
const streamKey = stream.cdn.ingestionInfo.streamName;

//save user's current rtmp_common settings to restore after Go Live since they are overwritten here
const currentSettings = this.streamSettingsService.settings;
if (!this.state.backupStreamSettings) {
this.state.backupStreamSettings = {} as IBackUpStreamSettings;
}
this.state.backupStreamSettings.service = currentSettings.service;
this.state.backupStreamSettings.key = currentSettings.key;
this.state.backupStreamSettings.server = currentSettings.server;
this.state.backupStreamSettings.streamType = currentSettings.streamType;
this.state.backupStreamSettings.context = !context ? 'horizontal' : context;

if (!this.streamingService.views.isMultiplatformMode) {
this.streamSettingsService.setSettings(
{
Expand Down Expand Up @@ -598,6 +618,18 @@ export class YoutubeService
this.SET_VERTICAL_BROADCAST({} as IYoutubeLiveBroadcast);
this.SET_VERTICAL_STREAM_KEY('');
this.streamSettingsService.setGoLiveSettings({ customDestinations: destinations });

//restore user's previous settings in case they were overwritten on Go Live
this.streamSettingsService.setSettings(
{
platform: 'youtube',
service: this.state.backupStreamSettings.service,
key: this.state.backupStreamSettings.key,
streamType: this.state.backupStreamSettings.streamType,
server: this.state.backupStreamSettings.server,
},
this.state.backupStreamSettings.context,
);
}

/**
Expand Down
Loading