fix: player/audio route not able to interact with audioPlayer
This commit is contained in:
10 files changed
+338
-120
No files matched your search
@@ -11,6 +11,25 @@ import Typography from "@mui/material/Typography";
|
||||
|
||||
import "./cardScroller.scss";
|
||||
|
||||
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
|
||||
function RightButton(props) {
|
||||
const { carouselState, children, rtl, ...restProps } = props;
|
||||
return (
|
||||
<IconButton className="card-scroller-button right" {...restProps}>
|
||||
<div className="material-symbols-rounded">chevron_right</div>
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
//@ts-ignore - I don't know the prop type for react-multi-carousel's customRightArrow and customLeftArrow
|
||||
function LeftButton(props) {
|
||||
const { carouselState, children, rtl, ...restProps } = props;
|
||||
return (
|
||||
<IconButton className="card-scroller-button left" {...restProps}>
|
||||
<div className="material-symbols-rounded">chevron_left</div>
|
||||
</IconButton>
|
||||
);
|
||||
}
|
||||
|
||||
export const CardScroller = ({
|
||||
children,
|
||||
displayCards,
|
||||
@@ -77,20 +96,11 @@ export const CardScroller = ({
|
||||
draggable
|
||||
responsive={responsive}
|
||||
arrows
|
||||
rtl={false}
|
||||
className="card-scroller"
|
||||
customTransition="all .6s"
|
||||
transitionDuration={600}
|
||||
customRightArrow={
|
||||
<IconButton className="card-scroller-button right">
|
||||
<div className="material-symbols-rounded">chevron_right</div>
|
||||
</IconButton>
|
||||
}
|
||||
customLeftArrow={
|
||||
<IconButton className="card-scroller-button left">
|
||||
<div className="material-symbols-rounded">chevron_left</div>
|
||||
</IconButton>
|
||||
}
|
||||
customRightArrow={<RightButton />}
|
||||
customLeftArrow={<LeftButton />}
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
|
||||
@@ -72,7 +72,9 @@ const AudioPlayer = () => {
|
||||
// await audioRef.current.play();
|
||||
// setLoading(false);
|
||||
// });
|
||||
// setAudioRef(audioRef);
|
||||
|
||||
// Set the audio ref in the store to allow for global control
|
||||
setAudioRef(audioRef);
|
||||
}
|
||||
}, [url, tracks?.[currentTrack]?.Id]);
|
||||
|
||||
@@ -132,7 +134,7 @@ const AudioPlayer = () => {
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
[tracks?.[currentTrack]?.Id, currentTrack, api.configuration],
|
||||
[tracks?.[currentTrack]?.Id, currentTrack, api?.configuration],
|
||||
);
|
||||
|
||||
const controls = useMemo(
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||
|
||||
import { useSortable } from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
@@ -7,6 +11,8 @@ import { useCallback, useRef } from "react";
|
||||
import { type XYCoord, useDrag, useDrop } from "react-dnd";
|
||||
import type { Identifier } from "typescript";
|
||||
|
||||
|
||||
|
||||
type Props = {
|
||||
track: BaseItemDto;
|
||||
index: number;
|
||||
@@ -17,85 +23,99 @@ const QueueTrack = (props: Props) => {
|
||||
s.tracks,
|
||||
s.currentItemIndex,
|
||||
]);
|
||||
const trackRef = useRef<HTMLDivElement | null>(null);
|
||||
const handleQueueUpdate = useCallback(
|
||||
(dragIndex: number, dropIndex: number) => {
|
||||
const prevState = queue;
|
||||
prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
||||
setQueue(prevState, dropIndex);
|
||||
},
|
||||
[queue],
|
||||
);
|
||||
|
||||
const [{ handlerId }, drop] = useDrop<
|
||||
{
|
||||
index: number;
|
||||
id: string;
|
||||
type: string;
|
||||
},
|
||||
void,
|
||||
{ handlerId: Identifier | null }
|
||||
>({
|
||||
accept: "Row",
|
||||
collect(monitor) {
|
||||
return {
|
||||
handlerId: monitor.getHandlerId(),
|
||||
};
|
||||
},
|
||||
hover(hoverItem, monitor) {
|
||||
console.log(hoverItem);
|
||||
if (!trackRef.current) return;
|
||||
const { attributes, listeners, setNodeRef, transform, transition } =
|
||||
useSortable({
|
||||
id: track.Id,
|
||||
});
|
||||
|
||||
const dragIndex = hoverItem.index;
|
||||
const dropIndex = index;
|
||||
// const trackRef = useRef<HTMLDivElement | null>(null);
|
||||
// const handleQueueUpdate = useCallback(
|
||||
// (dragIndex: number, dropIndex: number) => {
|
||||
// const prevState = queue;
|
||||
// prevState.splice(dropIndex, 0, prevState.splice(dragIndex, 1)[0]);
|
||||
// setQueue(prevState, dropIndex);
|
||||
// },
|
||||
// [queue],
|
||||
// );
|
||||
|
||||
if (dragIndex === dropIndex) return;
|
||||
// const [{ handlerId }, drop] = useDrop<
|
||||
// {
|
||||
// index: number;
|
||||
// id: string;
|
||||
// type: string;
|
||||
// },
|
||||
// void,
|
||||
// { handlerId: Identifier | null }
|
||||
// >({
|
||||
// accept: "Row",
|
||||
// collect(monitor) {
|
||||
// return {
|
||||
// handlerId: monitor.getHandlerId(),
|
||||
// };
|
||||
// },
|
||||
// hover(hoverItem, monitor) {
|
||||
// console.log(hoverItem);
|
||||
// if (!trackRef.current) return;
|
||||
|
||||
const hoverBoundingRect = trackRef.current?.getBoundingClientRect();
|
||||
const hoverMiddleY =
|
||||
(hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
||||
// const dragIndex = hoverItem.index;
|
||||
// const dropIndex = index;
|
||||
|
||||
const clientOffset = monitor.getClientOffset();
|
||||
// if (dragIndex === dropIndex) return;
|
||||
|
||||
const hoverClientY = (clientOffset as XYCoord).y - hoverBoundingRect.top;
|
||||
// const hoverBoundingRect = trackRef.current?.getBoundingClientRect();
|
||||
// const hoverMiddleY =
|
||||
// (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
||||
|
||||
if (dragIndex < dropIndex && hoverClientY < hoverMiddleY) {
|
||||
return;
|
||||
}
|
||||
// const clientOffset = monitor.getClientOffset();
|
||||
|
||||
if (dragIndex > dropIndex && hoverClientY > hoverMiddleY) {
|
||||
return;
|
||||
}
|
||||
// const hoverClientY = (clientOffset as XYCoord).y - hoverBoundingRect.top;
|
||||
|
||||
handleQueueUpdate(dragIndex, dropIndex);
|
||||
hoverItem.index = dropIndex;
|
||||
},
|
||||
});
|
||||
// if (dragIndex < dropIndex && hoverClientY < hoverMiddleY) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
const [{ isDragging }, drag] = useDrag({
|
||||
type: "Row",
|
||||
item: () => {
|
||||
const id = track.Id;
|
||||
return { id, index };
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isDragging: monitor.isDragging(),
|
||||
}),
|
||||
});
|
||||
// if (dragIndex > dropIndex && hoverClientY > hoverMiddleY) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
drag(drop(trackRef));
|
||||
// handleQueueUpdate(dragIndex, dropIndex);
|
||||
// hoverItem.index = dropIndex;
|
||||
// },
|
||||
// });
|
||||
|
||||
// const [{ isDragging }, drag] = useDrag({
|
||||
// type: "Row",
|
||||
// item: () => {
|
||||
// const id = track.Id;
|
||||
// return { id, index };
|
||||
// },
|
||||
// collect: (monitor) => ({
|
||||
// isDragging: monitor.isDragging(),
|
||||
// }),
|
||||
// });
|
||||
|
||||
// drag(drop(trackRef));
|
||||
|
||||
const style = {
|
||||
// opacity: isDragging ? 0.5 : 1,
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={trackRef}
|
||||
style={{ opacity: isDragging ? 0.5 : 1 }}
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
className={
|
||||
currentItemIndex === index
|
||||
? "audio-queue-track active"
|
||||
: "audio-queue-track"
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">drag_handle</span>
|
||||
<span {...attributes} {...listeners} className="material-symbols-rounded">
|
||||
drag_handle
|
||||
</span>
|
||||
<div className="audio-queue-track-info">
|
||||
<Typography className="audio-queue-track-info-name">
|
||||
{track.Name}
|
||||
@@ -105,7 +125,7 @@ const QueueTrack = (props: Props) => {
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeMusic(track.RunTimeTicks)}
|
||||
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -212,7 +212,7 @@ function MusicAlbumTitlePage() {
|
||||
/>
|
||||
</div>
|
||||
<div className="item-info-track-container ">
|
||||
{allDiscs.length > 0 ? (
|
||||
{allDiscs.length > 1 ? (
|
||||
allDiscs.map((disc) => (
|
||||
<>
|
||||
<div
|
||||
|
||||
@@ -48,15 +48,19 @@
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
|
||||
margin-top: 2em;
|
||||
&-track {
|
||||
padding: 1em;
|
||||
display: grid;
|
||||
grid-template-columns: 3em 1fr 6em;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
gap: 1em;
|
||||
.material-symbols-rounded{
|
||||
cursor: grab;
|
||||
}
|
||||
&-info-name {
|
||||
transition: $transition-time-fast;
|
||||
}
|
||||
@@ -66,11 +70,17 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
&.dragging {
|
||||
background: black;
|
||||
border-radius: 10px;
|
||||
width: calc(100% + 2em);
|
||||
cursor: grabbing;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-lyrics {
|
||||
max-height: 40vh;
|
||||
overflow:visible;
|
||||
overflow: visible;
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
// border: 1px solid rgb(255 255 255 / 0.2);
|
||||
padding: 2em;
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useAudioPlayback } from "@/utils/store/audioPlayback";
|
||||
import useQueue from "@/utils/store/queue";
|
||||
import useQueue, { setQueue } from "@/utils/store/queue";
|
||||
import { Fab, IconButton, Slider, Typography } from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import "./audio.scss";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||
import QueueTrack from "@/components/queueTrack";
|
||||
@@ -21,6 +14,27 @@ import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
DndContext,
|
||||
type DragEndEvent,
|
||||
DragOverlay,
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
closestCenter,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from "@dnd-kit/core";
|
||||
import {
|
||||
restrictToVerticalAxis,
|
||||
restrictToWindowEdges,
|
||||
} from "@dnd-kit/modifiers";
|
||||
import {
|
||||
SortableContext,
|
||||
arrayMove,
|
||||
sortableKeyboardCoordinates,
|
||||
verticalListSortingStrategy,
|
||||
} from "@dnd-kit/sortable";
|
||||
|
||||
export const Route = createFileRoute("/_api/player/audio")({
|
||||
component: AudioPlayerRoute,
|
||||
});
|
||||
@@ -30,11 +44,19 @@ const SEEK_AMOUNT = 10; // seconds to skip on fast_rewind or fast_forward button
|
||||
function AudioPlayerRoute() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [queue, currentTrack] = useQueue((s) => [s.tracks, s.currentItemIndex]);
|
||||
const [item] = useAudioPlayback((s) => [s.item]);
|
||||
const audioPlayer: HTMLAudioElement | null = useMemo(
|
||||
() => document.querySelector("#audio-player"),
|
||||
[item],
|
||||
const [item, audioPlayerRef] = useAudioPlayback((s) => [
|
||||
s.item,
|
||||
s.player.ref,
|
||||
]);
|
||||
const [audioPlayer, setAudioPlayer] = useState<HTMLAudioElement | null>(
|
||||
audioPlayerRef?.current,
|
||||
);
|
||||
useEffect(() => {
|
||||
console.log(audioPlayerRef);
|
||||
setAudioPlayer(audioPlayerRef.current);
|
||||
}, [audioPlayerRef?.current]);
|
||||
|
||||
console.log(audioPlayer?.paused);
|
||||
|
||||
const [isScrubbing, setIsScrubbing] = useState(false);
|
||||
const [sliderProgress, setSliderProgress] = useState<number | number[]>(0); // this state hold the slider scrubbing value allowing user to scrub track without changing current time
|
||||
@@ -56,10 +78,14 @@ function AudioPlayerRoute() {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
audioPlayer?.addEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayer.currentTime ?? 0);
|
||||
audioPlayerRef?.current?.addEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||
});
|
||||
console.log(audioPlayer);
|
||||
return () => {
|
||||
audioPlayerRef?.current?.removeEventListener("timeupdate", () => {
|
||||
setProgress(audioPlayerRef?.current?.currentTime ?? 0);
|
||||
});
|
||||
};
|
||||
}, [item?.Id, currentTrack]);
|
||||
|
||||
const lyricsContainer = useRef<HTMLDivElement | null>(null);
|
||||
@@ -74,11 +100,39 @@ function AudioPlayerRoute() {
|
||||
}
|
||||
}, [showLyrics, audioPlayer?.currentTime]);
|
||||
|
||||
const sensors = useSensors(
|
||||
useSensor(PointerSensor),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
);
|
||||
const handleDragEnd = (event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
if (active.id !== over?.id) {
|
||||
const prevState = queue;
|
||||
const oldIndex = prevState?.map((item) => item.Id).indexOf(active.id);
|
||||
const newIndex = prevState?.map((item) => item.Id).indexOf(over.id);
|
||||
|
||||
const newState = prevState
|
||||
? arrayMove(prevState, oldIndex, newIndex)
|
||||
: prevState;
|
||||
|
||||
const currentTrack = newState?.map((item) => item.Id).indexOf(item?.Id);
|
||||
|
||||
setQueue(newState, currentTrack);
|
||||
// setQueue(newState);
|
||||
}
|
||||
};
|
||||
|
||||
const [currentDraggingIndex, setCurrentDraggingIndex] = useState<
|
||||
number | null
|
||||
>(null);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="scrollY padded-top flex flex-column"
|
||||
style={{ gap: "1em" }}
|
||||
key={queue[currentTrack]?.Id}
|
||||
key={item?.Id}
|
||||
>
|
||||
<div className="audio-info-container">
|
||||
<div className="audio-info-image-container">
|
||||
@@ -86,7 +140,7 @@ function AudioPlayerRoute() {
|
||||
<img
|
||||
alt={item.Name ?? "Music"}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.Id,
|
||||
item.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.ImageTags.Primary,
|
||||
@@ -122,6 +176,7 @@ function AudioPlayerRoute() {
|
||||
value={isScrubbing ? sliderProgress : secToTicks(progress)}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
key={item?.Id}
|
||||
onChange={(_, newVal) => {
|
||||
setIsScrubbing(true);
|
||||
setSliderProgress(newVal);
|
||||
@@ -131,8 +186,8 @@ function AudioPlayerRoute() {
|
||||
Array.isArray(newVal)
|
||||
? setProgress(ticksToSec(newVal[0]))
|
||||
: setProgress(ticksToSec(newVal));
|
||||
if (audioPlayer) {
|
||||
audioPlayer.currentTime = Array.isArray(newVal)
|
||||
if (audioPlayerRef?.current) {
|
||||
audioPlayerRef.current.currentTime = Array.isArray(newVal)
|
||||
? ticksToSec(newVal[0])
|
||||
: ticksToSec(newVal);
|
||||
}
|
||||
@@ -182,13 +237,14 @@ function AudioPlayerRoute() {
|
||||
<span className="material-symbols-rounded">fast_rewind</span>
|
||||
</IconButton>
|
||||
<Fab
|
||||
disabled={!audioPlayer?.readyState}
|
||||
disabled={!audioPlayerRef?.current?.readyState}
|
||||
//@ts-ignore
|
||||
color="white"
|
||||
size="large"
|
||||
onClick={() =>
|
||||
audioPlayer?.paused
|
||||
? audioPlayer.play()
|
||||
: audioPlayer?.pause()
|
||||
audioPlayerRef?.current?.paused
|
||||
? audioPlayerRef?.current?.play()
|
||||
: audioPlayerRef?.current?.pause()
|
||||
}
|
||||
>
|
||||
<span
|
||||
@@ -197,7 +253,7 @@ function AudioPlayerRoute() {
|
||||
fontSize: "2.4em",
|
||||
}}
|
||||
>
|
||||
{audioPlayer?.paused ? "play_arrow" : "pause"}
|
||||
{audioPlayerRef?.current?.paused ? "play_arrow" : "pause"}
|
||||
</span>
|
||||
</Fab>
|
||||
<IconButton
|
||||
@@ -238,7 +294,7 @@ function AudioPlayerRoute() {
|
||||
className="audio-lyrics-line"
|
||||
key={`${lyric.Text}${index}`}
|
||||
data-active-lyric={
|
||||
secToTicks(audioPlayer?.currentTime) >= lyric.Start &&
|
||||
secToTicks(audioPlayer?.currentTime) >= (lyric.Start ?? 0) &&
|
||||
secToTicks(audioPlayer?.currentTime) <
|
||||
(lyrics.data?.[0]?.Lyrics?.Lyrics?.[index + 1]?.Start ?? 0)
|
||||
}
|
||||
@@ -263,14 +319,58 @@ function AudioPlayerRoute() {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="audio-queue-container">
|
||||
<Typography variant="h5">Queue:</Typography>
|
||||
<div className="audio-queue">
|
||||
{queue.map((track, index) => (
|
||||
<QueueTrack key={track.Id} track={track} index={index} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
onDragStart={(event) => {
|
||||
const { active } = event;
|
||||
setCurrentDraggingIndex(
|
||||
queue?.map((item) => item.Id).indexOf(active.id),
|
||||
);
|
||||
}}
|
||||
modifiers={[restrictToVerticalAxis]}
|
||||
>
|
||||
{queue && (
|
||||
<div className="audio-queue-container">
|
||||
<Typography variant="h5">Queue:</Typography>
|
||||
<SortableContext
|
||||
items={queue?.map((track) => track.Id)}
|
||||
strategy={verticalListSortingStrategy}
|
||||
>
|
||||
<div className="audio-queue">
|
||||
{queue?.map((track, index) => (
|
||||
<QueueTrack key={track.Id} track={track} index={index} />
|
||||
))}
|
||||
</div>
|
||||
</SortableContext>
|
||||
<DragOverlay modifiers={[restrictToWindowEdges]}>
|
||||
{(currentDraggingIndex ?? -1) >= 0 && (
|
||||
<div className="audio-queue-track dragging">
|
||||
<span className="material-symbols-rounded">drag_handle</span>
|
||||
<div className="audio-queue-track-info">
|
||||
<Typography className="audio-queue-track-info-name">
|
||||
{queue[currentDraggingIndex].Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
fontWeight={300}
|
||||
className="opacity-07"
|
||||
variant="subtitle2"
|
||||
>
|
||||
{queue[currentDraggingIndex].Artists?.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeMusic(
|
||||
queue[currentDraggingIndex].RunTimeTicks ?? 0,
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</DragOverlay>
|
||||
</div>
|
||||
)}
|
||||
</DndContext>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import playbackProfile from "../playback-profiles";
|
||||
import type IntroMediaInfo from "../types/introMediaInfo";
|
||||
import type subtitlePlaybackInfo from "../types/subtitlePlaybackInfo";
|
||||
import { axiosClient } from "./api";
|
||||
import { playAudio } from "./audioPlayback";
|
||||
import { generateAudioStreamUrl, playAudio } from "./audioPlayback";
|
||||
import useQueue, { setQueue, setTrackIndex } from "./queue";
|
||||
|
||||
type PlaybackStore = {
|
||||
@@ -139,16 +139,16 @@ export const playItemFromQueue = async (
|
||||
const prevMediaSourceId = usePlaybackStore.getState().mediaSource.id;
|
||||
const item = queueItems[requestedItemIndex];
|
||||
if (item.Type === "Audio") {
|
||||
const urlOptions = {
|
||||
deviceId: api?.deviceInfo.id,
|
||||
const playbackUrl = generateAudioStreamUrl(
|
||||
item.Id,
|
||||
userId,
|
||||
api_key: api?.accessToken,
|
||||
};
|
||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||
|
||||
const playbackUrl = `${api.basePath}/Audio/${item?.Id}/universal?${urlParams}`;
|
||||
api?.deviceInfo.id,
|
||||
api?.basePath,
|
||||
api?.accessToken,
|
||||
);
|
||||
console.log(item);
|
||||
playAudio(playbackUrl, item, undefined, queueItems, requestedItemIndex);
|
||||
playAudio(playbackUrl, item, undefined);
|
||||
setQueue(queueItems, requestedItemIndex);
|
||||
} else {
|
||||
const mediaSource = (
|
||||
await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||
|
||||
Reference in new issue
Block a user