Skip to content

Commit

Permalink
hmm..
Browse files Browse the repository at this point in the history
  • Loading branch information
wont-stream committed Sep 27, 2024
1 parent 08a5db2 commit 90e0ba9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/DiscordRPC/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ let track;
let paused = true;
let time = 0;

const mediaItemCache = new MediaItemCache();


export function update(data) {
track = data?.track ?? track;
paused = data?.paused ?? paused;
Expand Down Expand Up @@ -75,7 +78,7 @@ const unloadTransition = intercept(
"playbackControls/MEDIA_PRODUCT_TRANSITION",
([media]) => {
const mediaProduct = media.mediaProduct;
MediaItemCache.ensure(mediaProduct.productId)
mediaItemCache.ensure(mediaProduct.productId)
.then((track) => {
if (track) update({ track, time: 0 });
})
Expand Down Expand Up @@ -106,7 +109,7 @@ const { playbackContext, playbackState, latestCurrentTime } =
getPlaybackControl();

update({
track: await MediaItemCache.ensure(playbackContext?.actualProductId),
track: await mediaItemCache.ensure(playbackContext?.actualProductId),
time: latestCurrentTime,
paused: playbackState !== "PLAYING",
});
Expand Down

0 comments on commit 90e0ba9

Please sign in to comment.