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

adds dynamic loading to video-test #698

Merged
merged 2 commits into from
Jun 17, 2021
Merged

adds dynamic loading to video-test #698

merged 2 commits into from
Jun 17, 2021

Conversation

joelhooks
Copy link
Contributor

@vercel
Copy link

vercel bot commented Jun 16, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

egghead-io-nextjs – ./

🔍 Inspect: https://vercel.com/eggheadio/egghead-io-nextjs/8r2cCPZxBg8D4ZVUwR3qxpzACN9M
✅ Preview: https://egghead-io-nextjs-git-jh-load-notes-mdx-as-vtt-eggheadio1.vercel.app

egghead-next-storybook – ./

🔍 Inspect: https://vercel.com/eggheadio/egghead-next-storybook/4aT33cHU91dxKwmWVDnWXCn6cMSA
✅ Preview: https://egghead-next-storybook-git-jh-load-notes-mdx-as-vtt-eggheadio1.vercel.app

@@ -126,8 +132,11 @@
"tailwindcss": "^2.1.4",
"tincanjs": "^0.50.0",
"ts-toolbelt": "^9.6.0",
"unist-util-visit": "^2.0.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is an older version of this library

syntax-tree/unist-util-visit#23

apparently the entire unified ecosystem is making a principled stance on using ESM modules which is incompatible with Next.js (and most of the rest of the world) at this time. This causes a massive headache and debugging nightmare to implement, but it's a principled stance and open source so you can only complain about it so much I guess.

Kind of sucks when you just want to make stuff, particularly since it'd be relatively simple to support commonjs syntax for now.

This issue, in fact, has caused mdx to be forked :trollface:

I don't like it.

Copy link

@ChristianMurphy ChristianMurphy Aug 9, 2021

Choose a reason for hiding this comment

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

Maintainer of unified and mdx here, sorry you ran into a spot of trouble.
This characterization is unfair on a few fronts:

  1. It is not a libraries fault if a build tool does not support standard JavaScript syntax.
  2. Next has been working to add ESM support, and merged add support for esm externals vercel/next.js#27069 to address this specifically
  3. MDX was forked over a disagreement on how to handle presentation context and runtime Remove runtime renderer, still support MDXProvider mdx-js/mdx#1425 and An alternative “shortcode” (mdxType alternative) proposal mdx-js/mdx#1385, it has nothing to do with ESM
  4. Unified had experimented with adding a CJS fallback to support older versions of CRA and Next, but due to some quirks of webpack 4, it actually made things harder for adopters than pure ESM 🤷‍♂️

If you have questions on ESM or MDX in general, feel free to reach out to the MDX community https://github.com/mdx-js/mdx/discussions and/or unified community https://github.com/unifiedjs/unified/discussions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this detailed list of corrections.

@@ -98,7 +98,7 @@ const NoteCue: React.FC<any> = ({
const visible =
player.activeMetadataTrackCues.includes(cue) && !player.seeking
const startPosition = `${(cue.startTime / duration) * 100}%`
const note = JSON.parse(cue.text)
const note = cue.text
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not using JSON, which might be something we test for in the future. We can just not needed for the current approach.


export default loadGithubNotes

export async function loadNotesFromUrl(url: string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this loads mdx from a url and parses it looking for timestamp components which creates JS objects that are used to make a webvtt.

it's currently very fragile! works though

Copy link

@ltclmbdev ltclmbdev left a comment

Choose a reason for hiding this comment

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

great update 👍

@kodiakhq kodiakhq bot merged commit 129b4d3 into main Jun 17, 2021
@kodiakhq kodiakhq bot deleted the jh/load-notes-mdx-as-vtt branch June 17, 2021 09:25
@skillrecordings skillrecordings locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants