diff --git a/app/app.html b/app/app.html
index 66f0a53..b17f5d4 100644
--- a/app/app.html
+++ b/app/app.html
@@ -122,7 +122,7 @@
- Settings [WIP]
+ Settings
@@ -259,7 +259,7 @@
-
+
@@ -300,11 +300,11 @@
-
+
-
+
diff --git a/app/js/playerHandler.js b/app/js/playerHandler.js
index 155b6e2..9adcc99 100644
--- a/app/js/playerHandler.js
+++ b/app/js/playerHandler.js
@@ -110,25 +110,29 @@ function createThumbnail(vid) {
}
}
-function finishThumbnails() {
- let thumbVid = document.createElement("video")
- thumbVid.src = video.src
- thumbVid.addEventListener('loadeddata', function (e) {
- loadTime();
- }, false);
+function finishThumbnails(file) {
+ if (settings.player5) {
+ let thumbVid = document.createElement("video")
+ file.getBlobURL((err, url) => {
+ thumbVid.src = url
+ })
+ thumbVid.addEventListener('loadeddata', function (e) {
+ loadTime();
+ }, false)
- thumbVid.addEventListener('seeked', function () {
- createThumbnail(thumbVid);
- loadTime();
- }, false);
+ thumbVid.addEventListener('seeked', function () {
+ createThumbnail(thumbVid);
+ loadTime();
+ }, false)
- function loadTime() {
- if (thumbVid.ended == false) {
- thumbVid.currentTime = thumbVid.currentTime + 5;
- } else {
- thumbVid.remove()
+ function loadTime() {
+ if (thumbVid.ended == false) {
+ thumbVid.currentTime = thumbVid.currentTime + 5;
+ } else {
+ thumbVid.remove()
+ }
}
- };
+ }
}
@@ -257,7 +261,7 @@ async function bpip() {
}
}
-if (settings.player7){
+if (settings.player7) {
video.setAttribute("autoPictureInPicture", "");
} else {
video.setAttribute("disablePictureInPicture", "");
@@ -265,7 +269,7 @@ if (settings.player7){
}
//miniplayer
-if (!settings.player4){
+if (!settings.player4) {
document.documentElement.style.setProperty("--miniplayer-display", "none");
}
// theathe mode
@@ -337,7 +341,7 @@ function selectLang(lang) {
bcap()
}
-document.documentElement.style.setProperty("--sub-font", `"${settings.subtitle1}"`);
+document.documentElement.style.setProperty("--sub-font", settings.subtitle1);
// keybinds
document.onkeydown = function (a) {
diff --git a/app/js/subtitleHandler.js b/app/js/subtitleHandler.js
index dbb87de..fc521fe 100644
--- a/app/js/subtitleHandler.js
+++ b/app/js/subtitleHandler.js
@@ -8,8 +8,6 @@ function parseSubs(range, stream) {
} else {
subtitleStream = new SubtitleStream()
subtitleStream.once('tracks', function (pTracks) {
- tracks = []
- video.textTracks = {}
pTracks.forEach(track => {
tracks[track.number] = video.addTextTrack('captions', track.type, track.language || track.number)
})
diff --git a/app/js/torrentHandler.js b/app/js/torrentHandler.js
index 28c97c9..3c716a3 100644
--- a/app/js/torrentHandler.js
+++ b/app/js/torrentHandler.js
@@ -54,6 +54,8 @@ async function addTorrent(magnet) {
halfmoon.hideModal("tsearch")
document.location.href = "#player"
video.src = ""
+ tracks = []
+ video.textTracks = {}
await sw
client.add(magnet, async function (torrent) {
function onProgress() {
@@ -65,16 +67,6 @@ async function addTorrent(magnet) {
torrent.on('upload', onProgress)
// torrent.on('warning', console.warn) // too spammy for now
// torrent.on('error', console.error)
- torrent.on('done', function () {
- setInterval(onProgress, 5000)
- halfmoon.initStickyAlert({
- content: `${torrent.infoHash} has finished downloading. Now seeding.`,
- title: "Download Complete",
- alertType: "alert-success",
- fillType: ""
- });
- // finishThumbnails(); //disabled for performance and testing reasons
- })
torrent.on('noPeers', function () {
halfmoon.initStickyAlert({
content: `Couldn't find peers for ${magnet}! Try a torrent with more seeders.`,
@@ -89,6 +81,16 @@ async function addTorrent(magnet) {
videoFile = file
}
})
+ torrent.on('done', function () {
+ setInterval(onProgress, 5000)
+ halfmoon.initStickyAlert({
+ content: `${torrent.infoHash} has finished downloading. Now seeding.`,
+ title: "Download Complete",
+ alertType: "alert-success",
+ fillType: ""
+ });
+ finishThumbnails(videoFile);
+ })
subtitleStream = undefined
video.src = `${scope}webtorrent/${torrent.infoHash}/${encodeURI(videoFile.path)}`
selPlaying(selected)