Skip to content

Commit 6591d68

Browse files
committed
feat(MusicKitMusicPlayerService): support music videos
1 parent 17ecb11 commit 6591d68

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/services/MusicPlayer/MusicKitMusicPlayerService.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class MusicKitMusicPlayerService extends MusicPlayerService<MusicKitSong>
146146
MusicKit.CatalogSearchQuery
147147
>("/v1/catalog/{{storefrontId}}/search", {
148148
term,
149-
types: ["songs"],
149+
types: ["songs", "music-videos"],
150150
limit: 25,
151151
offset,
152152
});
@@ -248,6 +248,10 @@ export class MusicKitMusicPlayerService extends MusicPlayerService<MusicKitSong>
248248
break;
249249
}
250250
});
251+
252+
// NOTE: Required for Music Videos to work
253+
const dummyVideoContainer = document.createElement("div");
254+
music.videoContainerElement = dummyVideoContainer;
251255
}
252256

253257
handleDeinitialization(): void {}

src/types/musickit/instance.ts

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ declare global {
9797
readonly developerToken: string;
9898
musicUserToken?: string;
9999
isAuthorized: boolean;
100+
videoContainerElement?: HTMLElement;
100101

101102
readonly nowPlayingItem?: MediaItem;
102103
/** The volume of audio playback, which is set directly on the HTMLMediaElement as the HTMLMediaElement.volume property. This value ranges between 0, which would be muting the audio, and 1, which would be the loudest possible. */

0 commit comments

Comments
 (0)