Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add type attribute and fallback widths #19

Merged
merged 8 commits into from
Apr 11, 2022
Merged

Conversation

luqven
Copy link
Contributor

@luqven luqven commented Apr 8, 2022

Before this PR:

  1. development builds took 10 seconds to update between builds
  2. data-setup parsing logic was convoluted
  3. video.js fallback behavior for w/h was being overriden
  4. there was no way to play non-hls video

After this PR

  1. use vite to serve development bundle instantly
  2. HMR in development bundle
  3. video.js fallback behavior for w/h is respected
  4. vjs styles don't leak out, tied to unique element id
  5. can play other video formats

Steps to test

To test in React, Vite

  • inside project root run npm/yarn link
  • run npm/yarn build
  • inside React/Vite app root run npm/yarn link @imgix/shared-wc
  • use the component

To test locally

  • run npm run dev or npm run serve
  • make changes to ix-video.ts
  • see them instantly

@luqven
Copy link
Contributor Author

luqven commented Apr 8, 2022

Copy link
Contributor

@sherwinski sherwinski left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of questions

  1. I noticed that you removed the dist folder completely. Was this intentional or do you want to add it back in at a later point, ie first stable release?
  2. Looks like we gutted most of the helper functions. Was that because there was actually no need for them? Just wanted to get some clarity there.

Comment on lines +1 to 8
export const generateUid = function () {
let ID = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for (let i = 0; i < 12; i++) {
ID += characters.charAt(Math.floor(Math.random() * 36));
}
return ID;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we intend on using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luqven
Copy link
Contributor Author

luqven commented Apr 11, 2022

LGTM, just a couple of questions

  1. I noticed that you removed the dist folder completely. Was this intentional or do you want to add it back in at a later point, ie first stable release?
  2. Looks like we gutted most of the helper functions. Was that because there was actually no need for them? Just wanted to get some clarity there.
  1. Yes. Plan to include the dist folder once we reach a more stable point
  2. Correct. There don't really belong in a helper file as they are ix-video specific behavior.

* This removes the shadow root and renders the elements as children of the
* host element.
*
* This in turn removes our ability to use `css` and `cssPart`
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking but does this somehow affect the decorator on L10 of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yes. That's a JS doc but probably not needed now.

Comment on lines +143 to +144
* The options set here will override any options set in the dataSetup
* attribute.
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth calling out that video.js will automatically merge these together for us?

Base automatically changed from l/delete-unused-files to develop April 11, 2022 22:58
This commit refactors `ix-video.ts` so that:

1. Less JSON parsing/object manipulation needs to be done to use
  dataSetup.
2. Fallback styling is more in line with user expectations and videojs
   defaults
3. There are no FOUC issues when using fallback styling
4. Since shadow-dom is off, we defensively add unique identifiers to
  video players

One of the main changes in this commit is the use of the
`connectedCallback()` lifecycle method to set a minimum width for the
host component and the video element.

Another significant change is  the use of the `type` attribute. Although
it defaults to HLS, adding it allows us to provide a way for users to
use this component with other video filetypes
The css-part jsdoc tells the web-component manifest parser that the
shadow dom exposes that css "part". We're not using the shadow dom so we
should not include it.
@luqven luqven merged commit 349d896 into develop Apr 11, 2022
@luqven luqven deleted the l/use-vite-dev branch April 11, 2022 23:03
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.

None yet

2 participants