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: Loom video support #105

Closed

Conversation

Dheerajkawatra
Copy link

No description provided.

@crhayes
Copy link

crhayes commented Aug 11, 2023

@radiovisual Thoughts on this PR? It would be great to have loom support in the library.

@radiovisual
Copy link
Owner

radiovisual commented Aug 21, 2023

Loom support sounds nice. I can take a closer look at the PR soon

Copy link
Owner

@radiovisual radiovisual left a comment

Choose a reason for hiding this comment

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

@Dheerajkawatra Thanks for the contribution! Sorry for the super late review!

Comment on lines +8 to +10
* https://www.loom.com/share/7c7ced4911904070a5627374ccd84e8c
* https://www.loom.com/share/5bbdeb480ba84e65b1b3de8c190e2003?source=embed&t=20
* https://www.loom.com/embed/7c7ced4911904070a5627374ccd84e8c
Copy link
Owner

Choose a reason for hiding this comment

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

I try to keep links to real videos out of the documentation

Suggested change
* https://www.loom.com/share/7c7ced4911904070a5627374ccd84e8c
* https://www.loom.com/share/5bbdeb480ba84e65b1b3de8c190e2003?source=embed&t=20
* https://www.loom.com/embed/7c7ced4911904070a5627374ccd84e8c
* https://www.loom.com/share/{id}
* https://www.loom.com/share/{id}?
* https://www.loom.com/embed/{id}
* https://www.loom.com/embed/{id}?


test('Loom embed', () => {
expect(fn('<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/7c7ced4911904070a5627374ccd84e8c" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>').id).toBe('7c7ced4911904070a5627374ccd84e8c');
});
Copy link
Owner

Choose a reason for hiding this comment

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

Can you also add a test to be sure that the id is extracted from the embed URL that also has query parameters? For example: https://www.loom.com/embed/123?foo=true => 123

Comment on lines +281 to +282
https://www.loom.com/share/7c7ced4911904070a5627374ccd84e8c
https://www.loom.com/share/5bbdeb480ba84e65b1b3de8c190e2003?source=embed&t=20
Copy link
Owner

Choose a reason for hiding this comment

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

I try to keep links to real videos out of the documentation

Suggested change
https://www.loom.com/share/7c7ced4911904070a5627374ccd84e8c
https://www.loom.com/share/5bbdeb480ba84e65b1b3de8c190e2003?source=embed&t=20
https://www.loom.com/share/*
https://www.loom.com/share/*?


**Loom iframe**
```
<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/7c7ced4911904070a5627374ccd84e8c" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/7c7ced4911904070a5627374ccd84e8c" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
<iframe src="https://www.loom.com/embed/*" ...

export default function loom(urlString) {
// Parse basic url and embeds
const basicReg
= /(https?:\/\/)?(www\.)?loom\.com\/?(.*\/)?([\d)([a-z]{32})\??.*/;
Copy link
Owner

Choose a reason for hiding this comment

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

Seems like this RegEx is way to strict which might present problems (false positives, not flexible, etc), so I think you can really simplify this RegEx to make it focus on the specific strings you are looking for, and don't force length limits on the hashed id. something like (this is not tested, so please test it or modify it accordingly):

Suggested change
= /(https?:\/\/)?(www\.)?loom\.com\/?(.*\/)?([\d)([a-z]{32})\??.*/;
= /^https?:\/\/(?:www\.)?loom\.com\/(?:share|embed)\/([\da-zA-Z]+);

@Dheerajkawatra
Copy link
Author

@Dheerajkawatra Thanks for the contribution! Sorry for the super late review!

no worries, Thanks for the review @radiovisual . I'll fix asap

@radiovisual
Copy link
Owner

@Dheerajkawatra are you still interested in this PR? I can pick up the remaining work if you need some help.

@radiovisual
Copy link
Owner

I will close this stale PR since Loom video support was added via #110

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.

3 participants