Skip to content

Commit 63f8716

Browse files
authored
Preload default video settings. (#723)
1 parent 46c6be2 commit 63f8716

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

app/templates/custom-elements/video-settings-dialog.html

+31-25
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ <h3>Applying Video Settings</h3>
8888
constructor() {
8989
super();
9090
this.attachShadow({ mode: "open" });
91+
this.defaultSettings = {};
9192
}
9293

9394
connectedCallback() {
@@ -179,7 +180,12 @@ <h3>Applying Video Settings</h3>
179180

180181
getSettings() {
181182
this.state = "loading";
182-
Promise.all([this._getVideoFps(), this._getVideoJpegQuality()])
183+
Promise.all([
184+
this._getVideoFps(),
185+
this._getVideoJpegQuality(),
186+
this._getDefaultVideoFps(),
187+
this._getDefaultVideoJpegQuality(),
188+
])
183189
.then(() => {
184190
this.state = "edit";
185191
})
@@ -189,59 +195,59 @@ <h3>Applying Video Settings</h3>
189195
});
190196
}
191197

192-
_restoreVideoFps() {
198+
_getDefaultVideoFps() {
193199
return controllers
194200
.getDefaultVideoFps()
195201
.then((videoFps) => {
196-
this.shadowRoot.querySelector(
197-
"#video-fps-slider"
198-
).value = videoFps;
199-
this._setVideoFpsDisplay(videoFps);
202+
this.defaultSettings.videoFps = videoFps;
200203
})
201204
.catch((error) => {
202205
this.dispatchEvent(
203206
new DialogFailedEvent({
204-
title: "Failed to Restore Video FPS",
207+
title: "Failed to Load Default Video FPS",
205208
details: error,
206209
})
207210
);
208211
return Promise.reject(error);
209212
});
210213
}
211214

212-
_restoreVideoJpegQuality() {
215+
_getDefaultVideoJpegQuality() {
213216
return controllers
214217
.getDefaultVideoJpegQuality()
215218
.then((videoJpegQuality) => {
216-
this.shadowRoot.querySelector(
217-
"#video-jpeg-quality-slider"
218-
).value = videoJpegQuality;
219-
this._setVideoJpegQualityDisplay(videoJpegQuality);
219+
this.defaultSettings.videoJpegQuality = videoJpegQuality;
220220
})
221221
.catch((error) => {
222222
this.dispatchEvent(
223223
new DialogFailedEvent({
224-
title: "Failed to Restore Video JPEG Quality",
224+
title: "Failed to Load Default Video JPEG Quality",
225225
details: error,
226226
})
227227
);
228228
return Promise.reject(error);
229229
});
230230
}
231231

232+
_restoreVideoFps() {
233+
this.shadowRoot.querySelector(
234+
"#video-fps-slider"
235+
).value = this.defaultSettings.videoFps;
236+
this._setVideoFpsDisplay(this.defaultSettings.videoFps);
237+
}
238+
239+
_restoreVideoJpegQuality() {
240+
this.shadowRoot.querySelector(
241+
"#video-jpeg-quality-slider"
242+
).value = this.defaultSettings.videoJpegQuality;
243+
this._setVideoJpegQualityDisplay(
244+
this.defaultSettings.videoJpegQuality
245+
);
246+
}
247+
232248
_restoreSettings() {
233-
this.state = "loading";
234-
Promise.all([
235-
this._restoreVideoFps(),
236-
this._restoreVideoJpegQuality(),
237-
])
238-
.then(() => {
239-
this.state = "edit";
240-
})
241-
.catch(() => {
242-
// Ignore errors here because they have already been handled by
243-
// their individual setting restore function.
244-
});
249+
this._restoreVideoFps();
250+
this._restoreVideoJpegQuality();
245251
}
246252

247253
_saveVideoFps() {

0 commit comments

Comments
 (0)