From b46b44d2d4e000d8e62dc1bad59168994cf3a9d4 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Tue, 7 Dec 2021 13:39:04 +0700 Subject: [PATCH] music video --- resources/cider-ui-tests/index.js | 15 ++++++++- resources/cider-ui-tests/style.css | 42 ++++++++++++++++++++++++- resources/cider-ui-tests/views/main.ejs | 11 ++++++- 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/resources/cider-ui-tests/index.js b/resources/cider-ui-tests/index.js index 567ec759..ddaa1c50 100644 --- a/resources/cider-ui-tests/index.js +++ b/resources/cider-ui-tests/index.js @@ -136,6 +136,8 @@ const app = new Vue({ // Set profile name this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "") + MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player") + this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => { self.playerLCD.playbackDuration = (self.mk.currentPlaybackTime) self.lyriccurrenttime = app.mk.currentPlaybackTime; @@ -204,6 +206,13 @@ const app = new Vue({ }) this.mk.addEventListener(MusicKit.Events.nowPlayingItemDidChange, (a) => { + let type = (self.mk.nowPlayingItem != null) ? self.mk.nowPlayingItem["type"] ?? '' : ''; + + if (type.includes("musicVideo")){ + document.getElementById("apple-music-video-container").style.display = "block"; + } else { + document.getElementById("apple-music-video-container").style.display = "none"; + } self.chrome.artworkReady = false self.lyrics = [] app.loadLyrics() @@ -244,7 +253,7 @@ const app = new Vue({ if(kind.toString().includes("artist")){ app.getArtistInfo(id, isLibrary) } - else if(!kind.toString().includes("radioStation") && !kind.toString().includes("song")) + else if(!kind.toString().includes("radioStation") && !kind.toString().includes("song") && !kind.toString().includes("musicVideo")) {app.page = (kind) + "_"+ (id); console.log("oks"); app.getTypeFromID((kind),(id), (isLibrary));} else { @@ -256,6 +265,10 @@ const app = new Vue({ let self = this }, + exitMV(){ + MusicKit.getInstance().stop() + document.getElementById("apple-music-video-container").style.display = "none"; + }, getArtistInfo(id, isLibrary){ var query = {"omit[resource]": "autos", views: ["featured-release", "full-albums", "appears-on-albums", "featured-albums", "featured-on-albums", "singles", "compilation-albums", "live-albums", "latest-release", "top-music-videos", "similar-artists", "top-songs", "playlists", "more-to-hear", "more-to-see"], diff --git a/resources/cider-ui-tests/style.css b/resources/cider-ui-tests/style.css index 9ac1da36..36c008cd 100644 --- a/resources/cider-ui-tests/style.css +++ b/resources/cider-ui-tests/style.css @@ -1858,7 +1858,47 @@ input[type=range].web-slider::-webkit-slider-runnable-track { margin-right: 5px; } -.playlist-display .playlist-info .playlist-time { +.playlist-time { + font-size: 0.9em; margin: 6px; opacity: 0.7; +} + +#apple-music-video-container { + background: black; + position: absolute; + float: left; + display: none; + width: 100%; + height: 100%; + top: 0; + z-index: 100000; +} + +#apple-music-video-player{ + position: absolute; + top: 50%; + width: 100%; + transform: translate(0, -50%); + +} + +#apple-music-video-player-controls{ + position: absolute; + z-index: 100001; + float: left; + width: 100%; + height: 100%; +} + +#apple-music-video-player-controls #player-exit{ + position: absolute; + z-index: 100001; + float: left; + width: 100%; + margin: 10px; +} + +#apple-music-video-player-controls:hover{ + opacity: 1; } \ No newline at end of file diff --git a/resources/cider-ui-tests/views/main.ejs b/resources/cider-ui-tests/views/main.ejs index 87ac4839..62b75f51 100644 --- a/resources/cider-ui-tests/views/main.ejs +++ b/resources/cider-ui-tests/views/main.ejs @@ -324,7 +324,16 @@
- +
+
+
+ + + +
+
+
+
<%- include("components/mediaitem-artwork"); %>