Skip to content

Commit

Permalink
fix(FEC-11708): V3 - cast on multiple players - if try to cast when o…
Browse files Browse the repository at this point in the history
…ther player are casting, the player will be disabled (#643)

Cast backdrop has issues with multiple players.
Since backdrop is no longer necessary it can be removed.
Also clear isCastInitiator if cast request failed.
Fixes FEC-11708.
  • Loading branch information
SivanA-Kaltura committed Nov 23, 2021
1 parent 0f0a708 commit cc1e421
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 99 deletions.
12 changes: 0 additions & 12 deletions src/components/backdrop/_backdrop.scss

This file was deleted.

41 changes: 0 additions & 41 deletions src/components/backdrop/backdrop.js

This file was deleted.

1 change: 0 additions & 1 deletion src/components/backdrop/index.js

This file was deleted.

6 changes: 2 additions & 4 deletions src/components/cast-on-tv/cast-before-play.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import style from '../../styles/style.scss';
import {h, Component} from 'preact';
import {connect} from 'react-redux';
import {IconType} from '../icon/index';
import {actions} from '../../reducers/backdrop';
import {Icon} from '../icon/icon';
import {Localizer, Text} from 'preact-i18n';
import {withPlayer} from '../player';
Expand Down Expand Up @@ -32,7 +31,7 @@ const COMPONENT_NAME = 'CastBeforePlay';
* @example <CastBeforePlay />
* @extends {Component}
*/
@connect(mapStateToProps, actions)
@connect(mapStateToProps)
@withPlayer
@withLogger(COMPONENT_NAME)
class CastBeforePlay extends Component {
Expand All @@ -53,8 +52,7 @@ class CastBeforePlay extends Component {
* @memberof CastBeforePlay
*/
onClick = (): void => {
this.props.updateBackdropVisibility(true);
this.props.player.startCasting(RemotePlayerType.CHROMECAST).catch(() => this.props.updateBackdropVisibility(false));
this.props.player.startCasting(RemotePlayerType.CHROMECAST);
};

/**
Expand Down
12 changes: 4 additions & 8 deletions src/components/cast/cast.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import style from '../../styles/style.scss';
import {h, Component} from 'preact';
import {connect} from 'react-redux';
import {actions} from '../../reducers/backdrop';
import {KeyMap} from '../../utils/key-map';
import {withPlayer} from '../player';
import {withEventManager} from 'event/with-event-manager';
Expand Down Expand Up @@ -30,23 +29,21 @@ const COMPONENT_NAME = 'Cast';
* @example <Cast />
* @extends {Component}
*/
@connect(mapStateToProps, actions)
@connect(mapStateToProps)
@withPlayer
@withEventManager
@withLogger(COMPONENT_NAME)
@withText({castText: 'cast.play_on_tv'})
class Cast extends Component {
/**
* On click set the backdrop to visible.
* If cast session start failed remove the backdrop.
* On click, mark the player which initiated the cast
* @memberof Cast
* @returns {void}
*/
onClick = (): void => {
this.props.player.setIsCastInitiator(RemotePlayerType.CHROMECAST, true);
this.props.updateBackdropVisibility(true);
this.props.eventManager.listenOnce(this.props.player, this.props.player.Event.Cast.CAST_SESSION_START_FAILED, () =>
this.props.updateBackdropVisibility(false)
this.props.player.setIsCastInitiator(RemotePlayerType.CHROMECAST, false)
);
};

Expand All @@ -59,8 +56,7 @@ class Cast extends Component {
*/
onKeyDown = (e: KeyboardEvent): void => {
if (e.keyCode === KeyMap.ENTER) {
this.props.updateBackdropVisibility(true);
this.props.player.startCasting(RemotePlayerType.CHROMECAST).catch(() => this.props.updateBackdropVisibility(false));
this.props.player.startCasting(RemotePlayerType.CHROMECAST);
}
};

Expand Down
25 changes: 0 additions & 25 deletions src/reducers/backdrop.js

This file was deleted.

1 change: 0 additions & 1 deletion src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * as backdrop from './backdrop';
export * as config from './config';
export * as cvaa from './cvaa';
export * as engine from './engine';
Expand Down
2 changes: 0 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import loading from './reducers/loading';
import cvaa from './reducers/cvaa';
import settings from './reducers/settings';
import overlayAction from './reducers/overlay-action';
import backdrop from './reducers/backdrop';
import playlist from 'reducers/playlist';
import overlay from 'reducers/overlay';

Expand All @@ -23,7 +22,6 @@ const reducer = combineReducers({
cvaa,
settings,
overlayAction,
backdrop,
playlist,
overlay
});
Expand Down
1 change: 0 additions & 1 deletion src/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
@import '../components/cast/cast';
@import '../components/cast-overlay/cast-overlay';
@import '../components/cast-on-tv/cast-on-tv';
@import '../components/backdrop/backdrop';
@import '../components/playlist-button/playlist-button';
@import '../components/picture-in-picture/picture-in-picture';
@import '../components/playback-controls/playback-controls';
Expand Down
2 changes: 0 additions & 2 deletions src/ui-presets/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {Watermark} from '../components/watermark/watermark';
import {VrStereo} from '../components/vr-stereo';
import {Cast} from '../components/cast';
import {CastBeforePlay} from '../components/cast-on-tv/cast-before-play';
import {Backdrop} from '../components/backdrop/backdrop';
import {PlaybackControls} from '../components/playback-controls';
import {PictureInPicture} from '../components/picture-in-picture';
import {PictureInPictureOverlay} from '../components/picture-in-picture-overlay';
Expand Down Expand Up @@ -73,7 +72,6 @@ class LiveUI extends Component {
<PlaybackControls className={style.centerPlaybackControls} />
<PrePlaybackPlayOverlay />
<CastBeforePlay />
<Backdrop />
</Fragment>
{({containerRef}) => (
<Fragment>
Expand Down
2 changes: 0 additions & 2 deletions src/ui-presets/playback.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {UnmuteIndication} from '../components/unmute-indication';
import {Watermark} from '../components/watermark/watermark';
import {Cast} from '../components/cast';
import {CastBeforePlay} from '../components/cast-on-tv/cast-before-play';
import {Backdrop} from '../components/backdrop/backdrop';
import {PlaybackControls} from '../components/playback-controls';
import {PlaylistCountdown} from '../components/playlist-countdown';
import {PlaylistNextScreen} from '../components/playlist-next-screen';
Expand Down Expand Up @@ -78,7 +77,6 @@ class PlaybackUI extends Component {
<PlaylistNextScreen />
<PrePlaybackPlayOverlay />
<CastBeforePlay />
<Backdrop />
</Fragment>
{({containerRef}) => (
<Fragment>
Expand Down

0 comments on commit cc1e421

Please sign in to comment.