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

Migrated from video.js to livepeer.js's player #1260

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

clacladev
Copy link
Contributor

@clacladev clacladev commented Sep 9, 2022

What does this pull request do? Explain your changes. (required)
Migrated from video.js to livepeer.js's React VideoPlayer

Specific updates (required)

  • Removed video.js
  • Added livepeer.js and integrated StudioConfig provider
  • Refactored the Player component to use livepeer.js's video player instead of video.js one

-

How did you test each of these updates (required)
Created a preview build with the changes and opened the an asset (this one requires admin privileges):
https://livepeer-studio-mdg4ql6nn-livepeer.vercel.app/dashboard/assets/6aa5e390-8724-4c5b-855b-4f2992cd1b40

Does this pull request close any open issues?

Fixes #1227

Screenshots (optional):

Screenshot 2022-09-09 at 14 32 40

Checklist:

  • Test with live stream recordings

@vercel
Copy link

vercel bot commented Sep 9, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
livepeer-studio ✅ Ready (Inspect) Visit Preview Sep 9, 2022 at 4:31PM (UTC)

@@ -54,6 +56,10 @@ Object.keys(themes).map(
(key, _index) => (themeMap[themes[key].className] = themes[key].className)
);

const livepeerClient = createReactClient({
provider: studioProvider({ apiKey: "b05094e0-05b6-4260-b462-bae581fdcf13" }), // TODO: replace with env var
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need any custom API key here? The playbackInfo API is public, and even if it wasn't, we should not need any API key to use the player receiving only an HLS URL.

We can very likely just leave the default API key here in case the player just needs some LivepeerProvider to be present (ideally it should not). Worst case, if we ever do need to call APIs with livepeer.js, we should not use an API key but actually the same user JWT that is used on the dashboard (check ApiProvider). This would give access to the account the user is logged in, not a random fixed account that we insert an API key here (worse, we'd likely need to put an admin API key here and we definitely don't want to leak that anywhere, ever).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I see what you're saying. Let me check if I can successfully initialise the provider without the api key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I confirm that we can initialise it without any api key and there are not warnings or errors. So I will follow that

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we shouldn't need an API key here to just use the player. If we are planning on using any other hooks from livepeer.js, we'd need to allow the client to provide a JWT. This might be a good feature though!

Copy link
Member

@adamsoffer adamsoffer Sep 9, 2022

Choose a reason for hiding this comment

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

Yeah this would be a nice feature. I think it'd actually be worthwhile refactoring the dashboard frontend to use livepeer.js at some point.

Copy link
Member

@adamsoffer adamsoffer left a comment

Choose a reason for hiding this comment

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

@clacladev small request: can we make sure the border bottom radius doesn't get cut off? Giving the video element a display: flex should fix.

CleanShot 2022-09-09 at 12 35 25@2x

@codecov
Copy link

codecov bot commented Sep 9, 2022

Codecov Report

Merging #1260 (af2834b) into master (6b27eb9) will decrease coverage by 0.09168%.
The diff coverage is n/a.

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #1260         +/-   ##
===================================================
- Coverage   51.47834%   51.38666%   -0.09169%     
===================================================
  Files             66          66                 
  Lines           4363        4363                 
  Branches         791         791                 
===================================================
- Hits            2246        2242          -4     
- Misses          1835        1838          +3     
- Partials         282         283          +1     
Impacted Files Coverage Δ
packages/api/src/webhooks/cannon.ts 47.36842% <0.00000%> (-2.33918%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b27eb9...af2834b. Read the comment docs.

Impacted Files Coverage Δ
packages/api/src/webhooks/cannon.ts 47.36842% <0.00000%> (-2.33918%) ⬇️

@adamsoffer
Copy link
Member

I'm going to push this to prod. Can address my small comment in a separate PR.

@adamsoffer adamsoffer merged commit 1794bd9 into master Sep 9, 2022
@adamsoffer adamsoffer deleted the clacladev/player-integration branch September 9, 2022 19:03
@clacladev
Copy link
Contributor Author

@adamsoffer yes I see the small corner issue. I can address it in a small PR asap

@clacladev clacladev mentioned this pull request Sep 12, 2022
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.

Replace player in Livepeer Studio Dashboard with Livepeer Player
4 participants