Skip to content

Commit 005de1d

Browse files
authored
Audio Player Lite
1 parent 010bb9f commit 005de1d

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(function () {
2+
"use strict";
3+
const PluginApi = window.PluginApi;
4+
const React = PluginApi.React;
5+
6+
function setStyle() {
7+
if(!document.querySelector(".VideoPlayer .video-wrapper") || !document.querySelector(".vjs-poster")) {
8+
window.setTimeout(setStyle, 100)
9+
} else {
10+
document.querySelector(".VideoPlayer .video-wrapper").before(document.querySelector(".vjs-poster"))
11+
document.querySelector(".VideoPlayer").classList.add("audio")
12+
}
13+
}
14+
15+
PluginApi.Event.addEventListener("stash:location", async (e) => {
16+
const path = e.detail.data.location.pathname;
17+
const idRegExp = /.*\/scenes\/(\d+)/;
18+
if (idRegExp.test(path)) {
19+
await PluginApi.utils.loadComponents([
20+
PluginApi.loadableComponents.ScenePlayer
21+
]);
22+
PluginApi.patch.instead("ScenePlayer", function (props, _, originalComponent) {
23+
const file = props.scene.files[0];
24+
let scene = props.scene;
25+
if (file.video_codec === "") {
26+
scene = { ...scene,
27+
sceneStreams: props.scene.sceneStreams.filter((ss) => ss.label.toUpperCase() === 'HSL')
28+
};
29+
poster()
30+
}
31+
return originalComponent({ ...props, scene });
32+
});
33+
}
34+
});
35+
})();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Stash Audio Player Lite */
2+
.VideoPlayer.audio .scrubber-wrapper,
3+
.VideoPlayer.audio .vjs-big-play-button,
4+
.VideoPlayer.audio .vjs-big-button-group,
5+
.VideoPlayer.audio .vjs-loading-spinner,
6+
.VideoPlayer.audio .vjs-skip-button {
7+
display: none !important;
8+
}
9+
.VideoPlayer.audio .vjs-control-bar {
10+
display: flex !important;
11+
opacity: 100 !important;
12+
}
13+
.VideoPlayer.audio .vjs-seek-button {
14+
display: block !important;
15+
}
16+
.VideoPlayer.audio .video-js {
17+
background-color: #202b33 !important;
18+
width: 100%;
19+
}
20+
.VideoPlayer.audio #VideoJsPlayer_html5_api {
21+
display: none !important;
22+
}
23+
.VideoPlayer.audio .video-wrapper {
24+
height: 7rem !important;
25+
overflow: visible;
26+
}
27+
.VideoPlayer.audio > .vjs-poster {
28+
height: 56.25vw !important;
29+
position: relative !important;
30+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: StashAudioPlayerLite
2+
description: This plugin identifies files with no video codec and plays them as audio.
3+
version: 0.1
4+
ui:
5+
javascript:
6+
- stashAudioPlayerLite.js
7+
css:
8+
- stashAudioPlayerLite.css

0 commit comments

Comments
 (0)