Fix Floating Player stopping on certain files

This commit is contained in:
saltrafael 2021-09-13 06:02:41 -03:00
parent bbcdcfe4c1
commit 903a7c8afd
No known key found for this signature in database
GPG key ID: 9C7F1DC0B0F54515
2 changed files with 5 additions and 10 deletions

View file

@ -4,7 +4,6 @@ import {
makeSelectFileInfoForUri, makeSelectFileInfoForUri,
makeSelectThumbnailForUri, makeSelectThumbnailForUri,
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectStreamingUrlForUri,
makeSelectClaimWasPurchased, makeSelectClaimWasPurchased,
SETTINGS, SETTINGS,
COLLECTIONS_CONSTS, COLLECTIONS_CONSTS,
@ -16,7 +15,6 @@ import { withRouter } from 'react-router';
import { import {
makeSelectIsPlaying, makeSelectIsPlaying,
makeSelectShouldObscurePreview, makeSelectShouldObscurePreview,
selectPlayingUri,
makeSelectInsufficientCreditsForUri, makeSelectInsufficientCreditsForUri,
makeSelectFileRenderModeForUri, makeSelectFileRenderModeForUri,
} from 'redux/selectors/content'; } from 'redux/selectors/content';
@ -33,9 +31,7 @@ const select = (state, props) => {
fileInfo: makeSelectFileInfoForUri(props.uri)(state), fileInfo: makeSelectFileInfoForUri(props.uri)(state),
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state), obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
isPlaying: makeSelectIsPlaying(props.uri)(state), isPlaying: makeSelectIsPlaying(props.uri)(state),
playingUri: selectPlayingUri(state),
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state), insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state), autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state),
costInfo: makeSelectCostInfoForUri(props.uri)(state), costInfo: makeSelectCostInfoForUri(props.uri)(state),
renderMode: makeSelectFileRenderModeForUri(props.uri)(state), renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
@ -47,9 +43,9 @@ const select = (state, props) => {
}; };
const perform = (dispatch) => ({ const perform = (dispatch) => ({
play: (uri, collectionId) => { play: (uri, collectionId, isPlayable) => {
dispatch(doSetPrimaryUri(uri)); dispatch(doSetPrimaryUri(uri));
dispatch(doSetPlayingUri({ uri, collectionId })); if (isPlayable) dispatch(doSetPlayingUri({ uri, collectionId }));
dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo)))); dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo))));
}, },
}); });

View file

@ -16,8 +16,7 @@ import Nag from 'component/common/nag';
import FileRenderPlaceholder from 'static/img/fileRenderPlaceholder.png'; import FileRenderPlaceholder from 'static/img/fileRenderPlaceholder.png';
type Props = { type Props = {
play: (string, string) => void, play: (string, string, boolean) => void,
isLoading: boolean,
isPlaying: boolean, isPlaying: boolean,
fileInfo: FileListItem, fileInfo: FileListItem,
uri: string, uri: string,
@ -104,9 +103,9 @@ export default function FileRenderInitiator(props: Props) {
e.stopPropagation(); e.stopPropagation();
} }
play(uri, collectionId); play(uri, collectionId, isPlayable);
}, },
[play, uri, collectionId] [play, uri, isPlayable, collectionId]
); );
useEffect(() => { useEffect(() => {