Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(recording): make live-streaming dialog service-agnostic (#8955) (#17870)

Muskan Kumari7b4f3f5e8c17
diff --git a/config.js b/config.js
index 2b8724f204..5d2e8199df 100644
--- a/config.js
+++ b/config.js
@@ -533,6 +533,10 @@ var config = {
// },
// Customize the Live Streaming dialog. Can be modified for a non-YouTube provider.
+ // When googleApiApplicationClientID is set, termsLink and dataPrivacyLink default to YouTube/Google
+ // links, and validatorRegExpString defaults to the 4-group YouTube key format.
+ // When googleApiApplicationClientID is not set, termsLink and dataPrivacyLink are not shown by default
+ // unless configured here, and validatorRegExpString defaults to accepting RTMP/RTMPS URLs and stream keys.
// liveStreaming: {
// // Whether to enable live streaming or not.
// enabled: false,
diff --git a/lang/main.json b/lang/main.json
index d4b7e71567..2474a19e4e 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -763,6 +763,7 @@
"chooseCTA": "Choose a streaming option. You're currently logged in as {{email}}.",
"chooseCTAWithChangeSignIn": "Choose a streaming option. You're currently logged in as {{email}}. <0>Switch accounts.</0>",
"enterStreamKey": "Enter your YouTube live stream key here.",
+ "enterStreamKeyGeneric": "Enter your live stream key or RTMP URL here.",
"error": "Live Streaming failed. Please try again.",
"errorAPI": "An error occurred while accessing your YouTube broadcasts. Please try logging in again.",
"errorLiveStreamNotEnabled": "Live Streaming is not enabled on {{email}}. Please enable live streaming or log into an account with live streaming enabled.",
@@ -780,6 +781,7 @@
"onBy": "{{name}} started the live streaming",
"pending": "Starting Live Stream…",
"policyError": "You tried to start a live stream too quickly. Please try again later!",
+ "privacyPolicy": "Privacy Policy",
"serviceName": "Live Streaming service",
"sessionAlreadyActive": "This session is already being recorded or live streamed.",
"signIn": "Sign in with Google",
@@ -788,6 +790,7 @@
"signedInAs": "You are currently signed in as:",
"start": "Start a live stream",
"streamIdHelp": "What's this?",
+ "terms": "Terms of service",
"title": "Live Stream",
"unavailableTitle": "Live Streaming unavailable",
"youTubeGoLiveWarning": "Remember to click 'Go Live' in YouTube Studio if Auto-Start/Auto-Stop are disabled. Otherwise the stream will not begin recording.",
diff --git a/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts b/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
index f0214d5f1a..042baecc13 100644
--- a/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
+++ b/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
@@ -20,10 +20,13 @@ export type LiveStreaming = {
};
export type LiveStreamingProps = {
+ dataPrivacyLabelKey: string;
dataPrivacyURL?: string;
enabled: boolean;
helpURL?: string;
+ streamKeyPlaceholderKey: string;
streamLinkRegexp: RegExp;
+ termsLabelKey: string;
termsURL?: string;
};
diff --git a/react/features/recording/components/LiveStream/constants.ts b/react/features/recording/components/LiveStream/constants.ts
index 1f83107b9b..38c7fd8729 100644
--- a/react/features/recording/components/LiveStream/constants.ts
+++ b/react/features/recording/components/LiveStream/constants.ts
@@ -24,3 +24,12 @@ export const JITSI_LIVE_STREAMING_HELP_LINK = 'https://jitsi.org/live';
*/
export const FOUR_GROUPS_DASH_SEPARATED = /^(?:[a-zA-Z0-9]{4}(?:-(?!$)|$)){4}/;
+/**
+ * Default stream key or RTMP/RTMPS URL RegExp for generic live streaming.
+ * Accepts:
+ * - RTMP/RTMPS URLs (case-insensitive, e.g. rtmp://domain.com/live/key, RTMP://...)
+ * - Generic stream keys of at least 6 characters (e.g. Owncast, Facebook, Twitch, allowing punctuation and query parameters).
+ */
+export const STREAM_KEY_OR_URL_REGEXP
+ = /^(?:rtmps?:\/\/\S+|[a-z0-9_.~?=&/-]{6,})$/i;
+
diff --git a/react/features/recording/components/LiveStream/functions.ts b/react/features/recording/components/LiveStream/functions.ts
index a382bc439e..d0fad50877 100644
--- a/react/features/recording/components/LiveStream/functions.ts
+++ b/react/features/recording/components/LiveStream/functions.ts
@@ -5,6 +5,7 @@ import {
FOUR_GROUPS_DASH_SEPARATED,
GOOGLE_PRIVACY_POLICY,
JITSI_LIVE_STREAMING_HELP_LINK,
+ STREAM_KEY_OR_URL_REGEXP,
YOUTUBE_TERMS_URL
} from './constants';
@@ -15,14 +16,29 @@ import {
* @returns {LiveStreaming}
*/
export function getLiveStreaming(state: IReduxState) {
- const { liveStreaming = {} } = state['features/base/config'];
+ const { liveStreaming = {}, googleApiApplicationClientID } = state['features/base/config'];
const regexp = liveStreaming.validatorRegExpString && new RegExp(liveStreaming.validatorRegExpString);
+ const hasGoogleApi = Boolean(googleApiApplicationClientID);
+ const hasCustomTerms = Boolean(liveStreaming.termsLink);
+ const hasCustomPrivacy = Boolean(liveStreaming.dataPrivacyLink);
+ const isYouTubeTerms = liveStreaming.termsLink === YOUTUBE_TERMS_URL || (hasGoogleApi && !hasCustomTerms);
+ const isGooglePrivacy = liveStreaming.dataPrivacyLink === GOOGLE_PRIVACY_POLICY || (hasGoogleApi && !hasCustomPrivacy);
return {
+ dataPrivacyLabelKey: isGooglePrivacy
+ ? 'liveStreaming.googlePrivacyPolicy'
+ : 'liveStreaming.privacyPolicy',
+ dataPrivacyURL: sanitizeUrl(liveStreaming.dataPrivacyLink
+ || (hasGoogleApi ? GOOGLE_PRIVACY_POLICY : undefined))?.toString(),
enabled: Boolean(liveStreaming.enabled),
helpURL: sanitizeUrl(liveStreaming.helpLink || JITSI_LIVE_STREAMING_HELP_LINK)?.toString(),
- termsURL: sanitizeUrl(liveStreaming.termsLink || YOUTUBE_TERMS_URL)?.toString(),
- dataPrivacyURL: sanitizeUrl(liveStreaming.dataPrivacyLink || GOOGLE_PRIVACY_POLICY)?.toString(),
- streamLinkRegexp: regexp || FOUR_GROUPS_DASH_SEPARATED
+ streamKeyPlaceholderKey: hasGoogleApi
+ ? 'liveStreaming.enterStreamKey'
+ : 'liveStreaming.enterStreamKeyGeneric',
+ streamLinkRegexp: regexp || (hasGoogleApi ? FOUR_GROUPS_DASH_SEPARATED : STREAM_KEY_OR_URL_REGEXP),
+ termsLabelKey: isYouTubeTerms
+ ? 'liveStreaming.youtubeTerms'
+ : 'liveStreaming.terms',
+ termsURL: sanitizeUrl(liveStreaming.termsLink || (hasGoogleApi ? YOUTUBE_TERMS_URL : undefined))?.toString()
};
}
diff --git a/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx b/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
index 83ae9e067b..6d892049d0 100644
--- a/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
+++ b/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
@@ -39,9 +39,9 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
super(props);
// Bind event handlers so they are only bound once per instance.
- this._onOpenGooglePrivacyPolicy = this._onOpenGooglePrivacyPolicy.bind(this);
+ this._onOpenDataPrivacy = this._onOpenDataPrivacy.bind(this);
this._onOpenHelp = this._onOpenHelp.bind(this);
- this._onOpenYoutubeTerms = this._onOpenYoutubeTerms.bind(this);
+ this._onOpenTerms = this._onOpenTerms.bind(this);
}
@@ -62,7 +62,7 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
input: styles.streamKeyInput,
container: styles.streamKeyContainer }}
onChange = { this._onInputChange }
- placeholder = { t('liveStreaming.enterStreamKey') }
+ placeholder = { t(this.props._liveStreaming.streamKeyPlaceholderKey) }
value = { this.props.value } />
<View style = { styles.formValidationItem as ViewStyle }>
{
@@ -77,36 +77,45 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
</View>
</View>
<View style = { styles.formButtonsWrapper as ViewStyle }>
- <Button
- accessibilityLabel = 'liveStreaming.streamIdHelp'
- labelKey = 'liveStreaming.streamIdHelp'
- labelStyle = { styles.buttonLabelStyle }
- onClick = { this._onOpenHelp }
- type = { BUTTON_TYPES.TERTIARY } />
- <Button
- accessibilityLabel = 'liveStreaming.youtubeTerms'
- labelKey = 'liveStreaming.youtubeTerms'
- labelStyle = { styles.buttonLabelStyle }
- onClick = { this._onOpenYoutubeTerms }
- type = { BUTTON_TYPES.TERTIARY } />
- <Button
- accessibilityLabel = 'liveStreaming.googlePrivacyPolicy'
- labelKey = 'liveStreaming.googlePrivacyPolicy'
- labelStyle = { styles.buttonLabelStyle }
- onClick = { this._onOpenGooglePrivacyPolicy }
- type = { BUTTON_TYPES.TERTIARY } />
+ { this.props._liveStreaming.helpURL
+ ? (
+ <Button
+ accessibilityLabel = 'liveStreaming.streamIdHelp'
+ labelKey = 'liveStreaming.streamIdHelp'
+ labelStyle = { styles.buttonLabelStyle }
+ onClick = { this._onOpenHelp }
+ type = { BUTTON_TYPES.TERTIARY } />
+ ) : null }
+ { this.props._liveStreaming.termsURL
+ ? (
+ <Button
+ accessibilityLabel = { this.props._liveStreaming.termsLabelKey }
+ labelKey = { this.props._liveStreaming.termsLabelKey }
+ labelStyle = { styles.buttonLabelStyle }
+ onClick = { this._onOpenTerms }
+ type = { BUTTON_TYPES.TERTIARY } />
+ ) : null }
+ { this.props._liveStreaming.dataPrivacyURL
+ ? (
+ <Button
+ accessibilityLabel = { this.props._liveStreaming.dataPrivacyLabelKey }
+ labelKey = { this.props._liveStreaming.dataPrivacyLabelKey }
+ labelStyle = { styles.buttonLabelStyle }
+ onClick = { this._onOpenDataPrivacy }
+ type = { BUTTON_TYPES.TERTIARY } />
+ ) : null }
</View>
</>
);
}
/**
- * Opens the Google Privacy Policy web page.
+ * Opens the privacy policy web page.
*
* @private
* @returns {void}
*/
- _onOpenGooglePrivacyPolicy() {
+ _onOpenDataPrivacy() {
const url = this.props._liveStreaming.dataPrivacyURL;
if (typeof url === 'string') {
@@ -130,12 +139,12 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
}
/**
- * Opens the YouTube terms and conditions web page.
+ * Opens the terms and conditions web page.
*
* @private
* @returns {void}
*/
- _onOpenYoutubeTerms() {
+ _onOpenTerms() {
const url = this.props._liveStreaming.termsURL;
if (typeof url === 'string') {
diff --git a/react/features/recording/components/LiveStream/web/StartLiveStreamDialog.tsx b/react/features/recording/components/LiveStream/web/StartLiveStreamDialog.tsx
index c20e5699de..050db26832 100644
--- a/react/features/recording/components/LiveStream/web/StartLiveStreamDialog.tsx
+++ b/react/features/recording/components/LiveStream/web/StartLiveStreamDialog.tsx
@@ -91,10 +91,14 @@ class StartLiveStreamDialog
titleKey = 'liveStreaming.start'>
<div className = 'live-stream-dialog'>
{ _googleApiApplicationClientID
- ? this._renderYouTubePanel() : null }
- <div className = 'youtube-go-live-warning'>
- { t('liveStreaming.youTubeGoLiveWarning') }
- </div>
+ ? (
+ <>
+ { this._renderYouTubePanel() }
+ <div className = 'youtube-go-live-warning'>
+ { t('liveStreaming.youTubeGoLiveWarning') }
+ </div>
+ </>
+ ) : null }
<StreamKeyForm
onChange = { this._onStreamKeyChange }
value = {
diff --git a/react/features/recording/components/LiveStream/web/StreamKeyForm.tsx b/react/features/recording/components/LiveStream/web/StreamKeyForm.tsx
index 44e58f1faa..f5621ba6dc 100644
--- a/react/features/recording/components/LiveStream/web/StreamKeyForm.tsx
+++ b/react/features/recording/components/LiveStream/web/StreamKeyForm.tsx
@@ -66,7 +66,7 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
label = { t('dialog.streamKey') }
name = 'streamId'
onChange = { this._onInputChange }
- placeholder = { t('liveStreaming.enterStreamKey') }
+ placeholder = { t(this.props._liveStreaming.streamKeyPlaceholderKey) }
type = 'text'
value = { value } />
<div className = 'form-footer'>
@@ -89,20 +89,26 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
: null
}
</div>
- <a
- className = { classes.helperLink }
- href = { this.props._liveStreaming.termsURL }
- rel = 'noopener noreferrer'
- target = '_blank'>
- { t('liveStreaming.youtubeTerms') }
- </a>
- <a
- className = { classes.helperLink }
- href = { this.props._liveStreaming.dataPrivacyURL }
- rel = 'noopener noreferrer'
- target = '_blank'>
- { t('liveStreaming.googlePrivacyPolicy') }
- </a>
+ { this.props._liveStreaming.termsURL
+ ? (
+ <a
+ className = { classes.helperLink }
+ href = { this.props._liveStreaming.termsURL }
+ rel = 'noopener noreferrer'
+ target = '_blank'>
+ { t(this.props._liveStreaming.termsLabelKey) }
+ </a>
+ ) : null }
+ { this.props._liveStreaming.dataPrivacyURL
+ ? (
+ <a
+ className = { classes.helperLink }
+ href = { this.props._liveStreaming.dataPrivacyURL }
+ rel = 'noopener noreferrer'
+ target = '_blank'>
+ { t(this.props._liveStreaming.dataPrivacyLabelKey) }
+ </a>
+ ) : null }
</div>
</div>
);