Skip to content

Commit

Permalink
adds audio player
Browse files Browse the repository at this point in the history
  • Loading branch information
uF4No committed Aug 18, 2022
1 parent b744992 commit d11cdd4
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions components/Song.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,25 @@ export default function Song({ song }) {
Price: {utils.formatEther(song.price)} MATIC
</p>
</div>
<p className="text-sm my-4">
{song.author == address
? `You're the author`
: `${song.buyers.length - 1} buyers`}
</p>
{canPlay ? (
<a
className="w-auto px-4 py-2 border border-transparent text-sm font-medium rounded-md text-blue-700 bg-blue-100 hover:bg-blue-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
href={songURL}
target="_blank"
rel="noopener noreferrer"
>
Listen song
</a>
<div className="flex flex-col items-center gap-4">
<audio controls>
<source src={songURL} type="audio/mpeg"></source>
</audio>
<a
className="w-auto px-4 py-2 border border-transparent text-sm font-medium rounded-md text-blue-700 bg-blue-100 hover:bg-blue-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
href={songURL}
target="_blank"
rel="noopener noreferrer"
>
Download song
</a>
</div>
) : (
<button
className="w-auto px-4 py-2 border border-transparent text-sm font-medium rounded-md text-orange-700 bg-orange-100 hover:bg-orange-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-orange-500"
Expand All @@ -127,12 +137,6 @@ export default function Song({ song }) {
{isLoading ? 'In progress...' : 'Buy song'}
</button>
)}

<p className="text-sm my-4">
{song.author == address
? `You're the author`
: `${song.buyers.length - 1} buyers`}
</p>
</div>
)
}

1 comment on commit d11cdd4

@vercel
Copy link

@vercel vercel bot commented on d11cdd4 Aug 18, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.