@sigmaott/base-next 1.4.52 → 1.4.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/locales/en.yaml CHANGED
@@ -121,6 +121,7 @@ ReportSchedule:
121
121
  this_report_will_be_generated_and_sent_daily_at: This report will be generated and sent daily at
122
122
  you_must_select_at_least_one_day_of_the_week_for_weekly_report: You must select at least one day of the week for weekly report
123
123
  SSConfig:
124
+ please_choose_input_pid_in_same_program: Please choose input PID in same program
124
125
  add_ouput: Add ouput
125
126
  adobe_protocol_for_adaptive_bitrate_streaming_via_http: Adobe protocol for adaptive bitrate streaming via HTTP.
126
127
  adobe_protocol_for_low-latency_video_and_audio_streaming: Adobe protocol for low-latency video and audio streaming.
package/locales/vi.yaml CHANGED
@@ -122,6 +122,7 @@ ReportSchedule:
122
122
  this_report_will_be_generated_and_sent_daily_at: Báo cáo này sẽ được tạo và gửi hàng ngày tại
123
123
  you_must_select_at_least_one_day_of_the_week_for_weekly_report: Bạn phải chọn ít nhất một ngày trong tuần để báo cáo hàng tuần
124
124
  SSConfig:
125
+ please_choose_input_pid_in_same_program: Vui lòng chọn Input PID cùng 1 Program
125
126
  add_ouput: Thêm đầu ra
126
127
  adobe_protocol_for_adaptive_bitrate_streaming_via_http: Adobe protocol for adaptive bitrate streaming via HTTP.
127
128
  adobe_protocol_for_low-latency_video_and_audio_streaming: Giao thức Adobe để truyền phát video và âm thanh có độ trễ thấp.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sigmaott/base-next",
3
3
  "type": "module",
4
- "version": "1.4.52",
4
+ "version": "1.4.54",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -128,4 +128,4 @@
128
128
  "nuxt": "3.15.4",
129
129
  "vue-tsc": "^1.8.1"
130
130
  }
131
- }
131
+ }
@@ -1,8 +1,9 @@
1
1
  <script lang="ts" setup>
2
- const { prop, mediaType, isTranscode } = definePropsRefs<{
2
+ const { prop, mediaType, isTranscode = false, idx } = definePropsRefs<{
3
3
  prop?: string
4
4
  mediaType?: string
5
- isTranscode?: string
5
+ isTranscode?: boolean
6
+ idx?: number
6
7
  }>()
7
8
 
8
9
  function getProp(key: string) {
@@ -12,7 +13,35 @@ const { t } = useI18n()
12
13
  const { formValue } = useElFormContext()
13
14
  const isEvent = ref(inject('isEvent'))
14
15
  const isPackage = ref(inject('isPackage'))
15
- const { transcodeInput, packageInput } = useGetInputDetail({ formValue, isTranscode, isPackage, isEvent })
16
+ const { transcodeInput, packageInput } = useGetInputDetail({
17
+ formValue,
18
+ isTranscode: computed(() => !!unref(isTranscode)),
19
+ isPackage,
20
+ isEvent,
21
+ })
22
+
23
+ function getProgramIdByPid(pid: string) {
24
+ if (!pid)
25
+ return null
26
+ let programs: any[] = []
27
+ let programMaps: any[] = []
28
+
29
+ if (isTranscode.value || isEvent.value) {
30
+ programs = Array.isArray(transcodeInput.value?.programs?.[0])
31
+ ? transcodeInput.value.programs[0]
32
+ : transcodeInput.value?.programs ?? []
33
+ programMaps = transcodeInput.value?.programMaps ?? []
34
+ }
35
+ else if (isPackage.value) {
36
+ programs = Array.isArray(packageInput.value?.programs?.[0])
37
+ ? packageInput.value.programs[0]
38
+ : packageInput.value?.programs ?? []
39
+ programMaps = packageInput.value?.programMaps ?? []
40
+ }
41
+ const programMap = programMaps.find((pm: any) => pm.pids?.split(',').includes(pid))
42
+ return programMap?.id
43
+ }
44
+
16
45
  const [inputPIdValue, inputPIdAttrs] = useElField<string>(getProp('streamId'), [
17
46
  {
18
47
  message: t('SSConfig.please_enter_pid'),
@@ -40,6 +69,42 @@ const [inputPIdValue, inputPIdAttrs] = useElField<string>(getProp('streamId'), [
40
69
  return
41
70
  }
42
71
  }
72
+
73
+ const currentProgramId = getProgramIdByPid(value)
74
+ if (currentProgramId) {
75
+ const profiles = formValue.value?.profiles || []
76
+ if (isTranscode.value || isEvent.value) {
77
+ for (const profile of profiles) {
78
+ const hasConflict = profile.presets?.some((p: any) => {
79
+ if (p.streamId && p.streamId !== value) {
80
+ const otherId = getProgramIdByPid(p.streamId)
81
+ return otherId && otherId !== currentProgramId
82
+ }
83
+ return false
84
+ })
85
+ if (hasConflict) {
86
+ callback(new Error(t('SSConfig.please_choose_input_pid_in_same_program')))
87
+ return
88
+ }
89
+ }
90
+ }
91
+ else if (isPackage.value) {
92
+ const profileIdx = idx.value
93
+ const currentProfile = (profileIdx !== undefined && profileIdx !== null) ? profiles[profileIdx] : null
94
+ const hasConflict = currentProfile?.presets?.some((p: any) => {
95
+ if (p.streamId && p.streamId !== value) {
96
+ const otherId = getProgramIdByPid(p.streamId)
97
+ return otherId && otherId !== currentProgramId
98
+ }
99
+ return false
100
+ })
101
+ if (hasConflict) {
102
+ callback(new Error(t('SSConfig.please_choose_input_pid_in_same_program')))
103
+ return
104
+ }
105
+ }
106
+ }
107
+
43
108
  callback()
44
109
  },
45
110
  trigger: ['blur', 'change'],
@@ -78,7 +143,7 @@ const [outputPIdValue, outputPIdAttrs] = useElField<string>(getProp('pid'), [
78
143
  },
79
144
  ])
80
145
 
81
- function filterProgramsById(_programs) {
146
+ function filterProgramsById(_programs: any[]) {
82
147
  return _programs?.filter((program) => {
83
148
  const id = program.id
84
149
 
@@ -93,21 +158,29 @@ function filterProgramsById(_programs) {
93
158
  })
94
159
  }
95
160
  function getStream(type: string) {
161
+ let programs: any[] = []
162
+
96
163
  if (isTranscode.value || isEvent.value) {
97
- const programs = Array.isArray(transcodeInput.value?.programs?.[0])
164
+ programs = Array.isArray(transcodeInput.value?.programs?.[0])
98
165
  ? transcodeInput.value.programs[0]
99
166
  : transcodeInput.value?.programs ?? []
100
-
101
- const newOptions = programs.filter(program => program.type === type)
102
-
103
- return filterProgramsById(newOptions)
104
167
  }
105
168
  else if (isPackage.value) {
106
- const newOptions = packageInput.value?.programs?.[0]?.filter(program => program.type === type)?.length > 0 ? packageInput.value?.programs?.[0]?.filter(program => program.type === type) : packageInput.value?.programs?.filter(program => program.type === type)
107
- return filterProgramsById(newOptions)
169
+ programs = Array.isArray(packageInput.value?.programs?.[0])
170
+ ? packageInput.value.programs[0]
171
+ : packageInput.value?.programs ?? []
108
172
  }
109
173
 
110
- return []
174
+ const filtered = programs.filter(program => program.type === type)
175
+
176
+ const newOptions = filtered.map((program) => {
177
+ return {
178
+ ...program,
179
+ programId: getProgramIdByPid(program.id),
180
+ }
181
+ })
182
+
183
+ return filterProgramsById(newOptions)
111
184
  }
112
185
 
113
186
  function handleChangeInputPID(value: string) {
@@ -126,7 +199,7 @@ function handleChangeOutputPID(value: string) {
126
199
 
127
200
  <template>
128
201
  <DevOnly>
129
- <VueJsonPretty :data="packageInput" />
202
+ <VueJsonPretty :data="getStream(mediaType)" />
130
203
  </DevOnly>
131
204
  <div class="flex flex-wrap gap-2">
132
205
  <el-form-item label="Input PID" v-bind="inputPIdAttrs" class="w-586px">
@@ -134,7 +207,7 @@ function handleChangeOutputPID(value: string) {
134
207
  allow-create @change="handleChangeInputPID">
135
208
  <el-option v-for="(preset, index) in getStream(mediaType)" :key="`${preset.id} + ${index}`"
136
209
  class="w-700px !h-auto" :value="preset.id" :label="preset.id">
137
- <SharedMediaInfoViewer :media="preset" />
210
+ <MediaInfoViewer :isShowPId="true" :media="preset" />
138
211
  </el-option>
139
212
  </el-select>
140
213
  </el-form-item>