misc
This commit is contained in:
@@ -240,8 +240,10 @@ export default function MediaRequestForm() {
|
||||
audio.src = sourceUrl;
|
||||
setAudioProgress({ current: 0, duration: 0 });
|
||||
setCurrentTrackId(track.id);
|
||||
setIsAudioPlaying(true);
|
||||
await audio.play();
|
||||
} catch (error) {
|
||||
setIsAudioPlaying(false);
|
||||
console.error(error);
|
||||
toast.error("Failed to play track.");
|
||||
if (!fromQueue) {
|
||||
@@ -492,13 +494,16 @@ export default function MediaRequestForm() {
|
||||
|
||||
if (currentTrackId === track.id) {
|
||||
if (audio.paused) {
|
||||
setIsAudioPlaying(true);
|
||||
try {
|
||||
await audio.play();
|
||||
} catch (error) {
|
||||
setIsAudioPlaying(false);
|
||||
console.error(error);
|
||||
toast.error("Unable to resume playback.");
|
||||
}
|
||||
} else {
|
||||
setIsAudioPlaying(false);
|
||||
audio.pause();
|
||||
}
|
||||
return;
|
||||
@@ -547,13 +552,16 @@ export default function MediaRequestForm() {
|
||||
|
||||
if (queueAlbumId === albumId && playbackQueue.length > 0) {
|
||||
if (audio.paused) {
|
||||
setIsAudioPlaying(true);
|
||||
try {
|
||||
await audio.play();
|
||||
} catch (error) {
|
||||
setIsAudioPlaying(false);
|
||||
console.error(error);
|
||||
toast.error("Unable to resume album playback.");
|
||||
}
|
||||
} else {
|
||||
setIsAudioPlaying(false);
|
||||
audio.pause();
|
||||
}
|
||||
return;
|
||||
@@ -1182,7 +1190,21 @@ export default function MediaRequestForm() {
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleTrackPlayPause(track, id, albumIndex)}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleTrackPlayPause(track, id, albumIndex);
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
try {
|
||||
if (e?.pointerType === "touch" || e.type === "touchstart") {
|
||||
e.preventDefault();
|
||||
}
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
}}
|
||||
style={{ touchAction: "manipulation" }}
|
||||
className={`flex items-center justify-center w-8 h-8 rounded-full border text-sm transition-colors disabled:opacity-60 disabled:cursor-not-allowed ${isCurrentTrack && isAudioPlaying
|
||||
? "border-green-600 text-green-600"
|
||||
: "border-neutral-400 text-neutral-600 hover:text-blue-600 hover:border-blue-600"}`}
|
||||
@@ -1213,6 +1235,7 @@ export default function MediaRequestForm() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleTrackDownload(track)}
|
||||
referrerPolicy="no-referrer"
|
||||
className="text-neutral-500 hover:text-blue-600 underline whitespace-nowrap cursor-pointer"
|
||||
aria-label={`Download ${track.title}`}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user