2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2022-03-15 13:28:55 -03:00
|
|
|
import { selectClaimForUri, selectTitleForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
2022-02-23 18:13:22 -03:00
|
|
|
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
2021-03-19 23:04:12 +08:00
|
|
|
import {
|
2021-09-10 14:27:21 -03:00
|
|
|
makeSelectNextUrlForCollectionAndUrl,
|
|
|
|
makeSelectPreviousUrlForCollectionAndUrl,
|
2021-10-17 16:36:14 +08:00
|
|
|
} from 'redux/selectors/collections';
|
|
|
|
import * as SETTINGS from 'constants/settings';
|
2020-01-06 15:57:49 -05:00
|
|
|
import {
|
2020-04-13 19:48:11 -04:00
|
|
|
makeSelectIsPlayerFloating,
|
2020-10-20 13:10:02 -04:00
|
|
|
selectPrimaryUri,
|
2020-01-06 15:57:49 -05:00
|
|
|
selectPlayingUri,
|
2020-04-01 14:43:50 -04:00
|
|
|
makeSelectFileRenderModeForUri,
|
2020-01-06 15:57:49 -05:00
|
|
|
} from 'redux/selectors/content';
|
2021-11-23 12:29:04 +08:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2021-11-19 10:40:01 +08:00
|
|
|
import { selectCostInfoForUri } from 'lbryinc';
|
2022-02-23 18:13:22 -03:00
|
|
|
import { doUriInitiatePlay, doSetPlayingUri } from 'redux/actions/content';
|
2021-03-19 23:04:12 +08:00
|
|
|
import { doFetchRecommendedContent } from 'redux/actions/search';
|
2019-08-13 01:35:13 -04:00
|
|
|
import { withRouter } from 'react-router';
|
2022-02-23 18:13:22 -03:00
|
|
|
import { selectMobilePlayerDimensions } from 'redux/selectors/app';
|
2022-03-15 13:28:55 -03:00
|
|
|
import { selectIsActiveLivestreamForUri, selectCommentSocketConnected } from 'redux/selectors/livestream';
|
2022-02-23 18:13:22 -03:00
|
|
|
import { doSetMobilePlayerDimensions } from 'redux/actions/app';
|
2022-03-15 13:28:55 -03:00
|
|
|
import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket';
|
2022-03-15 13:48:57 -03:00
|
|
|
import { isStreamPlaceholderClaim } from 'util/claim';
|
2020-04-01 14:43:50 -04:00
|
|
|
import FileRenderFloating from './view';
|
2017-05-14 23:50:59 -04:00
|
|
|
|
2019-08-13 01:35:13 -04:00
|
|
|
const select = (state, props) => {
|
2022-02-23 18:13:22 -03:00
|
|
|
const { location } = props;
|
|
|
|
|
2020-04-29 16:50:06 -04:00
|
|
|
const playingUri = selectPlayingUri(state);
|
2022-02-23 18:13:22 -03:00
|
|
|
const { uri, collectionId } = playingUri || {};
|
|
|
|
|
2022-03-15 13:28:55 -03:00
|
|
|
const claim = uri && selectClaimForUri(state, uri);
|
|
|
|
const { claim_id: claimId, signing_channel: channelClaim } = claim || {};
|
2022-03-16 08:35:58 -03:00
|
|
|
const { canonical_url: channelUrl } = channelClaim || {};
|
2022-03-15 13:28:55 -03:00
|
|
|
|
2019-08-13 01:35:13 -04:00
|
|
|
return {
|
2022-03-15 13:28:55 -03:00
|
|
|
claimId,
|
2022-03-16 08:35:58 -03:00
|
|
|
channelUrl,
|
2019-08-13 01:35:13 -04:00
|
|
|
uri,
|
2020-10-20 13:10:02 -04:00
|
|
|
playingUri,
|
2022-02-23 18:13:22 -03:00
|
|
|
primaryUri: selectPrimaryUri(state),
|
2021-11-16 12:23:18 +08:00
|
|
|
title: selectTitleForUri(state, uri),
|
2022-02-23 18:13:22 -03:00
|
|
|
isFloating: makeSelectIsPlayerFloating(location)(state),
|
2020-05-21 11:38:28 -04:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
2021-11-23 12:29:04 +08:00
|
|
|
floatingPlayerEnabled: selectClientSetting(state, SETTINGS.FLOATING_PLAYER),
|
2020-04-01 14:43:50 -04:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
2021-11-23 12:29:04 +08:00
|
|
|
videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE),
|
2021-11-19 10:40:01 +08:00
|
|
|
costInfo: selectCostInfoForUri(state, uri),
|
2021-09-10 14:27:21 -03:00
|
|
|
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
|
|
|
|
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
|
|
|
|
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
|
2021-09-02 17:05:32 -03:00
|
|
|
collectionId,
|
2022-02-23 18:13:22 -03:00
|
|
|
isCurrentClaimLive: selectIsActiveLivestreamForUri(state, uri),
|
|
|
|
mobilePlayerDimensions: selectMobilePlayerDimensions(state),
|
2022-03-15 13:28:55 -03:00
|
|
|
socketConnected: selectCommentSocketConnected(state),
|
2022-03-15 13:48:57 -03:00
|
|
|
isLivestreamClaim: isStreamPlaceholderClaim(claim),
|
2019-08-13 01:35:13 -04:00
|
|
|
};
|
|
|
|
};
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2022-02-23 18:13:22 -03:00
|
|
|
const perform = {
|
|
|
|
doFetchRecommendedContent,
|
|
|
|
doUriInitiatePlay,
|
|
|
|
doSetPlayingUri,
|
|
|
|
doSetMobilePlayerDimensions,
|
2022-03-15 13:28:55 -03:00
|
|
|
doCommentSocketConnect,
|
|
|
|
doCommentSocketDisconnect,
|
2022-02-23 18:13:22 -03:00
|
|
|
};
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2020-04-01 14:43:50 -04:00
|
|
|
export default withRouter(connect(select, perform)(FileRenderFloating));
|