Fix Autoplay
This commit is contained in:
parent
575e73dccd
commit
1a87fb6239
4 changed files with 16 additions and 7 deletions
|
@ -92,12 +92,7 @@ export default function FileRenderInitiator(props: Props) {
|
||||||
if (isMobileClaimLive && foundCover) {
|
if (isMobileClaimLive && foundCover) {
|
||||||
doSetPlayingUri({ uri });
|
doSetPlayingUri({ uri });
|
||||||
}
|
}
|
||||||
|
}, [doSetPlayingUri, foundCover, isMobileClaimLive, 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]);
|
|
||||||
|
|
||||||
function doAuthRedirect() {
|
function doAuthRedirect() {
|
||||||
history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(location.pathname)}`);
|
history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(location.pathname)}`);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
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 { withRouter } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
selectClaimIsNsfwForUri,
|
selectClaimIsNsfwForUri,
|
||||||
|
@ -54,6 +54,7 @@ const perform = {
|
||||||
doSetPrimaryUri,
|
doSetPrimaryUri,
|
||||||
clearPosition,
|
clearPosition,
|
||||||
doSetMobilePlayerDimensions,
|
doSetMobilePlayerDimensions,
|
||||||
|
doClearPlayingUri,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withRouter(connect(select, perform)(FilePage));
|
export default withRouter(connect(select, perform)(FilePage));
|
||||||
|
|
|
@ -46,6 +46,7 @@ type Props = {
|
||||||
doSetContentHistoryItem: (uri: string) => void,
|
doSetContentHistoryItem: (uri: string) => void,
|
||||||
doSetPrimaryUri: (uri: ?string) => void,
|
doSetPrimaryUri: (uri: ?string) => void,
|
||||||
clearPosition: (uri: string) => void,
|
clearPosition: (uri: string) => void,
|
||||||
|
doClearPlayingUri: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function FilePage(props: Props) {
|
export default function FilePage(props: Props) {
|
||||||
|
@ -72,6 +73,7 @@ export default function FilePage(props: Props) {
|
||||||
doSetContentHistoryItem,
|
doSetContentHistoryItem,
|
||||||
doSetPrimaryUri,
|
doSetPrimaryUri,
|
||||||
clearPosition,
|
clearPosition,
|
||||||
|
doClearPlayingUri,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
@ -122,6 +124,15 @@ export default function FilePage(props: Props) {
|
||||||
doSetPrimaryUri,
|
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() {
|
function renderFilePageLayout() {
|
||||||
if (RENDER_MODES.FLOATING_MODES.includes(renderMode)) {
|
if (RENDER_MODES.FLOATING_MODES.includes(renderMode)) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -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
|
// 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
|
// This can be removed when we start using the app video player, not a LIVESTREAM iframe
|
||||||
doSetPlayingUri({ uri: null });
|
doSetPlayingUri({ uri: null });
|
||||||
|
|
||||||
|
return () => doSetPlayingUri({ uri: null });
|
||||||
}, [doSetPlayingUri]);
|
}, [doSetPlayingUri]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue