@sigmaott/base-next 1.4.57 → 1.4.59
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { parseURL, withQuery } from
|
|
2
|
-
import { ElNotification } from
|
|
1
|
+
import { parseURL, withQuery } from "ufo";
|
|
2
|
+
import { ElNotification } from "element-plus";
|
|
3
3
|
|
|
4
4
|
// Extend Window interface to include SigmaManager and shaka
|
|
5
5
|
declare global {
|
|
6
6
|
interface Window {
|
|
7
|
-
SigmaManager: any
|
|
8
|
-
shaka: any
|
|
7
|
+
SigmaManager: any;
|
|
8
|
+
shaka: any;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -14,203 +14,214 @@ export function usePreviewLoader() {
|
|
|
14
14
|
|
|
15
15
|
function loadScript(src: string): Promise<Event> {
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
17
|
-
const script = document.createElement(
|
|
18
|
-
script.async = true
|
|
19
|
-
script.src = src
|
|
20
|
-
script.onload = resolve
|
|
21
|
-
script.onerror = reject
|
|
22
|
-
document.body.appendChild(script)
|
|
23
|
-
})
|
|
17
|
+
const script = document.createElement("script");
|
|
18
|
+
script.async = true;
|
|
19
|
+
script.src = src;
|
|
20
|
+
script.onload = resolve;
|
|
21
|
+
script.onerror = reject;
|
|
22
|
+
document.body.appendChild(script);
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const drmSrc =
|
|
27
|
-
let pendingPromise: Promise<any> | null = null
|
|
26
|
+
const drmSrc = "/scripts/SigmaPlayer.min.js";
|
|
27
|
+
let pendingPromise: Promise<any> | null = null;
|
|
28
28
|
|
|
29
29
|
function promiseFinished() {
|
|
30
|
-
pendingPromise = null
|
|
30
|
+
pendingPromise = null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function loadDrm() {
|
|
34
|
-
if (window.SigmaManager)
|
|
35
|
-
return Promise.resolve(window.SigmaManager)
|
|
34
|
+
if (window.SigmaManager) return Promise.resolve(window.SigmaManager);
|
|
36
35
|
|
|
37
|
-
if (pendingPromise)
|
|
38
|
-
return pendingPromise
|
|
36
|
+
if (pendingPromise) return pendingPromise;
|
|
39
37
|
|
|
40
38
|
pendingPromise = loadScript(drmSrc)
|
|
41
39
|
.then(() => window.SigmaManager)
|
|
42
40
|
.catch((error) => {
|
|
43
41
|
ElNotification.error({
|
|
44
|
-
title:
|
|
45
|
-
message:
|
|
42
|
+
title: "Script Loading Error",
|
|
43
|
+
message:
|
|
44
|
+
"Failed to load SigmaPlayer script. Please check your internet connection and try again.",
|
|
46
45
|
duration: 5000,
|
|
47
|
-
})
|
|
48
|
-
throw error
|
|
49
|
-
})
|
|
50
|
-
pendingPromise.then(promiseFinished).catch(promiseFinished)
|
|
51
|
-
return pendingPromise
|
|
46
|
+
});
|
|
47
|
+
throw error;
|
|
48
|
+
});
|
|
49
|
+
pendingPromise.then(promiseFinished).catch(promiseFinished);
|
|
50
|
+
return pendingPromise;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
const isLoaded = ref(false)
|
|
53
|
+
const isLoaded = ref(false);
|
|
55
54
|
|
|
56
55
|
onMounted(async () => {
|
|
57
56
|
try {
|
|
58
|
-
await loadDrm()
|
|
59
|
-
isLoaded.value = true
|
|
57
|
+
await loadDrm();
|
|
58
|
+
isLoaded.value = true;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("Failed to load DRM script:", error);
|
|
61
|
+
isLoaded.value = false;
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
console.error('Failed to load DRM script:', error)
|
|
63
|
-
isLoaded.value = false
|
|
64
|
-
}
|
|
65
|
-
})
|
|
63
|
+
});
|
|
66
64
|
|
|
67
65
|
//
|
|
68
|
-
const isLoaded2 = ref(false)
|
|
66
|
+
const isLoaded2 = ref(false);
|
|
69
67
|
|
|
70
|
-
const shakaSrc =
|
|
71
|
-
|
|
68
|
+
const shakaSrc =
|
|
69
|
+
"https://cdnjs.cloudflare.com/ajax/libs/shaka-player/3.0.4/shaka-player.compiled.js";
|
|
70
|
+
let pendingShakaPromise: Promise<any> | null = null;
|
|
72
71
|
|
|
73
72
|
function promiseFinishedShaka() {
|
|
74
|
-
pendingShakaPromise = null
|
|
73
|
+
pendingShakaPromise = null;
|
|
75
74
|
}
|
|
76
75
|
function loadShaka() {
|
|
77
|
-
if (window.shaka)
|
|
78
|
-
return Promise.resolve(window.shaka)
|
|
76
|
+
if (window.shaka) return Promise.resolve(window.shaka);
|
|
79
77
|
|
|
80
|
-
if (pendingShakaPromise)
|
|
81
|
-
return pendingShakaPromise
|
|
78
|
+
if (pendingShakaPromise) return pendingShakaPromise;
|
|
82
79
|
|
|
83
80
|
pendingShakaPromise = loadScript(shakaSrc)
|
|
84
81
|
.then(() => window.shaka)
|
|
85
82
|
.catch((error) => {
|
|
86
83
|
ElNotification.error({
|
|
87
|
-
title:
|
|
88
|
-
message:
|
|
84
|
+
title: "Script Loading Error",
|
|
85
|
+
message:
|
|
86
|
+
"Failed to load Shaka Player script. Please check your internet connection and try again.",
|
|
89
87
|
duration: 5000,
|
|
90
|
-
})
|
|
91
|
-
throw error
|
|
92
|
-
})
|
|
93
|
-
pendingShakaPromise.then(promiseFinishedShaka).catch(promiseFinishedShaka)
|
|
94
|
-
return pendingShakaPromise
|
|
88
|
+
});
|
|
89
|
+
throw error;
|
|
90
|
+
});
|
|
91
|
+
pendingShakaPromise.then(promiseFinishedShaka).catch(promiseFinishedShaka);
|
|
92
|
+
return pendingShakaPromise;
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
onMounted(async () => {
|
|
98
96
|
try {
|
|
99
|
-
await loadShaka()
|
|
100
|
-
isLoaded2.value = true
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
isLoaded2.value = false
|
|
97
|
+
await loadShaka();
|
|
98
|
+
isLoaded2.value = true;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error("Failed to load Shaka script:", error);
|
|
101
|
+
isLoaded2.value = false;
|
|
105
102
|
}
|
|
106
|
-
})
|
|
103
|
+
});
|
|
107
104
|
|
|
108
105
|
return {
|
|
109
106
|
isLoaded,
|
|
110
107
|
isLoaded2,
|
|
111
|
-
}
|
|
108
|
+
};
|
|
112
109
|
// END PLAYER
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
interface ChannelActions {
|
|
116
|
-
handleChannel?: (...rest: any) => void
|
|
117
|
-
switchBlackout?: (...rest: any) => void
|
|
113
|
+
handleChannel?: (...rest: any) => void;
|
|
114
|
+
switchBlackout?: (...rest: any) => void;
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
const [useJobPreview, useInjectJobPreview] = createInjectionState(() => {
|
|
121
|
-
const { isLoaded, isLoaded2 } = usePreviewLoader()
|
|
118
|
+
const { isLoaded, isLoaded2 } = usePreviewLoader();
|
|
122
119
|
|
|
123
120
|
const actions = ref<Required<ChannelActions>>({
|
|
124
121
|
handleChannel: () => {},
|
|
125
122
|
switchBlackout: () => {},
|
|
126
|
-
})
|
|
123
|
+
});
|
|
127
124
|
|
|
128
125
|
const paramQueryPreview = ref({
|
|
129
|
-
channelId:
|
|
130
|
-
jobId:
|
|
131
|
-
})
|
|
132
|
-
const playVisible = ref(false)
|
|
126
|
+
channelId: "",
|
|
127
|
+
jobId: "",
|
|
128
|
+
});
|
|
129
|
+
const playVisible = ref(false);
|
|
133
130
|
|
|
134
|
-
const channelName = ref(
|
|
135
|
-
const blackoutActive = ref(
|
|
136
|
-
const srcPreview1 = ref(
|
|
137
|
-
const srcPreview2 = ref(
|
|
131
|
+
const channelName = ref("");
|
|
132
|
+
const blackoutActive = ref("");
|
|
133
|
+
const srcPreview1 = ref("");
|
|
134
|
+
const srcPreview2 = ref("");
|
|
138
135
|
|
|
139
|
-
const vttLink = ref(undefined)
|
|
136
|
+
const vttLink = ref(undefined);
|
|
140
137
|
// new mode replace catchup | live
|
|
141
|
-
const playMode1 = ref(
|
|
142
|
-
const playMode2 = ref(
|
|
143
|
-
const catchupEnabled = ref(false)
|
|
138
|
+
const playMode1 = ref("catchup");
|
|
139
|
+
const playMode2 = ref("catchup");
|
|
140
|
+
const catchupEnabled = ref(false);
|
|
144
141
|
function getCatchupTime() {
|
|
145
|
-
return [
|
|
142
|
+
return [
|
|
143
|
+
dayjs().subtract(1, "hour").format("HH:mm:ss"),
|
|
144
|
+
dayjs().format("HH:mm:ss"),
|
|
145
|
+
];
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
function getTimeshiftTime() {
|
|
149
|
-
return 30
|
|
149
|
+
return 30;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
function getDelayTime() {
|
|
153
|
-
return 30
|
|
153
|
+
return 30;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const catchupTime1 = ref(getCatchupTime())
|
|
157
|
-
const catchupTime2 = ref(getCatchupTime())
|
|
158
|
-
const delayTime1 = ref(getDelayTime())
|
|
159
|
-
const delayTime2 = ref(getDelayTime())
|
|
160
|
-
const timeshiftTime1 = ref(getTimeshiftTime())
|
|
161
|
-
const timeshiftTime2 = ref(getTimeshiftTime())
|
|
162
|
-
const typeOutput = ref(
|
|
163
|
-
const nameOutput = ref(
|
|
164
|
-
const drm1 = ref()
|
|
165
|
-
const drm2 = ref()
|
|
166
|
-
const drmCredentials = ref(
|
|
167
|
-
const videoType1 = ref(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
156
|
+
const catchupTime1 = ref(getCatchupTime());
|
|
157
|
+
const catchupTime2 = ref(getCatchupTime());
|
|
158
|
+
const delayTime1 = ref(getDelayTime());
|
|
159
|
+
const delayTime2 = ref(getDelayTime());
|
|
160
|
+
const timeshiftTime1 = ref(getTimeshiftTime());
|
|
161
|
+
const timeshiftTime2 = ref(getTimeshiftTime());
|
|
162
|
+
const typeOutput = ref("hls");
|
|
163
|
+
const nameOutput = ref("");
|
|
164
|
+
const drm1 = ref();
|
|
165
|
+
const drm2 = ref();
|
|
166
|
+
const drmCredentials = ref("");
|
|
167
|
+
const videoType1 = ref(
|
|
168
|
+
typeOutput.value === "hls-dash" ? "hls" : typeOutput.value,
|
|
169
|
+
);
|
|
170
|
+
const videoType2 = ref(
|
|
171
|
+
typeOutput.value === "hls-dash" ? "hls" : typeOutput.value,
|
|
172
|
+
);
|
|
173
|
+
const channelType = ref("transcode");
|
|
174
|
+
const isEventChannel = computed(() => channelType.value === "event");
|
|
175
|
+
const enableForensicWatermarkAB = ref(false);
|
|
176
|
+
|
|
177
|
+
const isSigmaMediaServer = ref(false);
|
|
178
|
+
const serverId = ref("");
|
|
179
|
+
|
|
180
|
+
const channelId = computed(() => paramQueryPreview.value.channelId);
|
|
181
|
+
const jobId = computed(() => paramQueryPreview.value.jobId);
|
|
178
182
|
|
|
179
183
|
const { data, refetch } = useQuery(
|
|
180
|
-
[
|
|
184
|
+
["preview-job", isEventChannel, channelId, jobId],
|
|
181
185
|
async () => {
|
|
182
|
-
if (channelType.value ===
|
|
183
|
-
return await $playoutApi(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
if (channelType.value === "playout") {
|
|
187
|
+
return await $playoutApi(
|
|
188
|
+
"api/playout/fast-channels/{id}/jobs/{jobId}/actions/get-preview",
|
|
189
|
+
{
|
|
190
|
+
method: "GET",
|
|
191
|
+
pathParams: {
|
|
192
|
+
id: channelId.value,
|
|
193
|
+
jobId: jobId.value,
|
|
194
|
+
},
|
|
188
195
|
},
|
|
189
|
-
|
|
196
|
+
);
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
const endpoint = isEventChannel.value
|
|
193
|
-
?
|
|
194
|
-
:
|
|
200
|
+
? "api/transcode/event-channels/{channelId}/jobs/{jobId}/actions/get-preview"
|
|
201
|
+
: "api/transcode/channels/{channelId}/jobs/{jobId}/actions/get-preview";
|
|
195
202
|
return await $transcodeApi(endpoint, {
|
|
196
|
-
method:
|
|
203
|
+
method: "GET",
|
|
197
204
|
pathParams: {
|
|
198
205
|
channelId: channelId.value,
|
|
199
206
|
jobId: jobId.value,
|
|
200
207
|
},
|
|
201
|
-
})
|
|
208
|
+
});
|
|
202
209
|
},
|
|
203
210
|
{
|
|
204
|
-
enabled: computed(
|
|
211
|
+
enabled: computed(
|
|
212
|
+
() =>
|
|
213
|
+
!!paramQueryPreview.value.channelId &&
|
|
214
|
+
!!paramQueryPreview.value.jobId,
|
|
215
|
+
),
|
|
205
216
|
refetchOnWindowFocus: false,
|
|
206
217
|
keepPreviousData: true,
|
|
207
218
|
},
|
|
208
|
-
)
|
|
219
|
+
);
|
|
209
220
|
|
|
210
221
|
// hh:mm:ss to timestamp
|
|
211
222
|
function convertToTimestamp(time: string) {
|
|
212
|
-
const dateObject = dayjs(time,
|
|
213
|
-
return Math.floor(dateObject.valueOf() / 1000)
|
|
223
|
+
const dateObject = dayjs(time, "HH:mm:ss");
|
|
224
|
+
return Math.floor(dateObject.valueOf() / 1000);
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
// TODO: update the logic for playMode
|
|
@@ -222,145 +233,166 @@ const [useJobPreview, useInjectJobPreview] = createInjectionState(() => {
|
|
|
222
233
|
timeshiftTime,
|
|
223
234
|
videoType,
|
|
224
235
|
}: {
|
|
225
|
-
srcStr?: string
|
|
226
|
-
playMode: string
|
|
227
|
-
catchupTime?: string[]
|
|
228
|
-
delayTime?: number
|
|
229
|
-
timeshiftTime?: number
|
|
230
|
-
videoType?: string
|
|
236
|
+
srcStr?: string;
|
|
237
|
+
playMode: string;
|
|
238
|
+
catchupTime?: string[];
|
|
239
|
+
delayTime?: number;
|
|
240
|
+
timeshiftTime?: number;
|
|
241
|
+
videoType?: string;
|
|
231
242
|
}) {
|
|
232
|
-
const ext = videoType ===
|
|
243
|
+
const ext = videoType === "hls" ? ".m3u8" : ".mpd";
|
|
233
244
|
const originalSrc = isEventChannel.value
|
|
234
245
|
? data.value.url
|
|
235
246
|
: Array.isArray(data.value?.url)
|
|
236
247
|
? data.value?.url?.find((item: string) => item.includes(ext))
|
|
237
|
-
: data.value?.url
|
|
248
|
+
: data.value?.url;
|
|
238
249
|
|
|
239
|
-
const parsedSrc = parseURL(
|
|
250
|
+
const parsedSrc = parseURL(
|
|
251
|
+
(srcStr || originalSrc).replace(".m3u8", ext).replace(".mpd", ext),
|
|
252
|
+
);
|
|
240
253
|
|
|
241
|
-
const src =
|
|
242
|
-
|
|
243
|
-
|
|
254
|
+
const src =
|
|
255
|
+
parsedSrc.protocol && parsedSrc.host
|
|
256
|
+
? `${parsedSrc.protocol}//${parsedSrc.host}${parsedSrc.pathname}`
|
|
257
|
+
: parsedSrc.pathname;
|
|
244
258
|
|
|
245
|
-
if (playMode ===
|
|
259
|
+
if (playMode === "catchup") {
|
|
246
260
|
return withQuery(src, {
|
|
247
261
|
start: convertToTimestamp(catchupTime[0]),
|
|
248
262
|
stop: convertToTimestamp(catchupTime[1]),
|
|
249
|
-
})
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
else if (playMode === 'delay') {
|
|
263
|
+
});
|
|
264
|
+
} else if (playMode === "live") {
|
|
265
|
+
return src;
|
|
266
|
+
} else if (playMode === "delay") {
|
|
255
267
|
return withQuery(src, {
|
|
256
268
|
delay: delayTime,
|
|
257
|
-
})
|
|
258
|
-
}
|
|
259
|
-
else if (playMode === 'timeshift') {
|
|
269
|
+
});
|
|
270
|
+
} else if (playMode === "timeshift") {
|
|
260
271
|
return withQuery(src, {
|
|
261
272
|
timeshift: timeshiftTime,
|
|
262
|
-
})
|
|
273
|
+
});
|
|
263
274
|
}
|
|
264
|
-
return src
|
|
275
|
+
return src;
|
|
265
276
|
}
|
|
266
277
|
|
|
267
278
|
function handleUpdateBlackoutMode(value: boolean) {
|
|
268
|
-
blackoutActive.value = value
|
|
279
|
+
blackoutActive.value = value;
|
|
269
280
|
}
|
|
270
281
|
|
|
271
|
-
async function handlePlayback(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
async function handlePlayback(
|
|
283
|
+
payload: {
|
|
284
|
+
channelId: string;
|
|
285
|
+
jobId: string;
|
|
286
|
+
type: string;
|
|
287
|
+
channelName: string;
|
|
288
|
+
blackoutActive: boolean;
|
|
289
|
+
typeOutput?: string;
|
|
290
|
+
nameOutput?: string;
|
|
291
|
+
drm?: any;
|
|
292
|
+
channelType?: string;
|
|
293
|
+
catchupEnabled?: boolean;
|
|
294
|
+
enableForensicWatermarkAB?: boolean;
|
|
295
|
+
},
|
|
296
|
+
actionsObj: ChannelActions = {},
|
|
297
|
+
) {
|
|
298
|
+
paramQueryPreview.value.jobId = payload.jobId;
|
|
299
|
+
paramQueryPreview.value.channelId = payload.channelId;
|
|
300
|
+
channelType.value = payload.channelType ?? "";
|
|
301
|
+
channelName.value = payload.channelName;
|
|
302
|
+
blackoutActive.value = payload.blackoutActive;
|
|
303
|
+
console.log(
|
|
304
|
+
"🚀 ~ const[useJobPreview,useInjectJobPreview]=createInjectionState ~ payload:",
|
|
305
|
+
payload,
|
|
306
|
+
);
|
|
307
|
+
enableForensicWatermarkAB.value = payload.enableForensicWatermarkAB;
|
|
291
308
|
|
|
292
309
|
actions.value = {
|
|
293
310
|
handleChannel: actionsObj.handleChannel || (() => {}),
|
|
294
311
|
switchBlackout: actionsObj.switchBlackout || (() => {}),
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const data = await refetch()
|
|
298
|
-
serverId.value = data.data?.machineConfig?.machineId
|
|
299
|
-
isSigmaMediaServer.value =
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
playMode1.value =
|
|
317
|
-
playMode2.value =
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const data = await refetch();
|
|
315
|
+
serverId.value = data.data?.machineConfig?.machineId;
|
|
316
|
+
isSigmaMediaServer.value =
|
|
317
|
+
data.data?.machineConfig?.machineType === "SIGMA_MACHINE";
|
|
318
|
+
|
|
319
|
+
catchupTime1.value = getCatchupTime();
|
|
320
|
+
catchupTime2.value = getCatchupTime();
|
|
321
|
+
delayTime1.value = getDelayTime();
|
|
322
|
+
delayTime2.value = getDelayTime();
|
|
323
|
+
timeshiftTime1.value = getTimeshiftTime();
|
|
324
|
+
timeshiftTime2.value = getTimeshiftTime();
|
|
325
|
+
|
|
326
|
+
const ext =
|
|
327
|
+
(payload.typeOutput === "hls-dash" ? "hls" : payload.typeOutput) === "hls"
|
|
328
|
+
? ".m3u8"
|
|
329
|
+
: ".mpd";
|
|
330
|
+
|
|
331
|
+
catchupEnabled.value = payload.catchupEnabled;
|
|
332
|
+
if (payload.type === "catchup") {
|
|
333
|
+
playMode1.value = "catchup";
|
|
334
|
+
playMode2.value = "catchup";
|
|
335
|
+
} else if (payload.type === "package") {
|
|
336
|
+
playMode1.value = "live";
|
|
337
|
+
playMode2.value = "live";
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
// SESSION: drm
|
|
321
|
-
drm1.value =
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
341
|
+
drm1.value =
|
|
342
|
+
{
|
|
343
|
+
...payload.drm,
|
|
344
|
+
sessionId: "",
|
|
345
|
+
userId: "",
|
|
346
|
+
appId: "",
|
|
347
|
+
merchantId: "",
|
|
348
|
+
} || undefined;
|
|
349
|
+
drm2.value =
|
|
350
|
+
{
|
|
351
|
+
...payload.drm,
|
|
352
|
+
sessionId: "",
|
|
353
|
+
userId: "",
|
|
354
|
+
appId: "",
|
|
355
|
+
merchantId: "",
|
|
356
|
+
} || undefined;
|
|
357
|
+
|
|
358
|
+
const keyProviderValue =
|
|
359
|
+
payload.drm?.keyProvider === "drmtoday" ? "DRM_TODAY" : "SIGMA";
|
|
360
|
+
|
|
361
|
+
if (channelType.value === "playout" && payload.drm?.enable) {
|
|
362
|
+
const res = await $playoutApi("/api/playout/drm-credentials", {
|
|
340
363
|
page: 1,
|
|
341
364
|
perPage: 10,
|
|
342
|
-
q:
|
|
343
|
-
sort:
|
|
365
|
+
q: "",
|
|
366
|
+
sort: "",
|
|
344
367
|
provider: keyProviderValue,
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
drmCredentials.value = res.data?.find(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
drmCredentials.value = res.data?.find(
|
|
371
|
+
(item) => item.id === payload.drm?.drmManagementId,
|
|
372
|
+
)?.name;
|
|
373
|
+
} else if (
|
|
374
|
+
(channelType.value === "transcode" ||
|
|
375
|
+
channelType.value === "package" ||
|
|
376
|
+
channelType.value === "event") &&
|
|
377
|
+
payload.drm?.enable
|
|
378
|
+
) {
|
|
379
|
+
const res = await $transcodeApi("/api/transcode/drm-credentials", {
|
|
351
380
|
page: 1,
|
|
352
381
|
perPage: 1000,
|
|
353
382
|
provider: keyProviderValue,
|
|
354
|
-
})
|
|
355
|
-
drmCredentials.value = res.data?.find(
|
|
383
|
+
});
|
|
384
|
+
drmCredentials.value = res.data?.find(
|
|
385
|
+
(item) => item.id === payload.drm?.drmManagementId,
|
|
386
|
+
)?.name;
|
|
356
387
|
}
|
|
357
388
|
// END SESSION: drm
|
|
358
389
|
|
|
359
|
-
typeOutput.value = payload.typeOutput ??
|
|
360
|
-
nameOutput.value = payload.nameOutput ??
|
|
361
|
-
typeOutput.value = payload.typeOutput ??
|
|
362
|
-
nameOutput.value = payload.nameOutput ??
|
|
363
|
-
videoType1.value = videoType2.value =
|
|
390
|
+
typeOutput.value = payload.typeOutput ?? "";
|
|
391
|
+
nameOutput.value = payload.nameOutput ?? "";
|
|
392
|
+
typeOutput.value = payload.typeOutput ?? "";
|
|
393
|
+
nameOutput.value = payload.nameOutput ?? "";
|
|
394
|
+
videoType1.value = videoType2.value =
|
|
395
|
+
typeOutput.value === "hls-dash" ? "hls" : typeOutput.value;
|
|
364
396
|
|
|
365
397
|
srcPreview1.value = handleChangeSrc({
|
|
366
398
|
playMode: playMode1.value,
|
|
@@ -368,7 +400,7 @@ const [useJobPreview, useInjectJobPreview] = createInjectionState(() => {
|
|
|
368
400
|
delayTime: delayTime1.value,
|
|
369
401
|
timeshiftTime: timeshiftTime1.value,
|
|
370
402
|
videoType: videoType1.value,
|
|
371
|
-
})
|
|
403
|
+
});
|
|
372
404
|
|
|
373
405
|
srcPreview2.value = handleChangeSrc({
|
|
374
406
|
playMode: playMode2.value,
|
|
@@ -376,15 +408,15 @@ const [useJobPreview, useInjectJobPreview] = createInjectionState(() => {
|
|
|
376
408
|
delayTime: delayTime2.value,
|
|
377
409
|
timeshiftTime: timeshiftTime2.value,
|
|
378
410
|
videoType: videoType2.value,
|
|
379
|
-
})
|
|
411
|
+
});
|
|
380
412
|
|
|
381
|
-
playVisible.value = true
|
|
413
|
+
playVisible.value = true;
|
|
382
414
|
}
|
|
383
415
|
|
|
384
|
-
const isHls1 = computed(() => videoType1.value ===
|
|
385
|
-
const isDash1 = computed(() => videoType1.value ===
|
|
386
|
-
const isHls2 = computed(() => videoType2.value ===
|
|
387
|
-
const isDash2 = computed(() => videoType2.value ===
|
|
416
|
+
const isHls1 = computed(() => videoType1.value === "hls");
|
|
417
|
+
const isDash1 = computed(() => videoType1.value === "dash");
|
|
418
|
+
const isHls2 = computed(() => videoType2.value === "hls");
|
|
419
|
+
const isDash2 = computed(() => videoType2.value === "dash");
|
|
388
420
|
|
|
389
421
|
return {
|
|
390
422
|
paramQueryPreview,
|
|
@@ -429,10 +461,7 @@ const [useJobPreview, useInjectJobPreview] = createInjectionState(() => {
|
|
|
429
461
|
blackoutActive,
|
|
430
462
|
actions,
|
|
431
463
|
enableForensicWatermarkAB,
|
|
432
|
-
}
|
|
433
|
-
})
|
|
464
|
+
};
|
|
465
|
+
});
|
|
434
466
|
|
|
435
|
-
export {
|
|
436
|
-
useJobPreview,
|
|
437
|
-
useInjectJobPreview,
|
|
438
|
-
}
|
|
467
|
+
export { useJobPreview, useInjectJobPreview };
|