hls fix progress

This commit is contained in:
booploops 2021-12-10 21:51:34 -08:00
parent 6585bcde1b
commit f92b5ac293
4 changed files with 31054 additions and 3 deletions

File diff suppressed because it is too large Load diff

View file

@ -31,8 +31,18 @@
} }
// bind them together // bind them together
if (this.$refs.video) { if (this.$refs.video) {
let d = "WIDEVINE_SOFTWARE"
let h = {
initDataTypes: ["cenc", "keyids"],
distinctiveIdentifier: "optional",
persistentState: "required"
}
let p = {
platformInfo: {requiresCDMAttachOnStart: !0, maxSecurityLevel: d, keySystemConfig: h},
appData: {serviceName: "Apple Music"}
}
this.hls.attachMedia(this.$refs.video); this.hls.attachMedia(this.$refs.video);
this.hls.loadSource(this.video); this.hls.loadSource(this.video, p);
this.hls.loadLevel = 4; this.hls.loadLevel = 4;
} }
}) })

View file

@ -22,6 +22,7 @@
<script src="vue-observe-visibility.min.js"></script> <script src="vue-observe-visibility.min.js"></script>
<script src="vuedraggable.umd.min.js"></script> <script src="vuedraggable.umd.min.js"></script>
<link rel="manifest" href="./manifest.json?v=2"> <link rel="manifest" href="./manifest.json?v=2">
<script src="https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js"></script>
</head> </head>
<body oncontextmenu="return false;" loading="1" platform="<%= env.platform %>"> <body oncontextmenu="return false;" loading="1" platform="<%= env.platform %>">
@ -500,8 +501,8 @@
</template> </template>
</div> </div>
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://js-cdn.music.apple.com/musickit/v2/amp/musickit.js"></script> <script src="https://js-cdn.music.apple.com/musickit/v2/amp/musickit.js"></script>
<script src="index.js?v=1"></script> <script src="index.js?v=1"></script>
</body> </body>
</html> </html>

View file

@ -1,4 +1,4 @@
const {app, BrowserWindow, ipcMain} = require("electron") const {app, BrowserWindow, ipcMain, protocol} = require("electron")
const {join, resolve} = require("path") const {join, resolve} = require("path")
const getPort = require("get-port"); const getPort = require("get-port");
const express = require("express"); const express = require("express");
@ -52,6 +52,18 @@ const CiderBase = {
win = new BrowserWindow(options) win = new BrowserWindow(options)
} }
// intercept "https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js" and redirect to local file "./apple-hls.js" instead
win.webContents.session.webRequest.onBeforeRequest(
{
urls: ["https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js"]
},
(details, callback) => {
callback({
redirectURL: "http://localhost:9000/apple-hls.js"
})
}
)
let location = "http://localhost:9000/" let location = "http://localhost:9000/"
win.loadURL(location) win.loadURL(location)
win.on("closed", () => { win.on("closed", () => {