mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Add marker videojs plugin (#2447)
This commit is contained in:
@@ -6,6 +6,7 @@ import "videojs-seek-buttons";
|
||||
import "videojs-landscape-fullscreen";
|
||||
import "./live";
|
||||
import "./PlaylistButtons";
|
||||
import "./markers";
|
||||
import cx from "classnames";
|
||||
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
@@ -136,6 +137,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||
volumePanel: {
|
||||
inline: false,
|
||||
},
|
||||
chaptersButton: false,
|
||||
},
|
||||
nativeControlsForTouch: false,
|
||||
playbackRates: [0.75, 1, 1.5, 2, 3, 4],
|
||||
@@ -160,6 +162,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||
},
|
||||
});
|
||||
|
||||
(player as any).markers();
|
||||
(player as any).offset();
|
||||
|
||||
player.focus();
|
||||
@@ -270,6 +273,12 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||
// otherwise, the offset will be applied to the next file when
|
||||
// currentTime is called.
|
||||
(player as any).clearOffsetDuration();
|
||||
|
||||
const tracks = player.remoteTextTracks();
|
||||
if (tracks.length > 0) {
|
||||
player.removeRemoteTextTrack(tracks[0] as any);
|
||||
}
|
||||
|
||||
player.src(
|
||||
scene.sceneStreams.map((stream) => ({
|
||||
src: stream.url,
|
||||
@@ -277,6 +286,18 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
|
||||
label: stream.label ?? undefined,
|
||||
}))
|
||||
);
|
||||
|
||||
if (scene.paths.chapters_vtt) {
|
||||
player.addRemoteTextTrack(
|
||||
{
|
||||
src: scene.paths.chapters_vtt,
|
||||
kind: "chapters",
|
||||
default: true,
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
player.currentTime(0);
|
||||
|
||||
player.loop(
|
||||
|
||||
Reference in New Issue
Block a user