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,
|
||||
autoplaySetting: boolean,
|
||||
claimId: ?string,
|
||||
title: ?string,
|
||||
channelName: ?string,
|
||||
embedded: boolean,
|
||||
internalFeatureEnabled: ?boolean,
|
||||
isAudio: boolean,
|
||||
|
@ -123,6 +125,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
|||
autoplay,
|
||||
autoplaySetting,
|
||||
claimId,
|
||||
title,
|
||||
channelName,
|
||||
embedded,
|
||||
internalFeatureEnabled, // for people on the team to test new features internally
|
||||
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
|
||||
controlBar: { subsCapsButton: false },
|
||||
techOrder: ['chromecast', 'html5'],
|
||||
chromecast: { requestTitleFn: (src) => '' },
|
||||
chromecast: {
|
||||
requestTitleFn: (src) => title || '',
|
||||
requestSubtitleFn: (src) => channelName || '',
|
||||
},
|
||||
};
|
||||
|
||||
const { detectFileType, createVideoPlayerDOM } = functions({ source, sourceType, videoJsOptions, isAudio });
|
||||
|
|
|
@ -112,6 +112,7 @@ function VideoViewer(props: Props) {
|
|||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||
const claimId = claim && claim.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 forcePlayer = FORCE_CONTENT_TYPE_PLAYER.includes(contentType);
|
||||
const {
|
||||
|
@ -477,6 +478,8 @@ function VideoViewer(props: Props) {
|
|||
autoplay={!embedded || autoplayIfEmbedded}
|
||||
autoplaySetting={autoplayNext}
|
||||
claimId={claimId}
|
||||
title={claim && ((claim.value && claim.value.title) || claim.name)}
|
||||
channelName={channelName}
|
||||
userId={userId}
|
||||
allowPreRoll={!authenticated} // TODO: pull this into ads functionality so it's self contained
|
||||
internalFeatureEnabled={internalFeature}
|
||||
|
|
Loading…
Reference in a new issue