diff --git a/ui/page/embedWrapper/index.js b/ui/page/embedWrapper/index.js index ab16697ed..6df9fab66 100644 --- a/ui/page/embedWrapper/index.js +++ b/ui/page/embedWrapper/index.js @@ -1,6 +1,7 @@ import { connect } from 'react-redux'; import EmbedWrapperPage from './view'; import { doResolveUri, makeSelectClaimForUri, buildURI } from 'lbry-redux'; +import { doPlayUri } from 'redux/actions/content'; const select = (state, props) => { const { match } = props; @@ -16,6 +17,7 @@ const select = (state, props) => { const perform = dispatch => { return { resolveUri: uri => dispatch(doResolveUri(uri)), + doPlayUri: uri => dispatch(doPlayUri(uri)), }; }; diff --git a/ui/page/embedWrapper/view.jsx b/ui/page/embedWrapper/view.jsx index d3c343ad4..4089e10d6 100644 --- a/ui/page/embedWrapper/view.jsx +++ b/ui/page/embedWrapper/view.jsx @@ -6,17 +6,22 @@ type Props = { uri: string, resolveUri: string => void, claim: Claim, + doPlayUri: string => void, }; // $FlowFixMe apparently flow thinks this is wrong. export const EmbedContext = React.createContext(); const EmbedWrapperPage = (props: Props) => { - const { resolveUri, claim, uri } = props; + const { resolveUri, claim, uri, doPlayUri } = props; + const haveClaim = Boolean(claim); useEffect(() => { - if (resolveUri && uri) { + if (resolveUri && uri && !haveClaim) { resolveUri(uri); } - }, [resolveUri, uri]); + if (uri && haveClaim) { + doPlayUri(uri); + } + }, [resolveUri, uri, doPlayUri, haveClaim]); return (