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

JW Player #433

Merged
merged 25 commits into from
Oct 7, 2024
Merged

JW Player #433

merged 25 commits into from
Oct 7, 2024

Conversation

anoblet
Copy link
Collaborator

@anoblet anoblet commented Sep 11, 2024

Copy link

github-actions bot commented Sep 11, 2024

size-limit report 📦

Path Size
packages/cxl-ui/pkg/dist-web/cxl-ui.js 44.75 KB (0%)
packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js 14.98 KB (+26.02% 🔺)
packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js 29.23 KB (0%)
packages/cxl-ui/pkg/dist-web/vendor.js 157.96 KB (+14.28% 🔺)
packages/cxl-ui/pkg/dist-web/cxl-ui-institute.js, packages/cxl-ui/pkg/dist-web/cxl-ui-jwplayer.js, packages/cxl-ui/pkg/dist-web/cxl-ui-playbooks.js, packages/cxl-ui/pkg/dist-web/cxl-ui.js, packages/cxl-ui/pkg/dist-web/manifest.js, packages/cxl-ui/pkg/dist-web/unresolved.js, packages/cxl-ui/pkg/dist-web/vendor.js 291.35 KB (+4.97% 🔺)

Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

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

You squashed commits, nice 👍

Please polish one thing in commit messages:

- [cxl-jw-player]
+ cxl-jw-player

saas786 and others added 6 commits September 11, 2024 13:13
Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): tweak jw player component

Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): rename caption mixin to transcript mixin

Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): tweak transcript mixin

Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): rename chapter mixin to chapter navigation mixin

Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): tweak chapter navigation mixin

Co-authored-by: Andrew Noblet <[email protected]>

feat(cxl-ui): add cxl-jw-player-transcript element

Co-authored-by: Andrew Noblet <[email protected]>

feat: cleanup, refactor & improve the code for PHP `cxl/jw-player`

* jw-player height tweaks
* [jw-player] add support for sources
	cherry-pick: #236
* cxl-jw-player set up api endpoint
	cherry-pick: #234
…d, librarySource

feat(cxl-ui): cxl-jw-player add hidden property style

feat(cxl-ui): cxl-jw-player set container display and height

feat(cxl-ui): cxl-jw-player fix playlist story

feat(cxl-ui): cxl-jw-player fix playlist styles

feat(cxl-ui): cxl-jw-player add next up CTA

feat(cxl-ui): cxl-jw-player hide default next up overlay

feat(cxl-ui): cxl-jw-player add pointer events to the link not the container

feat(cxl-ui): cxl-jw-player move next up styles to the global directory

feat(cxl-ui): cxl-jw-player refactor private methods and properties to protected

feat(cxl-ui): cxl-jw-player refactor for playlists

feat(cxl-ui): cxl-jw-player move styles to global directory

feat(cxl-ui): cxl-jw-player remove save position endpoint request

feat(cxl-ui): cxl-jw-player add the ability to save the playback rate

feat(cxl-ui): cxl-jw-player add the ability to play protected content

feat(cxl-ui): cxl-jw-player fix media and playlist source url

feat(cxl-ui): cxl-jw-player fix and improve next up feature

feat(cxl-ui): cxl-jw-player remove api secret default value

feat(cxl-ui): cxl-jw-player fix save position when using a playlist
feat(cxl-ui): cxl-jw-player fix chapter navigation when using playlists

feat(cxl-ui): cxl-jw-player fix CTA pointer events

feat(cxl-ui): cxl-jw-player fix saving position when using a playlist

feat(cxl-ui): cxl-jw-player update component references

feat(cxl-ui): cxl-jw-player fix poor refactoring
@pawelkmpt
Copy link

pawelkmpt commented Sep 20, 2024

I managed to run a player on WPS. It doesn't show transcript though, but I didn't dig into details yet as I'm coming with security thought.
Made transcript working

Component requires to pass api-secret which makes it a public value and it should not happen. Otherwise everyone can use it. We should rather sign and obtain necessary data on the backend side.

@lkraav @anoblet your thoughts?

EDIT
We have /wp-json/cxl/jwp/content-token REST API endpoint for signing resource ID. It was created for JW Player app. Maybe can be used here too?

Comment on lines +1 to +5
export { BaseMixin } from './BaseMixin';
export { ChapterNavigationMixin } from './chapter-navigation/index.js';
export { NextUpMixin } from './NextUpMixin';
export { StateMixin } from './StateMixin';
export { TranscriptMixin } from './TranscriptMixin';
Copy link

@lkraav lkraav Sep 20, 2024

Choose a reason for hiding this comment

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

"kebab-case everywhere" possible?

Maybe we can also install https://github.com/loeffel-io/ls-lint one day.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm trying to remember the reason for using pascal case vs. kebab case for mixins. I'll take a look and find a standard.

@pawelkmpt
Copy link

Component requires to pass api-secret which makes it a public value and it should not happen. Otherwise everyone can use it. We should rather sign and obtain necessary data on the backend side.

@lkraav @anoblet your thoughts?

EDIT We have /wp-json/cxl/jwp/content-token REST API endpoint for signing resource ID. It was created for JW Player app. Maybe can be used here too?

Maybe component should get signed URL as param, e.g. https://cdn.jwplayer.com/v2/media/fVRbGa56?sources=hls&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MjcwOTk2MTQsInJlc291cmNlIjoidjIvbWVkaWEvZlZSYkdhNTYifQ.ZWjguN1Rya0rHXz-kH3TomHINFwp_-NA6oBcnDwrNAU and inside fetch data, process it and display what needs to be displayed?

Using REST API endpoint requires authentication too so some kind of secret would be still needed. With signing on the server side and providing signed URL we have this problem solved.

@lkraav
Copy link

lkraav commented Sep 23, 2024

Maybe

Undoubtedly there's documented best practices out there for this age old problem, I'd welcome a link to a worthy guide?

@anoblet
Copy link
Collaborator Author

anoblet commented Sep 23, 2024

Component requires to pass api-secret which makes it a public value and it should not happen. Otherwise everyone can use it. We should rather sign and obtain necessary data on the backend side.

We saw this as a potential issue. Instead of providing api-secret, along with library-id, and media-id. You can omit api-secret, and use library-source, and media-source instead, where the JWT signing happens on the backend, and the full URL is provided to the component.

@pawelkmpt
Copy link

pawelkmpt commented Sep 23, 2024

You can omit api-secret, and use library-source, and media-source instead, where the JWT signing happens on the backend, and the full URL is provided to the component.

As API request or straighforward <cxl-jw-player url="<signed_url>">?

I personally would pass signed URL.

@pawelkmpt
Copy link

Undoubtedly there's documented best practices out there for this age old problem, I'd welcome a link to a worthy guide?

ChatGPT suggests using signing API: https://chatgpt.com/share/66f18132-43dc-8002-95ab-4f699f384976

As can seen above, I considered it too but managing REST API endpoint and authenticating request seems to be overengineering in our case when I can just output HTML with webcomponent having already signed URL. And cached URL

@anoblet
Copy link
Collaborator Author

anoblet commented Sep 23, 2024

As API request or straighforward ?

This would be the full signed URL. There are two different types of signed URL, JWT and non JWT, we would need them both: https://docs.jwplayer.com/platform/reference/protect-your-content-with-signed-urls

@pawelkmpt
Copy link

As API request or straighforward ?

This would be the full signed URL. There are two different types of signed URL, JWT and non JWT, we would need them both: https://docs.jwplayer.com/platform/reference/protect-your-content-with-signed-urls

Oh, indeed. Good catch @anoblet. I didn't see it before but now see JWT is used for a video and non JWP for library. So we'd need two arguments:

  • video-url or content-url
  • lib-url

or it's more complex?

Anyway, please adjust the component for the new approach. Save in new commits, do not overwrite existing just in case we'd like to get back to the past version @anoblet

@anoblet
Copy link
Collaborator Author

anoblet commented Sep 23, 2024

This is already supported with library-source, media-source, and playlist-source attributes. Sample code:

Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

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

2 more things on ClickUp

packages/cxl-ui/src/components/cxl-jw-player/index.html.js Outdated Show resolved Hide resolved
Comment on lines 29 to 33
<vaadin-checkbox
@change=${this._toggleShouldScroll}
?checked=${this._shouldScroll}
label="Scroll"
></vaadin-checkbox>

Choose a reason for hiding this comment

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

It's not visible. Is it needed?

@pawelkmpt
Copy link

@anoblet I have a suspicion CXLJWPlayerElement is compiled into cxl-ui-institue.js package. We also have separate cxl-ui-jwplayer.js and component should be imported only in the latter one.

@anoblet
Copy link
Collaborator Author

anoblet commented Oct 2, 2024

I have a suspicion CXLJWPlayerElement is compiled into cxl-ui-institue.js package. We also have separate cxl-ui-jwplayer.js and component should be imported only in the latter one.

I only see it imported in packages/cxl-ui/src/index-jwplayer.js and packages/cxl-ui/src/index-storybook.js.

@pawelkmpt
Copy link

I have a suspicion CXLJWPlayerElement is compiled into cxl-ui-institue.js package. We also have separate cxl-ui-jwplayer.js and component should be imported only in the latter one.

I only see it imported in packages/cxl-ui/src/index-jwplayer.js and packages/cxl-ui/src/index-storybook.js.

Continued here: https://app.clickup.com/t/apru1v?comment=90140065293863

@anoblet anoblet force-pushed the anoblet/feat/cxl-jw-player branch 2 times, most recently from dc20c6a to 3143869 Compare October 2, 2024 14:16
Copy link

@pawelkmpt pawelkmpt left a comment

Choose a reason for hiding this comment

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

Commit messages could be more precise

- feat(cxl-ui): cxl-jw-player add scroll to feature when pressing enter
+ feat(cxl-ui): cxl-jw-player transcript scroll to next result when pressing enter
- feat(cxl-ui): cxl-jw-player remove empty tracks
+ feat(cxl-ui): cxl-jw-player transcript remove empty tracks

@pawelkmpt pawelkmpt merged commit 5622f37 into master Oct 7, 2024
5 checks passed
This was referenced Oct 7, 2024
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