@@ -37,15 +37,6 @@ interface IYoutubeServiceState extends IPlatformState {
3737 broadcastStatus : TBroadcastLifecycleStatus | '' ;
3838 settings : IYoutubeStartStreamOptions ;
3939 categories : IYoutubeCategory [ ] ;
40- backupStreamSettings ?: IBackUpStreamSettings ;
41- }
42-
43- interface IBackUpStreamSettings {
44- service : string ;
45- key : string ;
46- server : string ;
47- streamType : 'rtmp_common' | 'rtmp_custom' | 'whip_custom' ;
48- context : TDisplayType ;
4940}
5041
5142export interface IYoutubeStartStreamOptions extends IExtraBroadcastSettings {
@@ -488,7 +479,29 @@ export class YoutubeService
488479 this . setPlatformContext ( 'youtube' ) ;
489480 }
490481
482+ /**
483+ * Prepare the stream for live output editing
484+ * @remark Live output editing cannot dual stream. As a safety measure, if there is
485+ * any local vertical broadcast data on state, clear it
486+ */
487+ async setupLiveOutputStream ( options ?: IGoLiveSettings ) : Promise < void > {
488+ if ( ! this . state . verticalStreamKey && ! this . state . verticalBroadcast . id ) return ;
489+
490+ const destinations = this . streamingService . views . customDestinations . filter (
491+ dest => dest . streamKey !== this . state . verticalStreamKey ,
492+ ) ;
493+
494+ this . SET_VERTICAL_BROADCAST ( { } as IYoutubeLiveBroadcast ) ;
495+ this . SET_VERTICAL_STREAM_KEY ( '' ) ;
496+ this . streamSettingsService . setGoLiveSettings ( { customDestinations : destinations } ) ;
497+ }
498+
491499 async setupDualStream ( goLiveSettings : IGoLiveSettings ) {
500+ // Live output editing currently cannot use dual stream so guard against it
501+ if ( goLiveSettings . liveOutputEditing ) {
502+ return ;
503+ }
504+
492505 const ytSettings = getDefined ( goLiveSettings . platforms . youtube ) ;
493506 const title = makeVerticalTitle ( ytSettings . title ) ;
494507
@@ -602,17 +615,6 @@ export class YoutubeService
602615 // setup key and platform type in the OBS settings
603616 const streamKey = stream . cdn . ingestionInfo . streamName ;
604617
605- //save user's current rtmp_common settings to restore after Go Live since they are overwritten here
606- const currentSettings = this . streamSettingsService . settings ;
607- if ( ! this . state . backupStreamSettings ) {
608- this . state . backupStreamSettings = { } as IBackUpStreamSettings ;
609- }
610- this . state . backupStreamSettings . service = currentSettings . service ;
611- this . state . backupStreamSettings . key = currentSettings . key ;
612- this . state . backupStreamSettings . server = currentSettings . server ;
613- this . state . backupStreamSettings . streamType = currentSettings . streamType ;
614- this . state . backupStreamSettings . context = ! context ? 'horizontal' : context ;
615-
616618 if ( ! this . streamingService . views . isMultiplatformMode ) {
617619 // Note: This was previously changed to `rtmp_custom` for dual streaming but
618620 // it now works with `rtmp_common` as well.
@@ -627,7 +629,10 @@ export class YoutubeService
627629 ) ;
628630 }
629631
630- if ( ytSettings . display === 'both' ) {
632+ // Live output editing is checked first so dual stream is never set up when live output editing is enabled.
633+ if ( goLiveSettings . liveOutputEditing ) {
634+ await this . setupLiveOutputStream ( goLiveSettings ) ;
635+ } else if ( ytSettings . display === 'both' ) {
631636 try {
632637 // Prevent rate limit errors by delaying the dual stream setup by 1 second
633638 await new Promise < void > ( resolve => {
@@ -684,20 +689,6 @@ export class YoutubeService
684689 this . SET_VERTICAL_BROADCAST ( { } as IYoutubeLiveBroadcast ) ;
685690 this . SET_VERTICAL_STREAM_KEY ( '' ) ;
686691 this . streamSettingsService . setGoLiveSettings ( { customDestinations : destinations } ) ;
687-
688- //restore user's previous settings in case they were overwritten on Go Live
689- if ( this . state . backupStreamSettings ) {
690- this . streamSettingsService . setSettings (
691- {
692- platform : 'youtube' ,
693- service : this . state . backupStreamSettings . service ,
694- key : this . state . backupStreamSettings . key ,
695- streamType : this . state . backupStreamSettings . streamType ,
696- server : this . state . backupStreamSettings . server ,
697- } ,
698- this . state . backupStreamSettings . context ,
699- ) ;
700- }
701692 }
702693
703694 /**
0 commit comments