feat: add scaled wrapper page for netease web player

This commit is contained in:
2026-08-17 19:09:31 +08:00
parent 00f8bc674a
commit 703621f9d7
2 changed files with 46 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>网易云音乐</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a1a1a; }
#frame {
position: absolute;
top: 0; left: 0;
width: 1280px; /* 网易云 PC 版参考宽度 */
height: 720px; /* 参考高度(16:9 */
transform-origin: 0 0;
border: none;
}
</style>
</head>
<body>
<iframe id="frame" src="https://music.163.com/st/webplayer" allow="autoplay; encrypted-media"></iframe>
<script>
// 动态缩放:使网易云 PC 版 UI 适配 Hearth 的内容区(横屏)
// Dynamically scale the NetEase PC UI to fit Hearth's landscape content area
(function () {
var FRAME_W = 1280;
var FRAME_H = 720;
function fit() {
var frame = document.getElementById('frame');
var w = window.innerWidth;
var h = window.innerHeight;
var scale = Math.min(w / FRAME_W, h / FRAME_H);
frame.style.transform = 'scale(' + scale + ')';
// 缩放后居中
var sw = FRAME_W * scale;
var sh = FRAME_H * scale;
frame.style.left = ((w - sw) / 2) + 'px';
frame.style.top = ((h - sh) / 2) + 'px';
}
window.addEventListener('resize', fit);
fit();
})();
</script>
</body>
</html>
+1 -1
View File
@@ -16,7 +16,7 @@
"id": "cloudmusic", "id": "cloudmusic",
"name": "网易云音乐", "name": "网易云音乐",
"icon": "icons/cloudmusic.svg", "icon": "icons/cloudmusic.svg",
"url": "https://music.163.com/st/webplayer" "url": "apps/cloudmusic/index.html"
} }
] ]
} }