2022-02-01 21:30:57 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { makeSelectClaimWasPurchased, selectClaimForUri } from 'redux/selectors/claims';
|
|
|
|
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
|
|
|
import {
|
|
|
|
makeSelectNextUrlForCollectionAndUrl,
|
|
|
|
makeSelectPreviousUrlForCollectionAndUrl,
|
|
|
|
} from 'redux/selectors/collections';
|
2022-02-17 10:19:22 +01:00
|
|
|
import { selectPlayingUri, makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
|
2022-02-01 21:30:57 +01:00
|
|
|
import { selectCostInfoForUri } from 'lbryinc';
|
|
|
|
import { doPlayUri } from 'redux/actions/content';
|
2022-02-02 13:44:33 +01:00
|
|
|
import { doSetMobilePlayerDimensions } from 'redux/actions/app';
|
2022-02-01 21:30:57 +01:00
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import { getChannelIdFromClaim } from 'util/claim';
|
|
|
|
import { selectActiveLivestreamForChannel } from 'redux/selectors/livestream';
|
|
|
|
import FileRenderMobile from './view';
|
2022-02-02 13:44:33 +01:00
|
|
|
import { selectMobilePlayerDimensions } from 'redux/selectors/app';
|
2022-02-01 21:30:57 +01:00
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
const playingUri = selectPlayingUri(state);
|
2022-02-17 10:19:22 +01:00
|
|
|
const primaryUri = selectPrimaryUri(state);
|
2022-02-01 21:30:57 +01:00
|
|
|
const uri = playingUri && playingUri.uri;
|
|
|
|
const collectionId = playingUri && playingUri.collectionId;
|
|
|
|
|
|
|
|
const claim = selectClaimForUri(state, uri);
|
|
|
|
const claimId = claim && claim.claim_id;
|
|
|
|
const channelClaimId = claim && getChannelIdFromClaim(claim);
|
|
|
|
|
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
|
|
|
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
|
|
|
costInfo: selectCostInfoForUri(state, uri),
|
|
|
|
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
|
|
|
|
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
|
|
|
|
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
|
|
|
|
collectionId,
|
|
|
|
activeLivestreamForChannel: channelClaimId && selectActiveLivestreamForChannel(state, channelClaimId),
|
|
|
|
claimId,
|
|
|
|
channelClaimId,
|
2022-02-02 13:44:33 +01:00
|
|
|
mobilePlayerDimensions: selectMobilePlayerDimensions(state),
|
2022-02-17 10:19:22 +01:00
|
|
|
primaryUri,
|
2022-02-02 13:44:33 +01:00
|
|
|
playingUri,
|
2022-02-01 21:30:57 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const perform = {
|
|
|
|
doPlayUri,
|
2022-02-02 13:44:33 +01:00
|
|
|
doSetMobilePlayerDimensions,
|
2022-02-01 21:30:57 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default withRouter(connect(select, perform)(FileRenderMobile));
|