Skip to content
Open
Show file tree
Hide file tree
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
40 changes: 21 additions & 19 deletions app/services/restream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,25 +769,27 @@ export class RestreamService extends StatefulService<IRestreamState> {
// in dual output mode, we need to set the ingest for each display
const displays = this.streamInfo.displaysToRestream;

displays.forEach(async display => {
const mode = this.getMode(display);
const settings = await this.fetchUserSettings(mode);

this.streamSettingsService.setSettings(
{
streamType: 'rtmp_custom',
},
display,
);

this.streamSettingsService.setSettings(
{
key: settings.streamKey,
server: ingest,
},
display,
);
});
await Promise.all(
displays.map(async display => {
const mode = this.getMode(display);
const settings = await this.fetchUserSettings(mode);

this.streamSettingsService.setSettings(
{
streamType: 'rtmp_custom',
},
display,
);

this.streamSettingsService.setSettings(
{
key: settings.streamKey,
server: ingest,
},
display,
);
}),
);
} else {
// in single output mode, we just set the ingest for the default display
this.streamSettingsService.setSettings({
Expand Down
2 changes: 1 addition & 1 deletion app/services/streaming/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export class StreamingService
const isVerticalDualStreamDestination =
this.views.hasDualStream &&
this.views.activeDisplayPlatforms.vertical.length === 1 &&
currentCustomDestinations.length > 0;
this.views.activeDisplayDestinations.vertical.length === 0;

if (isVerticalCustomDestination || isVerticalDualStreamDestination) {
// set the OBS context to custom ingest mode in order to update settings
Expand Down
56 changes: 47 additions & 9 deletions test/regular/streaming/youtube.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logIn } from '../../helpers/modules/user';
import { addCustomDestination, logIn } from '../../helpers/modules/user';
import {
skipCheckingErrorsInLog,
test,
Expand All @@ -19,6 +19,7 @@ import {

import {
click,
clickButton,
closeWindow,
focusChild,
focusMain,
Expand All @@ -29,8 +30,9 @@ import {
import * as moment from 'moment';
import { fillForm, useForm } from '../../helpers/modules/forms';
import { ListInputController } from '../../helpers/modules/forms/list';
import { logOut } from '../../helpers/webdriver/user';
import { toggleDualOutputMode } from '../../helpers/modules/dual-output';
import { logOut, releaseUserInPool } from '../../helpers/webdriver/user';
import { goLiveWithDualOutput, toggleDualOutputMode } from '../../helpers/modules/dual-output';
import { showSettingsWindow } from '../../helpers/modules/settings/settings';

// not a react hook
// eslint-disable-next-line react-hooks/rules-of-hooks
Expand All @@ -39,32 +41,38 @@ useWebdriver();
// Some accounts in the user pool may not be enabled for live streaming or need to be reauthed
async function logInYouTubeEnabledAccount(
t: TExecutionContext,
retries: number = 3,
retries: number = 5,
ultra: boolean = false,
): Promise<boolean | void> {
// only exclude multistream accounts on the first attempt to expand the user pool on later attempts
const multistream = retries === 3 ? false : undefined;
const multistream = retries === 5 ? false : undefined;
if (retries === 0) {
t.fail(
'No YouTube accounts with live streaming enabled are currently available in the user pool',
);
return;
}

await logIn('youtube', { multistream, streamingIsDisabled: false, notStreamable: false });
await logIn('youtube', {
prime: ultra,
multistream: ultra || multistream,
streamingIsDisabled: false,
notStreamable: false,
});
await prepareToGoLive();
await clickGoLive();

const isEnabled = await isDisplayed('div[data-name="youtube-settings"]', { timeout: 5000 });
if (!isEnabled) {
await logOut(t);
// try again to get an account that has streaming enabled
return await logInYouTubeEnabledAccount(t, retries - 1);
return await logInYouTubeEnabledAccount(t, retries - 1, ultra);
}

await closeWindow('child');

// return true if we had a retry so that we can skip checking errors in the log for account reasons
const retried = retries !== 3;
const retried = retries !== 5;

if (retried) {
skipCheckingErrorsInLog();
Expand All @@ -84,19 +92,49 @@ test('Streaming to Youtube', async t => {

t.true(await chatIsVisible(), 'Chat should be visible');
await stopStream();
});

test('YouTube Dual Stream', async t => {
await logInYouTubeEnabledAccount(t, 5, true);
await toggleDualOutputMode();
await clickGoLive();
await waitForSettingsWindowLoaded();
await fillForm({
title: 'SLOBS Test Stream',
description: 'SLOBS Test Stream Description',
youtubeDisplay: 'both',
});
await waitForSettingsWindowLoaded();
await submit();
await waitForStreamStart();
await stopStream();

t.pass('Streamed to YouTube single output and dual stream successfully');
const { user, name } = await addCustomDestination(t);

try {
await clickGoLive();
await waitForSettingsWindowLoaded();
await fillForm({ [name]: true });
await waitForSettingsWindowLoaded();

// Test custom destination with horizontal display
await fillForm({
youtubeDisplay: 'both',
[`${name}Display`]: 'horizontal',
});
await goLiveWithDualOutput('youtube');

// Test custom destination with vertical display
await clickGoLive();
await waitForSettingsWindowLoaded();
await goLiveWithDualOutput('youtube');
} finally {
Comment on lines +127 to +131
await showSettingsWindow('Stream', async () => {
await click('i.fa-trash');
await clickButton('Close');
});
await releaseUserInPool(user);
}
});

// TODO flaky
Expand Down
Loading