From 903a7c8afd634c5a2ed93bc0e1da986989e209f5 Mon Sep 17 00:00:00 2001 From: saltrafael Date: Mon, 13 Sep 2021 06:02:41 -0300 Subject: [PATCH] Fix Floating Player stopping on certain files --- ui/component/fileRenderInitiator/index.js | 8 ++------ ui/component/fileRenderInitiator/view.jsx | 7 +++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ui/component/fileRenderInitiator/index.js b/ui/component/fileRenderInitiator/index.js index efa2f28c9..2a9765ce1 100644 --- a/ui/component/fileRenderInitiator/index.js +++ b/ui/component/fileRenderInitiator/index.js @@ -4,7 +4,6 @@ import { makeSelectFileInfoForUri, makeSelectThumbnailForUri, makeSelectClaimForUri, - makeSelectStreamingUrlForUri, makeSelectClaimWasPurchased, SETTINGS, COLLECTIONS_CONSTS, @@ -16,7 +15,6 @@ import { withRouter } from 'react-router'; import { makeSelectIsPlaying, makeSelectShouldObscurePreview, - selectPlayingUri, makeSelectInsufficientCreditsForUri, makeSelectFileRenderModeForUri, } from 'redux/selectors/content'; @@ -33,9 +31,7 @@ const select = (state, props) => { fileInfo: makeSelectFileInfoForUri(props.uri)(state), obscurePreview: makeSelectShouldObscurePreview(props.uri)(state), isPlaying: makeSelectIsPlaying(props.uri)(state), - playingUri: selectPlayingUri(state), insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state), - streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state), autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state), costInfo: makeSelectCostInfoForUri(props.uri)(state), renderMode: makeSelectFileRenderModeForUri(props.uri)(state), @@ -47,9 +43,9 @@ const select = (state, props) => { }; const perform = (dispatch) => ({ - play: (uri, collectionId) => { + play: (uri, collectionId, isPlayable) => { dispatch(doSetPrimaryUri(uri)); - dispatch(doSetPlayingUri({ uri, collectionId })); + if (isPlayable) dispatch(doSetPlayingUri({ uri, collectionId })); dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo)))); }, }); diff --git a/ui/component/fileRenderInitiator/view.jsx b/ui/component/fileRenderInitiator/view.jsx index aac98c99d..a654ee967 100644 --- a/ui/component/fileRenderInitiator/view.jsx +++ b/ui/component/fileRenderInitiator/view.jsx @@ -16,8 +16,7 @@ import Nag from 'component/common/nag'; import FileRenderPlaceholder from 'static/img/fileRenderPlaceholder.png'; type Props = { - play: (string, string) => void, - isLoading: boolean, + play: (string, string, boolean) => void, isPlaying: boolean, fileInfo: FileListItem, uri: string, @@ -104,9 +103,9 @@ export default function FileRenderInitiator(props: Props) { e.stopPropagation(); } - play(uri, collectionId); + play(uri, collectionId, isPlayable); }, - [play, uri, collectionId] + [play, uri, isPlayable, collectionId] ); useEffect(() => {