Skip to content

Commit

Permalink
Add interface option to show range markers
Browse files Browse the repository at this point in the history
  • Loading branch information
skier233 committed Feb 7, 2025
1 parent 8c46b72 commit 25152a1
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 7 deletions.
6 changes: 6 additions & 0 deletions graphql/schema/types/config.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ input ConfigInterfaceInput {
"Show scene scrubber by default"
showScrubber: Boolean

"Show scene range markers by default"
showRangeMarkers: Boolean

"Maximum duration (in seconds) in which a scene video will loop in the scene player"
maximumLoopDuration: Int
"If true, video will autostart on load in the scene player"
Expand Down Expand Up @@ -421,6 +424,9 @@ type ConfigInterfaceResult {
"Show scene scrubber by default"
showScrubber: Boolean

"Show scene range markers by default"
showRangeMarkers: Boolean

"Maximum duration (in seconds) in which a scene video will loop in the scene player"
maximumLoopDuration: Int
"True if we should not auto-open a browser window on startup"
Expand Down
1 change: 1 addition & 0 deletions internal/api/resolver_mutation_configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ func (r *mutationResolver) ConfigureInterface(ctx context.Context, input ConfigI
r.setConfigBool(config.NotificationsEnabled, input.NotificationsEnabled)

r.setConfigBool(config.ShowScrubber, input.ShowScrubber)
r.setConfigBool(config.ShowRangeMarkers, input.ShowRangeMarkers)

r.setConfigString(config.WallPlayback, input.WallPlayback)
r.setConfigInt(config.MaximumLoopDuration, input.MaximumLoopDuration)
Expand Down
2 changes: 2 additions & 0 deletions internal/api/resolver_query_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
soundOnPreview := config.GetSoundOnPreview()
wallShowTitle := config.GetWallShowTitle()
showScrubber := config.GetShowScrubber()
showRangeMarkers := config.GetShowRangeMarkers()
wallPlayback := config.GetWallPlayback()
noBrowser := config.GetNoBrowser()
notificationsEnabled := config.GetNotificationsEnabled()
Expand Down Expand Up @@ -168,6 +169,7 @@ func makeConfigInterfaceResult() *ConfigInterfaceResult {
WallShowTitle: &wallShowTitle,
WallPlayback: &wallPlayback,
ShowScrubber: &showScrubber,
ShowRangeMarkers: &showRangeMarkers,
MaximumLoopDuration: &maximumLoopDuration,
NoBrowser: &noBrowser,
NotificationsEnabled: &notificationsEnabled,
Expand Down
7 changes: 7 additions & 0 deletions internal/manager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ const (
ShowScrubber = "show_scrubber"
showScrubberDefault = true

ShowRangeMarkers = "show_rangemarkers"
showRangeMarkersDef = true

WallPlayback = "wall_playback"
defaultWallPlayback = "video"

Expand Down Expand Up @@ -1212,6 +1215,10 @@ func (i *Config) GetShowScrubber() bool {
return i.getBoolDefault(ShowScrubber, showScrubberDefault)
}

func (i *Config) GetShowRangeMarkers() bool {
return i.getBoolDefault(ShowRangeMarkers, showRangeMarkersDef)
}

func (i *Config) GetMaximumLoopDuration() int {
return i.getInt(MaximumLoopDuration)
}
Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/graphql/data/config.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ fragment ConfigInterfaceData on ConfigInterfaceResult {
wallShowTitle
wallPlayback
showScrubber
showRangeMarkers
maximumLoopDuration
noBrowser
notificationsEnabled
Expand Down
16 changes: 12 additions & 4 deletions ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,21 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
// Wait for colors
await markers.findColors(uniqueTagNames);

const showRangeTags = interfaceConfig?.showRangeMarkers ?? true;
const timestampMarkers: IMarker[] = [];
const rangeMarkers: IMarker[] = [];
for (const marker of markerData) {
if (marker.end_seconds === null) {

if (!showRangeTags) {
for (const marker of markerData) {
timestampMarkers.push(marker);
} else {
rangeMarkers.push(marker);
}
} else {
for (const marker of markerData) {
if (marker.end_seconds === null) {
timestampMarkers.push(marker);
} else {
rangeMarkers.push(marker);
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions ui/v2.5/src/components/ScenePlayer/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ class MarkersPlugin extends videojs.getPlugin("plugin") {
range?: HTMLDivElement;
} = {};
const seekBar = this.player.el().querySelector(".vjs-progress-control");
if (marker.end_seconds) {
throw new Error("Cannot add range marker with addDotMarker");
}

markerSet.dot = videojs.dom.createEl("div") as HTMLDivElement;
markerSet.dot.className = "vjs-marker-dot";
if (duration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ export const SettingsInterfacePanel: React.FC = PatchComponent(
checked={iface.showScrubber ?? undefined}
onChange={(v) => saveInterface({ showScrubber: v })}
/>
<BooleanSetting
id="show-rangemarkers"
headingID="config.ui.scene_player.options.show_rangemarkers"
checked={iface.showRangeMarkers ?? undefined}
onChange={(v) => saveInterface({ showRangeMarkers: v })}
/>
<BooleanSetting
id="always-start-from-beginning"
headingID="config.ui.scene_player.options.always_start_from_beginning"
Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@
"enable_chromecast": "Enable Chromecast",
"show_ab_loop_controls": "Show AB Loop plugin controls",
"show_scrubber": "Show Scrubber",
"show_rangemarkers": "Show Range Markers",
"track_activity": "Enable Scene Play history",
"vr_tag": {
"description": "The VR button will only be displayed for scenes with this tag.",
Expand Down

0 comments on commit 25152a1

Please sign in to comment.