diff --git a/ui/component/fileRenderInitiator/view.jsx b/ui/component/fileRenderInitiator/view.jsx index 76774ede5..c961fa384 100644 --- a/ui/component/fileRenderInitiator/view.jsx +++ b/ui/component/fileRenderInitiator/view.jsx @@ -92,12 +92,7 @@ export default function FileRenderInitiator(props: Props) { if (isMobileClaimLive && foundCover) { doSetPlayingUri({ uri }); } - - // No floating player on mobile as of now, so clear the playing uri - if (isMobile && (isPlayable || isMobileClaimLive)) { - return () => doSetPlayingUri({ uri: null }); - } - }, [doSetPlayingUri, foundCover, isMobile, isMobileClaimLive, isPlayable, uri]); + }, [doSetPlayingUri, foundCover, isMobileClaimLive, uri]); function doAuthRedirect() { history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(location.pathname)}`); diff --git a/ui/page/file/index.js b/ui/page/file/index.js index e8eb41e75..b80d3c5ad 100644 --- a/ui/page/file/index.js +++ b/ui/page/file/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { doSetContentHistoryItem, doSetPrimaryUri, clearPosition } from 'redux/actions/content'; +import { doSetContentHistoryItem, doSetPrimaryUri, clearPosition, doClearPlayingUri } from 'redux/actions/content'; import { withRouter } from 'react-router-dom'; import { selectClaimIsNsfwForUri, @@ -54,6 +54,7 @@ const perform = { doSetPrimaryUri, clearPosition, doSetMobilePlayerDimensions, + doClearPlayingUri, }; export default withRouter(connect(select, perform)(FilePage)); diff --git a/ui/page/file/view.jsx b/ui/page/file/view.jsx index 5b037a4d5..1d7ec9026 100644 --- a/ui/page/file/view.jsx +++ b/ui/page/file/view.jsx @@ -46,6 +46,7 @@ type Props = { doSetContentHistoryItem: (uri: string) => void, doSetPrimaryUri: (uri: ?string) => void, clearPosition: (uri: string) => void, + doClearPlayingUri: () => void, }; export default function FilePage(props: Props) { @@ -72,6 +73,7 @@ export default function FilePage(props: Props) { doSetContentHistoryItem, doSetPrimaryUri, clearPosition, + doClearPlayingUri, } = props; const isMobile = useIsMobile(); @@ -122,6 +124,15 @@ export default function FilePage(props: Props) { doSetPrimaryUri, ]); + React.useEffect(() => { + // No floating player on mobile as of now, so clear the playing uri + return () => { + if (isMobile && RENDER_MODES.FLOATING_MODES.includes(renderMode)) { + doClearPlayingUri(); + } + }; + }, [doClearPlayingUri, isMobile, renderMode]); + function renderFilePageLayout() { if (RENDER_MODES.FLOATING_MODES.includes(renderMode)) { return ( diff --git a/ui/page/livestream/view.jsx b/ui/page/livestream/view.jsx index 84c148ced..0440d1b6c 100644 --- a/ui/page/livestream/view.jsx +++ b/ui/page/livestream/view.jsx @@ -144,6 +144,8 @@ export default function LivestreamPage(props: Props) { // Set playing uri to null so the popout player doesnt start playing the dummy claim if a user navigates back // This can be removed when we start using the app video player, not a LIVESTREAM iframe doSetPlayingUri({ uri: null }); + + return () => doSetPlayingUri({ uri: null }); }, [doSetPlayingUri]); return (