Skip to content

Commit

Permalink
preserve functionality for RTMP URL, use store for StreamBaseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
roanta2 committed May 15, 2023
1 parent 8fa36cc commit 38ab95a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ export default class AbstractStartLiveStreamDialog<P extends IProps>
if (!base) {
return false;
}
if (!key) {
return false;

let rtmpURL = base;

if (key) {
rtmpURL = base.endsWith('/') ? base + key : `${base}/${key}`;
}

const rtmpURL = base.endsWith('/') ? base + key : `${base}/${key}`;
let selectedBroadcastID = null;

// to modify this too maybe?
if (selectedBoundStreamID) {
const selectedBroadcast = broadcasts?.find(
broadcast => broadcast.boundStreamID === selectedBoundStreamID);
Expand All @@ -239,7 +240,6 @@ export default class AbstractStartLiveStreamDialog<P extends IProps>

sendAnalytics(
createLiveStreamingDialogEvent('start', 'confirm.button'));

this.props._conference?.startRecording({
broadcastId: selectedBroadcastID,
mode: JitsiRecordingConstants.mode.STREAM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HeaderNavigationButton
from '../../../../mobile/navigation/components/HeaderNavigationButton';
import { goBack }
from '../../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
import { setLiveStreamKey } from '../../../actions';
import { setLiveStreamBaseURL, setLiveStreamKey } from '../../../actions';
import AbstractStartLiveStreamDialog, { IProps, _mapStateToProps } from '../AbstractStartLiveStreamDialog';

import GoogleSigninForm from './GoogleSigninForm';
Expand All @@ -34,6 +34,7 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog<IProps> {

// Bind event handlers so they are only bound once per instance.
this._onStartPress = this._onStartPress.bind(this);
this._onStreamBaseURLChange = this._onStreamBaseURLChangeNative.bind(this);
this._onStreamKeyChangeNative
= this._onStreamKeyChangeNative.bind(this);
this._onStreamKeyPick = this._onStreamKeyPick.bind(this);
Expand Down Expand Up @@ -83,7 +84,7 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog<IProps> {
broadcasts = { this.state.broadcasts }
onChange = { this._onStreamKeyPick } />
<StreamKeyForm
onStreamBaseURLChange = { this._onStreamBaseURLChange }
onStreamBaseURLChange = { this._onStreamBaseURLChangeNative }
onStreamKeyChange = { this._onStreamKeyChangeNative }
streamBaseURLValue = { this.state.streamBaseURL || this.props._streamBaseURL || '' }
streamKeyValue = { this.state.streamKey || this.props._streamKey || '' } />
Expand All @@ -108,6 +109,18 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog<IProps> {
this._onStreamKeyChange(streamKey);
}

/**
* Callback to handle stream base URL changes.
*
* @private
* @param {string} streamBaseURL - The new key value.
* @returns {void}
*/
_onStreamBaseURLChangeNative(streamBaseURL: string) {
this.props.dispatch(setLiveStreamBaseURL(streamBaseURL));
this._onStreamBaseURLChange(streamBaseURL);
}

/**
* Callback to be invoked when the user selects a stream from the picker.
*
Expand Down Expand Up @@ -145,12 +158,14 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog<IProps> {
.catch(() => {
this.setState({
broadcasts: undefined,
streamBaseURL: undefined,
streamKey: undefined
});
});
} else {
this.setState({
broadcasts: undefined,
streamBaseURL: undefined,
streamKey: undefined
});
}
Expand Down

0 comments on commit 38ab95a

Please sign in to comment.