Pass the title and channel name to Chromecast.
As noted in a comment, we need to be careful when adding props to `VideoJs` to avoid renders. Used primitive strings (title, channelName) instead of passing the entire `claim`, which could have its reference invalidated.
This commit is contained in:
parent
4c84fde31b
commit
42a8f3180d
2 changed files with 11 additions and 1 deletions
|
@ -56,6 +56,8 @@ type Props = {
|
||||||
autoplay: boolean,
|
autoplay: boolean,
|
||||||
autoplaySetting: boolean,
|
autoplaySetting: boolean,
|
||||||
claimId: ?string,
|
claimId: ?string,
|
||||||
|
title: ?string,
|
||||||
|
channelName: ?string,
|
||||||
embedded: boolean,
|
embedded: boolean,
|
||||||
internalFeatureEnabled: ?boolean,
|
internalFeatureEnabled: ?boolean,
|
||||||
isAudio: boolean,
|
isAudio: boolean,
|
||||||
|
@ -123,6 +125,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
autoplay,
|
autoplay,
|
||||||
autoplaySetting,
|
autoplaySetting,
|
||||||
claimId,
|
claimId,
|
||||||
|
title,
|
||||||
|
channelName,
|
||||||
embedded,
|
embedded,
|
||||||
internalFeatureEnabled, // for people on the team to test new features internally
|
internalFeatureEnabled, // for people on the team to test new features internally
|
||||||
isAudio,
|
isAudio,
|
||||||
|
@ -163,7 +167,10 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
// the true fix here is to fix the m3u8 file, see: https://github.com/lbryio/lbry-desktop/pull/6315
|
// the true fix here is to fix the m3u8 file, see: https://github.com/lbryio/lbry-desktop/pull/6315
|
||||||
controlBar: { subsCapsButton: false },
|
controlBar: { subsCapsButton: false },
|
||||||
techOrder: ['chromecast', 'html5'],
|
techOrder: ['chromecast', 'html5'],
|
||||||
chromecast: { requestTitleFn: (src) => '' },
|
chromecast: {
|
||||||
|
requestTitleFn: (src) => title || '',
|
||||||
|
requestSubtitleFn: (src) => channelName || '',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const { detectFileType, createVideoPlayerDOM } = functions({ source, sourceType, videoJsOptions, isAudio });
|
const { detectFileType, createVideoPlayerDOM } = functions({ source, sourceType, videoJsOptions, isAudio });
|
||||||
|
|
|
@ -112,6 +112,7 @@ function VideoViewer(props: Props) {
|
||||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||||
const claimId = claim && claim.claim_id;
|
const claimId = claim && claim.claim_id;
|
||||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||||
|
const channelName = claim && claim.signing_channel && claim.signing_channel.name;
|
||||||
const isAudio = contentType.includes('audio');
|
const isAudio = contentType.includes('audio');
|
||||||
const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
|
const forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
|
||||||
const {
|
const {
|
||||||
|
@ -477,6 +478,8 @@ function VideoViewer(props: Props) {
|
||||||
autoplay={!embedded || autoplayIfEmbedded}
|
autoplay={!embedded || autoplayIfEmbedded}
|
||||||
autoplaySetting={autoplayNext}
|
autoplaySetting={autoplayNext}
|
||||||
claimId={claimId}
|
claimId={claimId}
|
||||||
|
title={claim && ((claim.value && claim.value.title) || claim.name)}
|
||||||
|
channelName={channelName}
|
||||||
userId={userId}
|
userId={userId}
|
||||||
allowPreRoll={!authenticated} // TODO: pull this into ads functionality so it's self contained
|
allowPreRoll={!authenticated} // TODO: pull this into ads functionality so it's self contained
|
||||||
internalFeatureEnabled={internalFeature}
|
internalFeatureEnabled={internalFeature}
|
||||||
|
|
Loading…
Reference in a new issue