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

Add Progress Bar to Song Card (Studio & Marketplace) #617

Merged

Conversation

dmkirshon
Copy link
Contributor

@dmkirshon dmkirshon commented May 13, 2024

Add:

  • Progress bar to track audio playback on sound card component

Note: Change affects all sound cards

  1. Sale page on Marketplace
  2. All Sales previews (Just Released, More From, Similar Songs) on Marketplace
  3. Collaborators -> Artist Page with collab previews on Studio
demo_Marketplace_Song-Card-Progress-Bar.mov
demo_Studio_Song-Card-Progress-Bar.mov

@dmkirshon dmkirshon self-assigned this May 13, 2024
Copy link

github-actions bot commented May 13, 2024

Visit the preview URL for this PR (updated for commit 2c38bf7):

https://newm-artist-portal--pr617-mrkt-27-single-item-68jalflh.web.app

(expires Wed, 26 Jun 2024 06:50:09 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: ec3483d4c62309afc398865bfd6a9fc9e03e1d46

Copy link

github-actions bot commented May 13, 2024

Visit the preview URL for this PR (updated for commit 2c38bf7):

https://fan-square--pr617-mrkt-27-single-item-hvp6nakk.web.app

(expires Wed, 26 Jun 2024 06:50:57 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: b38f4676e459f355dcb11c95730012d43389bfd2

Copy link

Visit the preview URL for this PR (updated for commit 697f3ec):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

Comment on lines 64 to 65
// Gives indication that the song is playing by incrementing the progress bar
if (songProgress === 0) setSongProgress(1);
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 added this to show progress of the playback from the start of track audio, but no issue removing it too. I think we need to add an extra one second to the duration because of this, but would like to see your and product's opinion.

Standard across other platforms: Would need to remove the line, the first second of progress is typically delayed by the interval loop. Seen on Spotify and others.

@@ -51,15 +51,15 @@ export const mockSales: ReadonlyArray<Sale> = [
costAssetName: "XYZ123",
costPolicyId: "123XYZ",
createdAt: new Date("April 10th, 2024").toDateString(),
id: "3cfb2d02-a320-4385-96d1-1498d8a1df58",
id: "cec4f704-69c4-41fd-807d-47aa2d73f0d2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this just for testing, this is one of the backend IDs, so clicking the first track under Just Released leads to a backend example. The First two play icons under Just Released can playback from a nftcdn source that might be similar to what the end url will look like.

Didn't want to change this file up too much since we might be pulling in backend data soon and replacing all of 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.

Noticed a long delay (5 seconds) before the Studio sound card is actually playing audio on initial click. The progress bar is rolling from the initial click... need to figure out how to sync up with the network loading delay. Will create a separate bug ticket for this, probably need to expose the actual audio position which will then help with adding a seek functionality.

Copy link
Contributor

@scandycuz scandycuz May 14, 2024

Choose a reason for hiding this comment

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

I'd recommend refactoring the code to get the position from the song as part of this ticket, since it would be good for the progress bar to reflect the position of the song for the MVP. The seek functionality doesn't need to be in the MVP though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Sales component and Sale page are separated so the playback of the sound card doesn't know the other instance exists. Aka you can play the Sale page asset and one of the More of Artist SongCards at the same time.

Will create another ticket/branch to include Redux or universal playback tracking across marketplace.

Copy link
Contributor

@scandycuz scandycuz May 14, 2024

Choose a reason for hiding this comment

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

Sounds good. It may have already been your intention, but I'd also incorporate the Redux functionality into the hooks so that it's abstracted there.

Copy link
Contributor

@scandycuz scandycuz left a comment

Choose a reason for hiding this comment

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

Looking good, but I'd recommend getting the actual song position from the song itself, that should resolve some of the issues around how to accurately display the song position.

Copy link

Visit the marketplace preview URL for this PR (updated for commit edf6b24):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

Copy link

Visit the wallet preview URL for this PR (updated for commit edf6b24):
🚀 https://hdjpa6kw6yjxwqaobmwhxciwfq0xefbd.lambda-url.us-west-2.on.aws/

Copy link

Visit the marketplace preview URL for this PR (updated for commit ae6b1f0):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

Copy link

Visit the wallet preview URL for this PR (updated for commit ae6b1f0):
🚀 https://hdjpa6kw6yjxwqaobmwhxciwfq0xefbd.lambda-url.us-west-2.on.aws/

Copy link

Visit the wallet preview URL for this PR (updated for commit 809d60d):
🚀 https://hdjpa6kw6yjxwqaobmwhxciwfq0xefbd.lambda-url.us-west-2.on.aws/

Copy link

Visit the marketplace preview URL for this PR (updated for commit 809d60d):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

Copy link

Visit the tools preview URL for this PR (updated for commit 809d60d):
🚀 https://3n5bbc2btz7wy3bjrwd6wqlnli0jlgkh.lambda-url.us-west-2.on.aws/

Copy link

Visit the tools preview URL for this PR (updated for commit 8d57b4e):
🚀 https://3n5bbc2btz7wy3bjrwd6wqlnli0jlgkh.lambda-url.us-west-2.on.aws/

Copy link

Visit the marketplace preview URL for this PR (updated for commit 8d57b4e):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

@@ -71,7 +71,7 @@ export const extendedApi = newmApi.injectEndpoints({
...(statuses ? { statuses: statuses.join(",") } : {}),
...rest,
},
url: "/v1/marketplace/sales",
url: "v1/marketplace/sales",
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch, i am bad with these 😅

Copy link
Contributor

@scandycuz scandycuz left a comment

Choose a reason for hiding this comment

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

LGTM

videoRef.current.addEventListener("ended", handleSongEnded);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
Copy link
Contributor

Choose a reason for hiding this comment

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

This works, but in order to not have to ignore the line, it should be possible to create all dependent functions using useCallback, if the concern is that including the functions as dependencies will cause the function to be called more often than it should. I didn't test it, so I imagine the comment may be necessary if that approach still results in the function being called at the incorrect time, but wanted to mention it in case.

Also, if it is necessary, it can be helpful to add another comment above the eslint-disable-next-line comment, just to clarify why including all dependencies doesn't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the callbacks, and added the appropriate eslint-disable with the functions, playSongWithHlsJs and playSongNatively, that would have caused issues if dependencies of trackSongProgress were included.

Copy link

Visit the wallet preview URL for this PR (updated for commit 8d57b4e):
🚀 https://hdjpa6kw6yjxwqaobmwhxciwfq0xefbd.lambda-url.us-west-2.on.aws/

Copy link

Visit the wallet preview URL for this PR (updated for commit 1532d03):
🚀 https://hdjpa6kw6yjxwqaobmwhxciwfq0xefbd.lambda-url.us-west-2.on.aws/

Copy link

Visit the tools preview URL for this PR (updated for commit 1532d03):
🚀 https://3n5bbc2btz7wy3bjrwd6wqlnli0jlgkh.lambda-url.us-west-2.on.aws/

Copy link

Visit the marketplace preview URL for this PR (updated for commit 1532d03):
🚀 https://nj3f3ffshctdfxuuje7ba7gbsy0bxmoz.lambda-url.us-west-2.on.aws/

@dmkirshon dmkirshon merged commit 4dd27ae into master May 27, 2024
8 checks passed
@dmkirshon dmkirshon deleted the MRKT-27-Single-Item-for-Play_Add-Progress-Bar-to-Song-Card branch May 27, 2024 06:57
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