Skip to content

Commit

Permalink
perf: ♻️ Optimize recording
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Nov 2, 2023
1 parent 0f72090 commit f4dfb2c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/locales/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@
"preferences.window.disable-screen-saver.placeholder": "Disable computer screensaver",
"preferences.record.name": "Recording",
"preferences.record.format.name": "Format",
"preferences.record.time-limit.name": "Recording Time Limit",
"preferences.record.time-limit.placeholder": "Default No time limit",
"preferences.record.format.placeholder": "Default *.mp4",
"preferences.record.lock-video-orientation.name": "Video Direction",
"preferences.record.lock-video-orientation.placeholder": "Default Device Orientation",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
"preferences.record.name": "音视频录制",
"preferences.record.format.name": "录制视频格式",
"preferences.record.format.placeholder": "默认为 *.mp4 格式",
"preferences.record.time-limit.name": "录制时长",
"preferences.record.time-limit.placeholder": "默认不限时长",
"preferences.record.lock-video-orientation.name": "录制视频方向",
"preferences.record.lock-video-orientation.placeholder": "默认为设备默认方向",
"preferences.record.disable-video.name": "禁用视频录制",
Expand Down
13 changes: 5 additions & 8 deletions src/store/preference/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export const usePreferenceStore = defineStore({
window.appStore.get('scrcpy.deviceScope') || 'global',
)

const recordKeys = Object.values(model?.record?.children || {}).map(
item => item.field,
)

return {
model: cloneDeep(model),
data: { ...getDefaultData() },
Expand All @@ -31,14 +35,7 @@ export const usePreferenceStore = defineStore({
'--audio-code',
...getOtherFields('scrcpy'),
],
recordKeys: [
'--record-format',
'--lock-video-orientation',
'--no-video',
'--no-audio',
'--no-video-playback',
'--no-audio-playback',
],
recordKeys,
}
},
getters: {},
Expand Down
38 changes: 23 additions & 15 deletions src/store/preference/model/record/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export default {
},
],
},
timeLimit: {
label: 'preferences.record.time-limit.name',
field: '--time-limit',
type: 'Input.number',
value: '',
placeholder: 'preferences.record.time-limit.placeholder',
append: 's',
},
lockVideoOrientation: {
label: 'preferences.record.lock-video-orientation.name',
field: '--lock-video-orientation',
Expand All @@ -32,28 +40,28 @@ export default {
{ label: '90°', value: '3' },
],
},
// noVideo: {
// label: 'preferences.record.disable-video.name',
// field: '--no-video',
// type: 'Switch',
// value: null,
// placeholder: 'preferences.record.disable-video.placeholder',
// },
noVideo: {
label: 'preferences.record.disable-video.name',
field: '--no-video',
type: 'Switch',
value: null,
placeholder: 'preferences.record.disable-video.placeholder',
},
noAudio: {
label: 'preferences.record.disable-audio.name',
field: '--no-audio',
type: 'Switch',
value: null,
placeholder: 'preferences.record.disable-audio.placeholder',
},
// noVideoPlayback: {
// label: 'preferences.record.no-video-playback.name',
// field: '--no-video-playback',
// type: 'Switch',
// value: null,
// placeholder: 'preferences.record.no-video-playback.placeholder',
// tips: 'preferences.record.no-video-playback.tips',
// },
noVideoPlayback: {
label: 'preferences.record.no-video-playback.name',
field: '--no-video-playback',
type: 'Switch',
value: null,
placeholder: 'preferences.record.no-video-playback.placeholder',
tips: 'preferences.record.no-video-playback.tips',
},
noAudioPlayback: {
label: 'preferences.record.no-audio-playback.name',
field: '--no-audio-playback',
Expand Down

0 comments on commit f4dfb2c

Please sign in to comment.