Skip to content

feat(story element): support brightcove#220

Merged
ReenaSingh07 merged 19 commits intomasterfrom
brightcove
Jun 14, 2023
Merged

feat(story element): support brightcove#220
ReenaSingh07 merged 19 commits intomasterfrom
brightcove

Conversation

@ReenaSingh07
Copy link
Contributor

Fixes https://github.com/quintype/page-builder/issues/2349

Dependencies https://github.com/quintype/itsman/issues/10510

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Comment on lines +12 to +13
const [showVideo, handleVideoDisplay] = useState(false);
const [isLibraryLoaded, handleLibrary] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handleVideoDisplay, handleLibrary are confusing variables names, pls rename to something descriptive

Comment on lines +18 to +24
if (!loaderPromise && !isLibraryLoaded) {
return (loaderPromise = import(/* webpackChunkName: "qtc-react-brightcove" */ "@brightcove/react-player-loader")
.then((module) => {
BrightcovePlayerLoader = module.default;
window.BrightcovePlayerLoader = BrightcovePlayerLoader;
handleLibrary(true);
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls simplify the library loading logic, can BrightcovePlayerLoader, loaderPromise and isLibraryLoaded be combined?

Comment on lines +108 to +112
const StoryElementBrightcove = (props) => {
return <WithLazy margin="0px">{() => <CustomElementBrightcove {...props} />}</WithLazy>;
};

export default StoryElementBrightcove;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can give more descriptive names

  • StoryElementBrightcove is a lazy wrapped brightcove component so can call it lazyBrightcove or something
  • CustomElementBrightcove is the main component, I think it should be called BrightcoveElement

Comment on lines +53 to +54
myPlayer.muted(true);
myPlayer.play();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we discuss this behaviour with the team?

} else if (!loadIframeOnClick && isLibraryLoaded) {
return <div className="brightcove-wrapper">{brightcoveIframe()}</div>;
} else {
return <></>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can return null

return <WithLazy margin="0px">{() => <BrightcoveElement {...props} />}</WithLazy>;
};

export default LazyBrightcove;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to StoryElementBrightcove

@ReenaSingh07 ReenaSingh07 merged commit d4e1efc into master Jun 14, 2023
@delete-merged-branch delete-merged-branch bot deleted the brightcove branch June 14, 2023 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants