@sgrsoft/vpe-core-sdk 0.7.0 → 0.9.0
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/README.md +17 -0
- package/dist/locales/en/index.d.ts +8 -0
- package/dist/locales/i18n.d.ts +54 -187
- package/dist/locales/ja/index.d.ts +8 -0
- package/dist/locales/ko/index.d.ts +8 -0
- package/dist/main.d.ts +90 -2
- package/dist/vpe-core-sdk.cjs.js +1 -1
- package/dist/vpe-core-sdk.es.js +129 -146
- package/package.json +1 -1
- package/dist/locales/zh/index.d.ts +0 -70
package/README.md
CHANGED
|
@@ -117,3 +117,20 @@ if (vpe.isInitialized()) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
```
|
|
120
|
+
|
|
121
|
+
### 5. 플레이리스트 가져오기
|
|
122
|
+
|
|
123
|
+
`getPlaylist()` 메소드는 현재 설정된 플레이리스트를 배열 형태로 반환합니다.
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
const playlist = vpe.getPlaylist();
|
|
127
|
+
|
|
128
|
+
if (playlist.length > 0) {
|
|
129
|
+
console.log('현재 플레이리스트:');
|
|
130
|
+
playlist.forEach((item, index) => {
|
|
131
|
+
console.log(`${index + 1}. ${item.file}`);
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
console.log('플레이리스트가 비어있습니다.');
|
|
135
|
+
}
|
|
136
|
+
```
|
package/dist/locales/i18n.d.ts
CHANGED
|
@@ -88,6 +88,14 @@ export declare const translations: {
|
|
|
88
88
|
title: string;
|
|
89
89
|
desc: string;
|
|
90
90
|
};
|
|
91
|
+
'15': {
|
|
92
|
+
title: string;
|
|
93
|
+
desc: string;
|
|
94
|
+
};
|
|
95
|
+
'16': {
|
|
96
|
+
title: string;
|
|
97
|
+
desc: string;
|
|
98
|
+
};
|
|
91
99
|
};
|
|
92
100
|
alternative: {
|
|
93
101
|
hour: string;
|
|
@@ -191,6 +199,14 @@ export declare const translations: {
|
|
|
191
199
|
title: string;
|
|
192
200
|
desc: string;
|
|
193
201
|
};
|
|
202
|
+
'15': {
|
|
203
|
+
title: string;
|
|
204
|
+
desc: string;
|
|
205
|
+
};
|
|
206
|
+
'16': {
|
|
207
|
+
title: string;
|
|
208
|
+
desc: string;
|
|
209
|
+
};
|
|
194
210
|
};
|
|
195
211
|
alternative: {
|
|
196
212
|
hour: string;
|
|
@@ -294,72 +310,11 @@ export declare const translations: {
|
|
|
294
310
|
title: string;
|
|
295
311
|
desc: string;
|
|
296
312
|
};
|
|
297
|
-
|
|
298
|
-
alternative: {
|
|
299
|
-
hour: string;
|
|
300
|
-
minute: string;
|
|
301
|
-
second: string;
|
|
302
|
-
after: string;
|
|
303
|
-
afterMin: string;
|
|
304
|
-
afterHour: string;
|
|
305
|
-
afterDay: string;
|
|
306
|
-
startPlay: string;
|
|
307
|
-
nextPlay: string;
|
|
308
|
-
afterPlay: string;
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
zh: {
|
|
312
|
-
common: {
|
|
313
|
-
cancel: string;
|
|
314
|
-
auto: string;
|
|
315
|
-
normal: string;
|
|
316
|
-
notUse: string;
|
|
317
|
-
prev: string;
|
|
318
|
-
next: string;
|
|
319
|
-
delayText: string;
|
|
320
|
-
license: string;
|
|
321
|
-
play: string;
|
|
322
|
-
pause: string;
|
|
323
|
-
replay: string;
|
|
324
|
-
fullOn: string;
|
|
325
|
-
fullOff: string;
|
|
326
|
-
muteOn: string;
|
|
327
|
-
muteOff: string;
|
|
328
|
-
captionOff: string;
|
|
329
|
-
captionOn: string;
|
|
330
|
-
setting: string;
|
|
331
|
-
live: string;
|
|
332
|
-
miniPlayer: string;
|
|
333
|
-
isMute: string;
|
|
334
|
-
};
|
|
335
|
-
settings: {
|
|
336
|
-
autoplay: string;
|
|
337
|
-
playbackRate: string;
|
|
338
|
-
captions: string;
|
|
339
|
-
quality: string;
|
|
340
|
-
};
|
|
341
|
-
error: {
|
|
342
|
-
"01": {
|
|
343
|
-
title: string;
|
|
344
|
-
desc: string;
|
|
345
|
-
};
|
|
346
|
-
"02": {
|
|
347
|
-
title: string;
|
|
348
|
-
desc: string;
|
|
349
|
-
};
|
|
350
|
-
"03": {
|
|
351
|
-
title: string;
|
|
352
|
-
desc: string;
|
|
353
|
-
};
|
|
354
|
-
"04": {
|
|
355
|
-
title: string;
|
|
356
|
-
desc: string;
|
|
357
|
-
};
|
|
358
|
-
"05": {
|
|
313
|
+
'15': {
|
|
359
314
|
title: string;
|
|
360
315
|
desc: string;
|
|
361
316
|
};
|
|
362
|
-
|
|
317
|
+
'16': {
|
|
363
318
|
title: string;
|
|
364
319
|
desc: string;
|
|
365
320
|
};
|
|
@@ -473,6 +428,14 @@ export declare function getTranslator(language?: Language | string): {
|
|
|
473
428
|
title: string;
|
|
474
429
|
desc: string;
|
|
475
430
|
};
|
|
431
|
+
'15': {
|
|
432
|
+
title: string;
|
|
433
|
+
desc: string;
|
|
434
|
+
};
|
|
435
|
+
'16': {
|
|
436
|
+
title: string;
|
|
437
|
+
desc: string;
|
|
438
|
+
};
|
|
476
439
|
};
|
|
477
440
|
alternative: {
|
|
478
441
|
hour: string;
|
|
@@ -575,6 +538,14 @@ export declare function getTranslator(language?: Language | string): {
|
|
|
575
538
|
title: string;
|
|
576
539
|
desc: string;
|
|
577
540
|
};
|
|
541
|
+
'15': {
|
|
542
|
+
title: string;
|
|
543
|
+
desc: string;
|
|
544
|
+
};
|
|
545
|
+
'16': {
|
|
546
|
+
title: string;
|
|
547
|
+
desc: string;
|
|
548
|
+
};
|
|
578
549
|
};
|
|
579
550
|
alternative: {
|
|
580
551
|
hour: string;
|
|
@@ -677,71 +648,11 @@ export declare function getTranslator(language?: Language | string): {
|
|
|
677
648
|
title: string;
|
|
678
649
|
desc: string;
|
|
679
650
|
};
|
|
680
|
-
|
|
681
|
-
alternative: {
|
|
682
|
-
hour: string;
|
|
683
|
-
minute: string;
|
|
684
|
-
second: string;
|
|
685
|
-
after: string;
|
|
686
|
-
afterMin: string;
|
|
687
|
-
afterHour: string;
|
|
688
|
-
afterDay: string;
|
|
689
|
-
startPlay: string;
|
|
690
|
-
nextPlay: string;
|
|
691
|
-
afterPlay: string;
|
|
692
|
-
};
|
|
693
|
-
} | {
|
|
694
|
-
common: {
|
|
695
|
-
cancel: string;
|
|
696
|
-
auto: string;
|
|
697
|
-
normal: string;
|
|
698
|
-
notUse: string;
|
|
699
|
-
prev: string;
|
|
700
|
-
next: string;
|
|
701
|
-
delayText: string;
|
|
702
|
-
license: string;
|
|
703
|
-
play: string;
|
|
704
|
-
pause: string;
|
|
705
|
-
replay: string;
|
|
706
|
-
fullOn: string;
|
|
707
|
-
fullOff: string;
|
|
708
|
-
muteOn: string;
|
|
709
|
-
muteOff: string;
|
|
710
|
-
captionOff: string;
|
|
711
|
-
captionOn: string;
|
|
712
|
-
setting: string;
|
|
713
|
-
live: string;
|
|
714
|
-
miniPlayer: string;
|
|
715
|
-
isMute: string;
|
|
716
|
-
};
|
|
717
|
-
settings: {
|
|
718
|
-
autoplay: string;
|
|
719
|
-
playbackRate: string;
|
|
720
|
-
captions: string;
|
|
721
|
-
quality: string;
|
|
722
|
-
};
|
|
723
|
-
error: {
|
|
724
|
-
"01": {
|
|
725
|
-
title: string;
|
|
726
|
-
desc: string;
|
|
727
|
-
};
|
|
728
|
-
"02": {
|
|
729
|
-
title: string;
|
|
730
|
-
desc: string;
|
|
731
|
-
};
|
|
732
|
-
"03": {
|
|
733
|
-
title: string;
|
|
734
|
-
desc: string;
|
|
735
|
-
};
|
|
736
|
-
"04": {
|
|
737
|
-
title: string;
|
|
738
|
-
desc: string;
|
|
739
|
-
};
|
|
740
|
-
"05": {
|
|
651
|
+
'15': {
|
|
741
652
|
title: string;
|
|
742
653
|
desc: string;
|
|
743
654
|
};
|
|
744
|
-
|
|
655
|
+
'16': {
|
|
745
656
|
title: string;
|
|
746
657
|
desc: string;
|
|
747
658
|
};
|
|
@@ -848,6 +759,14 @@ declare const _default: {
|
|
|
848
759
|
title: string;
|
|
849
760
|
desc: string;
|
|
850
761
|
};
|
|
762
|
+
'15': {
|
|
763
|
+
title: string;
|
|
764
|
+
desc: string;
|
|
765
|
+
};
|
|
766
|
+
'16': {
|
|
767
|
+
title: string;
|
|
768
|
+
desc: string;
|
|
769
|
+
};
|
|
851
770
|
};
|
|
852
771
|
alternative: {
|
|
853
772
|
hour: string;
|
|
@@ -950,6 +869,14 @@ declare const _default: {
|
|
|
950
869
|
title: string;
|
|
951
870
|
desc: string;
|
|
952
871
|
};
|
|
872
|
+
'15': {
|
|
873
|
+
title: string;
|
|
874
|
+
desc: string;
|
|
875
|
+
};
|
|
876
|
+
'16': {
|
|
877
|
+
title: string;
|
|
878
|
+
desc: string;
|
|
879
|
+
};
|
|
953
880
|
};
|
|
954
881
|
alternative: {
|
|
955
882
|
hour: string;
|
|
@@ -1052,71 +979,11 @@ declare const _default: {
|
|
|
1052
979
|
title: string;
|
|
1053
980
|
desc: string;
|
|
1054
981
|
};
|
|
1055
|
-
|
|
1056
|
-
alternative: {
|
|
1057
|
-
hour: string;
|
|
1058
|
-
minute: string;
|
|
1059
|
-
second: string;
|
|
1060
|
-
after: string;
|
|
1061
|
-
afterMin: string;
|
|
1062
|
-
afterHour: string;
|
|
1063
|
-
afterDay: string;
|
|
1064
|
-
startPlay: string;
|
|
1065
|
-
nextPlay: string;
|
|
1066
|
-
afterPlay: string;
|
|
1067
|
-
};
|
|
1068
|
-
} | {
|
|
1069
|
-
common: {
|
|
1070
|
-
cancel: string;
|
|
1071
|
-
auto: string;
|
|
1072
|
-
normal: string;
|
|
1073
|
-
notUse: string;
|
|
1074
|
-
prev: string;
|
|
1075
|
-
next: string;
|
|
1076
|
-
delayText: string;
|
|
1077
|
-
license: string;
|
|
1078
|
-
play: string;
|
|
1079
|
-
pause: string;
|
|
1080
|
-
replay: string;
|
|
1081
|
-
fullOn: string;
|
|
1082
|
-
fullOff: string;
|
|
1083
|
-
muteOn: string;
|
|
1084
|
-
muteOff: string;
|
|
1085
|
-
captionOff: string;
|
|
1086
|
-
captionOn: string;
|
|
1087
|
-
setting: string;
|
|
1088
|
-
live: string;
|
|
1089
|
-
miniPlayer: string;
|
|
1090
|
-
isMute: string;
|
|
1091
|
-
};
|
|
1092
|
-
settings: {
|
|
1093
|
-
autoplay: string;
|
|
1094
|
-
playbackRate: string;
|
|
1095
|
-
captions: string;
|
|
1096
|
-
quality: string;
|
|
1097
|
-
};
|
|
1098
|
-
error: {
|
|
1099
|
-
"01": {
|
|
1100
|
-
title: string;
|
|
1101
|
-
desc: string;
|
|
1102
|
-
};
|
|
1103
|
-
"02": {
|
|
982
|
+
'15': {
|
|
1104
983
|
title: string;
|
|
1105
984
|
desc: string;
|
|
1106
985
|
};
|
|
1107
|
-
|
|
1108
|
-
title: string;
|
|
1109
|
-
desc: string;
|
|
1110
|
-
};
|
|
1111
|
-
"04": {
|
|
1112
|
-
title: string;
|
|
1113
|
-
desc: string;
|
|
1114
|
-
};
|
|
1115
|
-
"05": {
|
|
1116
|
-
title: string;
|
|
1117
|
-
desc: string;
|
|
1118
|
-
};
|
|
1119
|
-
"06": {
|
|
986
|
+
'16': {
|
|
1120
987
|
title: string;
|
|
1121
988
|
desc: string;
|
|
1122
989
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Language } from './locales/i18n';
|
|
2
|
-
import { VpePlayerOptions,
|
|
1
|
+
import type { Language } from './locales/i18n';
|
|
2
|
+
import type { VpePlayerOptions, VpePlayerProps } from './options';
|
|
3
3
|
declare const ENCODED_API_PATH: {
|
|
4
4
|
gov: {
|
|
5
5
|
prod: {
|
|
@@ -63,6 +63,16 @@ interface VpeCoreOptions {
|
|
|
63
63
|
isDev?: boolean;
|
|
64
64
|
language?: Language | string;
|
|
65
65
|
}
|
|
66
|
+
interface PlaylistItem {
|
|
67
|
+
file: string;
|
|
68
|
+
poster?: string;
|
|
69
|
+
description?: {
|
|
70
|
+
title: string;
|
|
71
|
+
created_at: string;
|
|
72
|
+
profile_name: string;
|
|
73
|
+
profile_image: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
66
76
|
export declare class VpeCore {
|
|
67
77
|
private serverConfig;
|
|
68
78
|
private playerInfo;
|
|
@@ -72,6 +82,7 @@ export declare class VpeCore {
|
|
|
72
82
|
private readonly stage;
|
|
73
83
|
private readonly isDev;
|
|
74
84
|
private readonly translator;
|
|
85
|
+
private errorState;
|
|
75
86
|
constructor({ accessKey, appId, platform, stage, isDev, language }: VpeCoreOptions);
|
|
76
87
|
initialize(): Promise<{
|
|
77
88
|
error: {
|
|
@@ -148,6 +159,78 @@ export declare class VpeCore {
|
|
|
148
159
|
} | {
|
|
149
160
|
title: string;
|
|
150
161
|
desc: string;
|
|
162
|
+
} | {
|
|
163
|
+
title: string;
|
|
164
|
+
desc: string;
|
|
165
|
+
} | {
|
|
166
|
+
title: string;
|
|
167
|
+
desc: string;
|
|
168
|
+
} | {
|
|
169
|
+
title: string;
|
|
170
|
+
desc: string;
|
|
171
|
+
} | {
|
|
172
|
+
title: string;
|
|
173
|
+
desc: string;
|
|
174
|
+
} | {
|
|
175
|
+
title: string;
|
|
176
|
+
desc: string;
|
|
177
|
+
} | {
|
|
178
|
+
title: string;
|
|
179
|
+
desc: string;
|
|
180
|
+
} | {
|
|
181
|
+
title: string;
|
|
182
|
+
desc: string;
|
|
183
|
+
} | {
|
|
184
|
+
title: string;
|
|
185
|
+
desc: string;
|
|
186
|
+
} | {
|
|
187
|
+
title: string;
|
|
188
|
+
desc: string;
|
|
189
|
+
} | {
|
|
190
|
+
title: string;
|
|
191
|
+
desc: string;
|
|
192
|
+
} | {
|
|
193
|
+
title: string;
|
|
194
|
+
desc: string;
|
|
195
|
+
} | {
|
|
196
|
+
title: string;
|
|
197
|
+
desc: string;
|
|
198
|
+
} | {
|
|
199
|
+
title: string;
|
|
200
|
+
desc: string;
|
|
201
|
+
} | {
|
|
202
|
+
title: string;
|
|
203
|
+
desc: string;
|
|
204
|
+
} | {
|
|
205
|
+
title: string;
|
|
206
|
+
desc: string;
|
|
207
|
+
} | {
|
|
208
|
+
title: string;
|
|
209
|
+
desc: string;
|
|
210
|
+
} | {
|
|
211
|
+
title: string;
|
|
212
|
+
desc: string;
|
|
213
|
+
} | {
|
|
214
|
+
title: string;
|
|
215
|
+
desc: string;
|
|
216
|
+
} | {
|
|
217
|
+
title: string;
|
|
218
|
+
desc: string;
|
|
219
|
+
} | {
|
|
220
|
+
title: string;
|
|
221
|
+
desc: string;
|
|
222
|
+
} | {
|
|
223
|
+
title: string;
|
|
224
|
+
desc: string;
|
|
225
|
+
} | {
|
|
226
|
+
title: string;
|
|
227
|
+
desc: string;
|
|
228
|
+
} | {
|
|
229
|
+
title: string;
|
|
230
|
+
desc: string;
|
|
231
|
+
} | {
|
|
232
|
+
title: string;
|
|
233
|
+
desc: string;
|
|
151
234
|
};
|
|
152
235
|
};
|
|
153
236
|
options?: undefined;
|
|
@@ -161,9 +244,14 @@ export declare class VpeCore {
|
|
|
161
244
|
private getBrowserInfo;
|
|
162
245
|
private createPlayerInfo;
|
|
163
246
|
private setErrorRun;
|
|
247
|
+
getErrorState(): {
|
|
248
|
+
errorCode: string | null;
|
|
249
|
+
errorMessage: any;
|
|
250
|
+
};
|
|
164
251
|
isPaidTier(): boolean;
|
|
165
252
|
isInitialized(): boolean;
|
|
166
253
|
getValidatedOptions(options?: Partial<VpePlayerOptions>): VpePlayerOptions;
|
|
254
|
+
getPlaylist(): PlaylistItem[];
|
|
167
255
|
/**
|
|
168
256
|
*
|
|
169
257
|
* @param key
|
package/dist/vpe-core-sdk.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f={common:{cancel:"Cancel",auto:"Auto",normal:"Normal",notUse:"Not used",prev:"Previous video",next:"Next video",delayText:"seconds until auto-play",license:"License",play:"Play",pause:"Pause",replay:"Replay",fullOn:"Fullscreen",fullOff:"Exit fullscreen",muteOn:"Mute",muteOff:"Unmute",captionOff:"Turn off captions",captionOn:"Turn on captions",setting:"Settings",live:"LIVE",miniPlayer:"Mini player",isMute:"You are muted.",subtitle:"Subtitles",subtitleNot:"Subtitles not available"},settings:{autoplay:"Autoplay",playbackRate:"Playback speed",captions:"Subtitles",quality:"Quality"},error:{"01":{title:"Cannot play video",desc:"Invalid access. Please check your access_key."},"02":{title:"Cannot play video",desc:"You do not have permission to play this video."},"03":{title:"Authentication Failed",desc:"The network connection is unstable."},"04":{title:"Cannot play video",desc:"The video could not be played."},"05":{title:"Cannot play video",desc:"The license is not valid."},"06":{title:"Cannot play video",desc:"Monthly basic API calls exceeded. Please switch to a paid version."},"07":{title:"Cannot play video",desc:"Unsupported format."},"08":{title:"Cannot play video",desc:"Invalid URL format."},"09":{title:"Cannot play video",desc:"The live stream is OFFLINE."},10:{title:"Cannot play video",desc:"Cannot play DASH video on iOS."},11:{title:"Cannot play video",desc:"Invalid DRM token."},12:{title:"Cannot play video",desc:"Failed to communicate with the DRM license server."},13:{title:"Cannot play video",desc:"FairPlay certificate validation failed."},14:{title:"Cannot play video",desc:"Screen capture / screen recording has been detected."}},alternative:{hour:"hour(s)",minute:"minute(s)",second:"second(s)",after:"In a moment",afterMin:"min",afterHour:"hour",afterDay:"day",startPlay:"Video will start in {timeTxt}.",nextPlay:"Next video will play in {timeTxt} seconds.",afterPlay:"Scheduled"}},y={common:{cancel:"취소",auto:"자동",normal:"보통",notUse:"사용안함",prev:"이전 동영상",next:"다음 동영상",delayText:"초 뒤 자동재생",license:"라이선스",play:"재생",pause:"일시정지",replay:"다시보기",fullOn:"전체화면",fullOff:"전체화면 해제",muteOn:"음소거",muteOff:"음소거 해제",captionOff:"자막끄기",captionOn:"자막켜기",setting:"설정",live:"실시간",miniPlayer:"미니플레이어",isMute:"음소거 상태입니다.",subtitle:"자막",subtitleNot:"자막 사용 불가"},settings:{autoplay:"자동재생",playbackRate:"재생 속도",captions:"자막",quality:"해상도"},error:{"01":{title:"동영상을 재생할 수 없음",desc:"잘못된 접근입니다. access_key를 확인해주세요."},"02":{title:"동영상을 재생할 수 없음",desc:"동영상을 재생할 권한이 없습니다."},"03":{title:"인증 실패",desc:"네트워크 연결이 원활하지 않습니다."},"04":{title:"동영상을 재생할 수 없음",desc:"동영상을 재생할 수 없습니다."},"05":{title:"동영상을 재생할 수 없음",desc:"라이선스가 유효하지 않습니다."},"06":{title:"동영상을 재생할 수 없음",desc:"월 기본 제공 호출 건수를 초과하였습니다. 유료 버전으로 전환 후 사용 부탁 드립니다."},"07":{title:"동영상을 재생할 수 없음",desc:"지원하지 않는 형식입니다."},"08":{title:"동영상을 재생할 수 없음",desc:"URL 형식이 잘못되었습니다."},"09":{title:"동영상을 재생할 수 없음",desc:"라이브스트림이 OFFLINE 입니다."},10:{title:"동영상을 재생할 수 없음",desc:"iOS에서 Dash 비디오를 재생할 수 없습니다."},11:{title:"동영상을 재생할 수 없음",desc:"DRM 토큰이 잘못되었습니다."},12:{title:"동영상을 재생할 수 없음",desc:"DRM 라이선스 서버와 통신에 실패하였습니다."},13:{title:"동영상을 재생할 수 없음",desc:"FairPlay 인증서 검증에 실패하였습니다."},14:{title:"동영상을 재생할 수 없음",desc:"화면 캡쳐 / 화면 녹화가 감지되었습니다."}},alternative:{hour:"시",minute:"분",second:"초",after:"잠시 ",afterMin:"분 ",afterHour:"시간 ",afterDay:"일 ",startPlay:"{timeTxt} 후 영상이 시작됩니다.",nextPlay:"{timeTxt}초 후 다음 영상이 재생됩니다.",afterPlay:"예정"}},g={common:{cancel:"キャンセル",auto:"自動",normal:"標準",notUse:"使用しない",prev:"前の動画",next:"次の動画",delayText:"秒後に自動再生",license:"ライセンス",play:"再生",pause:"一時停止",replay:"リプレイ",fullOn:"全画面表示",fullOff:"全画面表示を終了",muteOn:"ミュート",muteOff:"ミュート解除",captionOff:"字幕をオフにする",captionOn:"字幕をオンにする",setting:"設定",live:"ライブ",miniPlayer:"ミニプレーヤー",isMute:"ミュート状態です。",subtitle:"字幕",subtitleNot:"字幕は利用できません"},settings:{autoplay:"自動再生",playbackRate:"再生速度",captions:"字幕",quality:"画質"},error:{"01":{title:"動画を再生できません",desc:"不正なアクセスです。access_keyを確認してください。"},"02":{title:"動画を再生できません",desc:"この動画を再生する権限がありません。"},"03":{title:"認証に失敗しました",desc:"ネットワーク接続が不安定です。"},"04":{title:"動画を再生できません",desc:"動画を再生できませんでした。"},"05":{title:"動画を再生できません",desc:"ライセンスが無効です。"},"06":{title:"動画を再生できません",desc:"月間の基本提供呼び出し回数を超過しました。有料版に切り替えてご利用ください。"},"07":{title:"動画を再生できません",desc:"サポートされていない形式です。"},"08":{title:"動画を再生できません",desc:"URLの形式が正しくありません。"},"09":{title:"動画を再生できません",desc:"ライブストリームはオフラインです。"},10:{title:"動画を再生できません",desc:"iOSではDASHビデオを再生できません。"},11:{title:"動画を再生できません",desc:"DRMトークンが無効です。"},12:{title:"動画を再生できません",desc:"DRMライセンスサーバーとの通信に失敗しました。"},13:{title:"動画を再生できません",desc:"FairPlay証明書の検証に失敗しました。"},14:{title:"動画を再生できません",desc:"画面キャプチャ/画面録画が検出されました。"}},alternative:{hour:"時間",minute:"分",second:"秒",after:"しばらくして",afterMin:"分後",afterHour:"時間後",afterDay:"日後",startPlay:"{timeTxt}後に動画が始まります。",nextPlay:"{timeTxt}秒後に次の動画が再生されます。",afterPlay:"予定"}},m={common:{cancel:"取消",auto:"自动",normal:"一般",notUse:"不使用",prev:"上一个视频",next:"下一个视频",delayText:"{0}秒后自动播放",license:"许可",play:"播放",pause:"暂停",replay:"重新观看",fullOn:"全屏",fullOff:"解除全屏",muteOn:"静音",muteOff:"解除静音",captionOff:"关闭字幕",captionOn:"开启字幕",setting:"设定",live:"LIVE",miniPlayer:"迷你播放器",isMute:"当前处于静音状态。"},settings:{autoplay:"自动播放",playbackRate:"播放速度",captions:"字幕",quality:"分辨率"},error:{"01":{title:"无法播放视频",desc:"错误的访问。"},"02":{title:"无法播放视频",desc:"因权限问题,无法播放视频。"},"03":{title:"认证失败",desc:"网络连接不稳定。"},"04":{title:"无法播放视频",desc:"无法播放视频。"},"05":{title:"无法播放视频",desc:"该许可无效。"},"06":{title:"无法播放视频",desc:"已超过每月基本提供的调用次数。请转换为付费版本后使用。"}},alternative:{hour:"小时",minute:"分钟",second:"秒",after:"请稍后",afterMin:"分钟后",afterHour:"小时后",afterDay:"天后",startPlay:"{timeTxt}之后开始播放视频。",nextPlay:"{timeTxt}秒后,将播放下一个视频。",afterPlay:"预计"}},c={en:f,ko:y,ja:g,zh:m},h=()=>typeof navigator<"u"&&typeof navigator.language<"u";function v(t){const e=t.split("-")[0];return e in c?e:"en"}function u(t){let e="en";t?e=t:h()&&(e=navigator.language);const n=v(e);return c[n]}u();const S={AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia (Plurinational State of)",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",CV:"Cabo Verde",KH:"Cambodia",CM:"Cameroon",CA:"Canada",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo (Democratic Republic of the)",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'Ivoire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and McDonald Islands",VA:"Holy See",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran (Islamic Republic of)",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea (Democratic People's Republic of)",KR:"Korea, Republic of",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia (the former Yugoslav Republic of)",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia (Federated States of)",MD:"Moldova (Republic of)",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension and Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States of America",UM:"United States Minor Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela (Bolivarian Republic of)",VN:"Viet Nam",VG:"Virgin Islands (British)",VI:"Virgin Islands (U.S.)",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},b={gov:{prod:{log:"https://papi.vpe.gov-ntruss.com/player/maSync",report:"https://log.vpe.gov-ntruss.com/stats"},beta:{log:"https://papi.beta-vpe.gov-ntruss.com/player/maSync",report:"https://log.beta-vpe.gov-ntruss.com/stats"}},pub:{prod:{log:"https://papi.vpe.naverncp.com/player/maSync",report:"https://log.vpe.naverncp.com/stats"},beta:{log:"https://papi.beta-vpe.naverncp.com/player/maSync",report:"https://log.beta-vpe.naverncp.com/stats"}}};let s={video:{},browser:{},device:{},connection:{},screen:{},player_version:"latest",extra:{sessionId:null,playerType:"VPE React Native"},log_type:"vpe",privacy:{cookie_enabled:!0}},l={platform:"pub",stage:"prod",sync:!1,syncResult:{}};const M=new Date().getTime(),d=()=>{const t=new Date,e=r=>String(r).padStart(2,"0"),n=`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`,a=Math.floor(t.getTime()/1e3),i=new Date().getTime()-M;return{logDate:n,logDateUnix:a,thisSec:i}};function C(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function I(t,e){Object.entries(e).forEach(([n,a])=>{C(a)?(t[n]||(t[n]={}),Object.entries(a).forEach(([i,r])=>{r!=null&&(t[n][i]=r)})):a!=null&&(t[n]=a)})}function w(t){const e=[];return t?.r1&&e.push(t.r1),t?.r2&&e.push(t.r2),t?.r3&&e.push(t.r3),e.join(" ")}function P(t){try{const e=l.syncResult?.geoLocation;e&&(t.address=w(e),t.isp=e.net||"",t.ip=l.syncResult?.ip||"",t.nation=e.country||"")}catch{}}const T=async t=>{if(!t)return;const{platform:e,stage:n}=l,a=b[e][n].log;try{const r=await(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({access_key:t})})).json();l.sync=r.result?.sync||!1,l.syncResult=r.result||{};const{logDate:o,logDateUnix:p}=d();return s.extra.logDate=o,s.extra.logDateUnix=p,l.syncResult?.geoLocation&&P(s.extra),r}catch(i){return console.error("MA config initialization failed:",i),null}};async function R(t,e,n,a,i){l.platform=t,l.stage=e,I(s,n),s.extra.nation?s.browser.lang=S[s.extra.nation]||"ko-KR":s.browser.lang="ko-KR";const{logDate:r,logDateUnix:o}=d();s.extra.logDate=r,s.extra.logDateUnix=o,s.extra.created_at=o}const B=(t={})=>{const e={autostart:!0,muted:!1,aspectRatio:"16/9",objectFit:"contain",controls:!0,keyboardShortcut:!1,startMutedInfoNotVisible:!1,allowsPictureInPicture:!1,staysActiveInBackground:!1,screenRecordingPrevention:!1,modalFullscreen:!1,lang:"ko",ui:"all",controlBtn:{play:!0,fullscreen:!0,progressBar:!0,volume:!1,times:!0,pictureInPicture:!0,setting:!0,subtitle:!0},progressBarColor:"#4299f5",controlActiveTime:3e3,playRateSetting:[.5,.75,1,1.5,2],autoPause:!1,repeat:!1,setStartTime:void 0,playIndex:0,lowLatencyMode:!0,touchGestures:!0,descriptionNotVisible:!1,devTestAppId:void 0,token:"",visibleWatermark:!1,watermarkText:"NAVER CLOUD PLATFORM",watermarkConfig:{randPosition:!0,randPositionInterVal:3e3,x:10,y:10,opacity:.5},captionStyle:{fontSize:12,color:"#ffffff",backgroundColor:"rgba(0, 0, 0, 0.4)",edgeStyle:"dropshadow"},override:null},n={...e,...t};return t.controlBtn&&(n.controlBtn={...e.controlBtn,...t.controlBtn}),t.watermarkConfig&&(n.watermarkConfig={...e.watermarkConfig,...t.watermarkConfig}),t.captionStyle&&(n.captionStyle={...e.captionStyle,...t.captionStyle}),n.objectFit==="fill"&&(n.objectFit="stretch"),n.controlBtn?.progressBar===void 0&&(n.controlBtn.progressBar=!0),n},A={gov:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5nb3YtbnRydXNzLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cudnBlLmdvdi1udHJ1c3MuY29tL3N0YXRz"},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLmdvdi1udHJ1c3MuY29tL3BsYXllci9jb25maWc=",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUuZ292LW50cnVzcy5jb20vc3RhdHM="}},pub:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5uYXZlcm5jcC5jb20vcGxheWVyL2NvbmZpZw==",report:"aHR0cHM6Ly9sb2cudnBlLm5hdmVybmNwLmNvbS9zdGF0cw=="},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLm5hdmVybmNwLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUubmF2ZXJuY3AuY29tL3N0YXRz"}}},L=t=>{try{return atob(t)}catch(e){return console.error("Base64 decoding failed:",e),""}},E=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";class N{serverConfig={};playerInfo=null;accessKey;appId;platform;stage;isDev;translator;constructor({accessKey:e,appId:n,platform:a,stage:i,isDev:r=!1,language:o}){this.accessKey=e,this.appId=E()?location.origin:n,this.platform=a,this.stage=i,this.isDev=r,this.translator=u(o)}async initialize(){if(!this.accessKey||!this.appId)return console.warn("VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다."),{error:this.setErrorRun("E0002")};try{const e=await this.performKeyCheck();return e.code!==200?{error:this.setErrorRun("E0001")}:(this.serverConfig=e,this.playerInfo=this.createPlayerInfo(e),await R(this.platform,this.stage,this.playerInfo,this.appId,this.accessKey),await T(this.accessKey),{options:this.serverConfig.result?.options,playerInfo:this.playerInfo})}catch(e){return console.error("VPE SDK Initialization failed:",e),{error:this.setErrorRun("E0003")}}}async performKeyCheck(){const e=this.isDev?"?preview=true":"",n=L(A[this.platform][this.stage].config)+e,a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({access_key:this.accessKey,domain:this.appId})});if(!a.ok)throw new Error(`API Error: ${a.status} ${a.statusText}`);return a.json()}getBrowserInfo(){const e=navigator.userAgent;return/Edg\/(\d+\.\d+)/.test(e)?{origin:"Edge",version:RegExp.$1}:/Chrome\/(\d+\.\d+)/.test(e)&&!e.includes("Edg")?{origin:"Chrome",version:RegExp.$1}:/Firefox\/(\d+\.\d+)/.test(e)?{origin:"Firefox",version:RegExp.$1}:/Version\/(\d+\.\d+)/.test(e)&&e.includes("Safari")?{origin:"Safari",version:RegExp.$1}:{origin:"Unknown",version:"Unknown"}}createPlayerInfo(e){const[n,a]=e.result.name.split("|"),i=navigator.connection||navigator.mozConnection||navigator.webkitConnection,r=this.getBrowserInfo(),o=navigator.userAgentData;return{cid:e.result.cid,player_name:n,player_version:a,pricing:e.result.pricing,maUse:e.result.options?.maUse==="Y"?"Y":"N",browser:{lang:navigator.language,ua:navigator.userAgent},screen:{width:window.screen.width,height:window.screen.height},connection:{network:i?.effectiveType??"unknown",downlink:i?.downlink??null,rtt:i?.rtt??null,save_data:i?.saveData??!1},device:{platform:o?.platform??"Unknown",mobile:o?.mobile??!1,memory:navigator.deviceMemory??null,processor:navigator.hardwareConcurrency??null},video:{url:""},extra:{vpeKey:this.accessKey,playerType:"VPE",playerVersion:a,device:o?.platform??"Unknown",os:o?.platform??"Unknown",osOrigin:o?.platform??"Unknown",osVersion:o?.platformVersion??"Unknown",vpePackageId:this.appId,actionDuration:0,actionType:"ready",browser:r.origin,browserOrigin:r.origin,browserVersion:r.version,protocol:location.protocol,quality:"Other",qualityOrigin:"Auto",host:`${this.appId}&${o?.platform??"Unknown"}&${o?.platformVersion??"Unknown"}`,location:`${this.appId}://appView/video/vpe`,title:""}}}setErrorRun(e){const n=e.slice(-2),a=this.translator.error[n]||this.translator.error["01"],i={errorCode:e,errorMessage:a};return console.log("VPE Error : ",i),i}isPaidTier(){return this.serverConfig.result?.pricing==="pay"}isInitialized(){return!!this.serverConfig.result}getValidatedOptions(e){const n=B(this.serverConfig.result?.options?.options),a={...n,...e??{}};return e?.controlBtn&&(a.controlBtn={...n.controlBtn,...e.controlBtn}),e?.watermarkConfig&&(a.watermarkConfig={...n.watermarkConfig,...e.watermarkConfig}),a.playlist&&!Array.isArray(a.playlist)&&(a.playlist=[{file:a.playlist}]),a}$t(e){const n=e.split(".");let a=this.translator;for(const i of n)if(a&&typeof a=="object"&&i in a)a=a[i];else return e;return typeof a=="string"?a:e}}module.exports=N;
|
|
1
|
+
"use strict";const g={common:{cancel:"Cancel",auto:"Auto",normal:"Normal",notUse:"Not used",prev:"Previous video",next:"Next video",delayText:"seconds until auto-play",license:"License",play:"Play",pause:"Pause",replay:"Replay",fullOn:"Fullscreen",fullOff:"Exit fullscreen",muteOn:"Mute",muteOff:"Unmute",captionOff:"Turn off captions",captionOn:"Turn on captions",setting:"Settings",live:"LIVE",miniPlayer:"Mini player",isMute:"You are muted.",subtitle:"Subtitles",subtitleNot:"Subtitles not available"},settings:{autoplay:"Autoplay",playbackRate:"Playback speed",captions:"Subtitles",quality:"Quality"},error:{"01":{title:"Cannot play video",desc:"Invalid access. Please check your access_key."},"02":{title:"Cannot play video",desc:"You do not have permission to play this video."},"03":{title:"Authentication Failed",desc:"The network connection is unstable."},"04":{title:"Cannot play video",desc:"The video could not be played."},"05":{title:"Cannot play video",desc:"The license is not valid."},"06":{title:"Cannot play video",desc:"Monthly basic API calls exceeded. Please switch to a paid version."},"07":{title:"Cannot play video",desc:"Unsupported format."},"08":{title:"Cannot play video",desc:"Invalid URL format."},"09":{title:"Cannot play video",desc:"The live stream is OFFLINE."},10:{title:"Cannot play video",desc:"Cannot play DASH video on iOS."},11:{title:"Cannot play video",desc:"Invalid DRM token."},12:{title:"Cannot play video",desc:"Failed to communicate with the DRM license server."},13:{title:"Cannot play video",desc:"FairPlay certificate validation failed."},14:{title:"Cannot play video",desc:"Screen capture / screen recording has been detected."},15:{title:"Player Execution Failed",desc:"Required module was not loaded. (hls.js)"},16:{title:"Player Execution Failed",desc:"Required module was not loaded. (dash.js)"}},alternative:{hour:"hour(s)",minute:"minute(s)",second:"second(s)",after:"In a moment",afterMin:"min",afterHour:"hour",afterDay:"day",startPlay:"Video will start in {timeTxt}.",nextPlay:"Next video will play in {timeTxt} seconds.",afterPlay:"Scheduled"}},m={common:{cancel:"취소",auto:"자동",normal:"보통",notUse:"사용안함",prev:"이전 동영상",next:"다음 동영상",delayText:"초 뒤 자동재생",license:"라이선스",play:"재생",pause:"일시정지",replay:"다시보기",fullOn:"전체화면",fullOff:"전체화면 해제",muteOn:"음소거",muteOff:"음소거 해제",captionOff:"자막끄기",captionOn:"자막켜기",setting:"설정",live:"실시간",miniPlayer:"미니플레이어",isMute:"음소거 상태입니다.",subtitle:"자막",subtitleNot:"자막 사용 불가"},settings:{autoplay:"자동재생",playbackRate:"재생 속도",captions:"자막",quality:"해상도"},error:{"01":{title:"동영상을 재생할 수 없음",desc:"잘못된 접근입니다. access_key를 확인해주세요."},"02":{title:"동영상을 재생할 수 없음",desc:"동영상을 재생할 권한이 없습니다."},"03":{title:"인증 실패",desc:"네트워크 연결이 원활하지 않습니다."},"04":{title:"동영상을 재생할 수 없음",desc:"동영상을 재생할 수 없습니다."},"05":{title:"동영상을 재생할 수 없음",desc:"라이선스가 유효하지 않습니다."},"06":{title:"동영상을 재생할 수 없음",desc:"월 기본 제공 호출 건수를 초과하였습니다. 유료 버전으로 전환 후 사용 부탁 드립니다."},"07":{title:"동영상을 재생할 수 없음",desc:"지원하지 않는 형식입니다."},"08":{title:"동영상을 재생할 수 없음",desc:"URL 형식이 잘못되었습니다."},"09":{title:"동영상을 재생할 수 없음",desc:"라이브스트림이 OFFLINE 입니다."},10:{title:"동영상을 재생할 수 없음",desc:"iOS에서 Dash 비디오를 재생할 수 없습니다."},11:{title:"동영상을 재생할 수 없음",desc:"DRM 토큰이 잘못되었습니다."},12:{title:"동영상을 재생할 수 없음",desc:"DRM 라이선스 서버와 통신에 실패하였습니다."},13:{title:"동영상을 재생할 수 없음",desc:"FairPlay 인증서 검증에 실패하였습니다."},14:{title:"동영상을 재생할 수 없음",desc:"화면 캡쳐 / 화면 녹화가 감지되었습니다."},15:{title:"플레이어 실행 실패",desc:"필수 모듈이 로드되지 않았습니다. (hls.js)"},16:{title:"플레이어 실행 실패",desc:"필수 모듈이 로드되지 않았습니다. (dash.js)"}},alternative:{hour:"시",minute:"분",second:"초",after:"잠시 ",afterMin:"분 ",afterHour:"시간 ",afterDay:"일 ",startPlay:"{timeTxt} 후 영상이 시작됩니다.",nextPlay:"{timeTxt}초 후 다음 영상이 재생됩니다.",afterPlay:"예정"}},h={common:{cancel:"キャンセル",auto:"自動",normal:"標準",notUse:"使用しない",prev:"前の動画",next:"次の動画",delayText:"秒後に自動再生",license:"ライセンス",play:"再生",pause:"一時停止",replay:"リプレイ",fullOn:"全画面表示",fullOff:"全画面表示を終了",muteOn:"ミュート",muteOff:"ミュート解除",captionOff:"字幕をオフにする",captionOn:"字幕をオンにする",setting:"設定",live:"ライブ",miniPlayer:"ミニプレーヤー",isMute:"ミュート状態です。",subtitle:"字幕",subtitleNot:"字幕は利用できません"},settings:{autoplay:"自動再生",playbackRate:"再生速度",captions:"字幕",quality:"画質"},error:{"01":{title:"動画を再生できません",desc:"不正なアクセスです。access_keyを確認してください。"},"02":{title:"動画を再生できません",desc:"この動画を再生する権限がありません。"},"03":{title:"認証に失敗しました",desc:"ネットワーク接続が不安定です。"},"04":{title:"動画を再生できません",desc:"動画を再生できませんでした。"},"05":{title:"動画を再生できません",desc:"ライセンスが無効です。"},"06":{title:"動画を再生できません",desc:"月間の基本提供呼び出し回数を超過しました。有料版に切り替えてご利用ください。"},"07":{title:"動画を再生できません",desc:"サポートされていない形式です。"},"08":{title:"動画を再生できません",desc:"URLの形式が正しくありません。"},"09":{title:"動画を再生できません",desc:"ライブストリームはオフラインです。"},10:{title:"動画を再生できません",desc:"iOSではDASHビデオを再生できません。"},11:{title:"動画を再生できません",desc:"DRMトークンが無効です。"},12:{title:"動画を再生できません",desc:"DRMライセンスサーバーとの通信に失敗しました。"},13:{title:"動画を再生できません",desc:"FairPlay証明書の検証に失敗しました。"},14:{title:"動画を再生できません",desc:"画面キャプチャ/画面録画が検出されました。"},15:{title:"プレーヤーの起動に失敗しました",desc:"必須モジュールが読み込まれていません。(hls.js)"},16:{title:"プレーヤーの起動に失敗しました",desc:"必須モジュールが読み込まれていません。(dash.js)"}},alternative:{hour:"時間",minute:"分",second:"秒",after:"しばらくして",afterMin:"分後",afterHour:"時間後",afterDay:"日後",startPlay:"{timeTxt}後に動画が始まります。",nextPlay:"{timeTxt}秒後に次の動画が再生されます。",afterPlay:"予定"}},d={en:g,ko:m,ja:h},v=()=>typeof navigator<"u"&&typeof navigator.language<"u";function S(t){const e=t.split("-")[0];return e in d?e:"en"}function p(t){let e="en";t?e=t:v()&&(e=navigator.language);const n=S(e);return d[n]}p();const b={AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia (Plurinational State of)",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",CV:"Cabo Verde",KH:"Cambodia",CM:"Cameroon",CA:"Canada",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo (Democratic Republic of the)",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'Ivoire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and McDonald Islands",VA:"Holy See",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran (Islamic Republic of)",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea (Democratic People's Republic of)",KR:"Korea, Republic of",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia (the former Yugoslav Republic of)",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia (Federated States of)",MD:"Moldova (Republic of)",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension and Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States of America",UM:"United States Minor Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela (Bolivarian Republic of)",VN:"Viet Nam",VG:"Virgin Islands (British)",VI:"Virgin Islands (U.S.)",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"},M={gov:{prod:{log:"https://papi.vpe.gov-ntruss.com/player/maSync",report:"https://log.vpe.gov-ntruss.com/stats"},beta:{log:"https://papi.beta-vpe.gov-ntruss.com/player/maSync",report:"https://log.beta-vpe.gov-ntruss.com/stats"}},pub:{prod:{log:"https://papi.vpe.naverncp.com/player/maSync",report:"https://log.vpe.naverncp.com/stats"},beta:{log:"https://papi.beta-vpe.naverncp.com/player/maSync",report:"https://log.beta-vpe.naverncp.com/stats"}}};let s={video:{},browser:{},device:{},connection:{},screen:{},player_version:"latest",extra:{sessionId:null,playerType:"VPE React Native"},log_type:"vpe",privacy:{cookie_enabled:!0}},l={platform:"pub",stage:"prod",sync:!1,syncResult:{}};const C=new Date().getTime(),y=()=>{const t=new Date,e=i=>String(i).padStart(2,"0"),n=`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`,a=Math.floor(t.getTime()/1e3),r=new Date().getTime()-C;return{logDate:n,logDateUnix:a,thisSec:r}};function I(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function w(t,e){Object.entries(e).forEach(([n,a])=>{I(a)?(t[n]||(t[n]={}),Object.entries(a).forEach(([r,i])=>{i!=null&&(t[n][r]=i)})):a!=null&&(t[n]=a)})}function P(t){const e=[];return t?.r1&&e.push(t.r1),t?.r2&&e.push(t.r2),t?.r3&&e.push(t.r3),e.join(" ")}function R(t){try{const e=l.syncResult?.geoLocation;e&&(t.address=P(e),t.isp=e.net||"",t.ip=l.syncResult?.ip||"",t.nation=e.country||"")}catch{}}const T=async t=>{if(!t)return;const{platform:e,stage:n}=l,a=M[e][n].log;try{const i=await(await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({access_key:t})})).json();l.sync=i.result?.sync||!1,l.syncResult=i.result||{};const{logDate:o,logDateUnix:c}=y();return s.extra.logDate=o,s.extra.logDateUnix=c,l.syncResult?.geoLocation&&R(s.extra),i}catch(r){return console.error("MA config initialization failed:",r),null}};async function B(t,e,n,a,r){l.platform=t,l.stage=e,w(s,n),a&&(s.extra.vpePackageId=a),r&&(s.extra.vpeKey=r),s.extra.nation?s.browser.country=b[s.extra.nation]||"Korea, Republic of":s.browser.country="Korea, Republic of";const{logDate:i,logDateUnix:o}=y();s.extra.logDate=i,s.extra.logDateUnix=o,s.extra.created_at=o}const A=(t={})=>{const e={autostart:!0,muted:!1,aspectRatio:"16/9",objectFit:"contain",controls:!0,keyboardShortcut:!1,startMutedInfoNotVisible:!1,allowsPictureInPicture:!1,staysActiveInBackground:!1,screenRecordingPrevention:!1,modalFullscreen:!1,lang:"ko",ui:"all",controlBtn:{play:!0,fullscreen:!0,progressBar:!0,volume:!1,times:!0,pictureInPicture:!0,setting:!0,subtitle:!0},progressBarColor:"#4299f5",controlActiveTime:3e3,playRateSetting:[.5,.75,1,1.5,2],autoPause:!1,repeat:!1,setStartTime:void 0,playIndex:0,lowLatencyMode:!0,touchGestures:!0,descriptionNotVisible:!1,devTestAppId:void 0,token:"",visibleWatermark:!1,watermarkText:"NAVER CLOUD PLATFORM",watermarkConfig:{randPosition:!0,randPositionInterVal:3e3,x:10,y:10,opacity:.5},captionStyle:{fontSize:12,color:"#ffffff",backgroundColor:"rgba(0, 0, 0, 0.4)",edgeStyle:"dropshadow"},override:null},n={...e,...t};return t.controlBtn&&(n.controlBtn={...e.controlBtn,...t.controlBtn}),t.watermarkConfig&&(n.watermarkConfig={...e.watermarkConfig,...t.watermarkConfig}),t.captionStyle&&(n.captionStyle={...e.captionStyle,...t.captionStyle}),n.objectFit==="fill"&&(n.objectFit="stretch"),n.controlBtn?.progressBar===void 0&&(n.controlBtn.progressBar=!0),n},L={gov:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5nb3YtbnRydXNzLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cudnBlLmdvdi1udHJ1c3MuY29tL3N0YXRz"},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLmdvdi1udHJ1c3MuY29tL3BsYXllci9jb25maWc=",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUuZ292LW50cnVzcy5jb20vc3RhdHM="}},pub:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5uYXZlcm5jcC5jb20vcGxheWVyL2NvbmZpZw==",report:"aHR0cHM6Ly9sb2cudnBlLm5hdmVybmNwLmNvbS9zdGF0cw=="},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLm5hdmVybmNwLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUubmF2ZXJuY3AuY29tL3N0YXRz"}}};let u=[];const E=t=>{try{return atob(t)}catch(e){return console.error("Base64 decoding failed:",e),""}};class N{serverConfig={};playerInfo=null;accessKey;appId;platform;stage;isDev;translator;errorState;constructor({accessKey:e,appId:n,platform:a,stage:r,isDev:i=!1,language:o}){this.accessKey=e,this.appId=n||location.origin,this.platform=a,this.stage=r,this.isDev=i,this.translator=p(o),this.errorState={errorCode:null,errorMessage:null}}async initialize(){const e=["accessKey","appId","E0002","E0001","E0003"],n="VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다.";if([this[e[0]],this[e[1]]].some(i=>!i))return console.warn(n),{error:this.setErrorRun(e[2])};const r=i=>(this.serverConfig=i,this.playerInfo=this.createPlayerInfo(i),this.playerInfo);try{const i=await this.performKeyCheck();if(i.code!==200)return{error:this.setErrorRun(e[3])};const o=r(i);return await B(this.platform,this.stage,o,this.appId,this.accessKey),await T(this.accessKey),{options:this.serverConfig.result?.options,playerInfo:o}}catch(i){return console.error("VPE SDK Initialization failed:",i),{error:this.setErrorRun(e[4])}}}async performKeyCheck(){const e=["?preview=true","config","Content-Type","application/json","access_key","domain","POST"],n=this.isDev?e[0]:"",a=E(L[this.platform][this.stage][e[1]])+n,r=JSON.stringify([e[4],e[5]].reduce((o,c,f)=>(o[c]=[this.accessKey,this.appId][f],o),{})),i=await fetch(a,{method:e[6],headers:{[e[2]]:e[3]},body:r});if(!i.ok)throw new Error(["API","Error:",i.status,i.statusText].join(" "));return i.json()}getBrowserInfo(){const e=navigator.userAgent;return/Edg\/(\d+\.\d+)/.test(e)?{origin:"Edge",version:RegExp.$1}:/Chrome\/(\d+\.\d+)/.test(e)&&!e.includes("Edg")?{origin:"Chrome",version:RegExp.$1}:/Firefox\/(\d+\.\d+)/.test(e)?{origin:"Firefox",version:RegExp.$1}:/Version\/(\d+\.\d+)/.test(e)&&e.includes("Safari")?{origin:"Safari",version:RegExp.$1}:{origin:"Unknown",version:"Unknown"}}createPlayerInfo(e){const[n,a]=e.result.name.split("|"),r=navigator.connection||navigator.mozConnection||navigator.webkitConnection,i=this.getBrowserInfo(),o=navigator.userAgentData;return{cid:e.result.cid,player_name:n,player_version:a,pricing:e.result.pricing,maUse:e.result.options?.maUse==="Y"?"Y":"N",browser:{lang:navigator.language,ua:navigator.userAgent},screen:{width:window.screen.width,height:window.screen.height},connection:{network:r?.effectiveType??"unknown",downlink:r?.downlink??null,rtt:r?.rtt??null,save_data:r?.saveData??!1},device:{platform:o?.platform??"Unknown",mobile:o?.mobile??!1,memory:navigator.deviceMemory??null,processor:navigator.hardwareConcurrency??null},video:{url:""},extra:{vpeKey:this.accessKey,playerType:"VPE",playerVersion:a,device:o?.platform??"Unknown",os:o?.platform??"Unknown",osOrigin:o?.platform??"Unknown",osVersion:o?.platformVersion??"Unknown",vpePackageId:this.appId,actionDuration:0,actionType:"ready",browser:i.origin,browserOrigin:i.origin,browserVersion:i.version,protocol:location.protocol,quality:"Other",qualityOrigin:"Auto",host:`${this.appId}&${o?.platform??"Unknown"}&${o?.platformVersion??"Unknown"}`,location:`${this.appId}://appView/video/vpe`,title:""}}}setErrorRun(e){const n=e.slice(-2),a=this.translator.error[n]||this.translator.error["01"],r={errorCode:e,errorMessage:a};return this.errorState=r,console.error("ncplayer : ",r),r}getErrorState(){return this.errorState}isPaidTier(){return this.serverConfig.result?.pricing==="pay"}isInitialized(){return!!this.serverConfig.result}getValidatedOptions(e){const n=A(this.serverConfig.result?.options?.options),a={...n,...e??{}};return e?.controlBtn&&(a.controlBtn={...n.controlBtn,...e.controlBtn}),e?.watermarkConfig&&(a.watermarkConfig={...n.watermarkConfig,...e.watermarkConfig}),a.playlist&&!Array.isArray(a.playlist)&&(a.playlist=[{file:a.playlist}]),u=a.playlist||[],a}getPlaylist(){return u||[]}$t(e){const n=e.split(".");let a=this.translator;for(const r of n)if(a&&typeof a=="object"&&r in a)a=a[r];else return e;return typeof a=="string"?a:e}}module.exports=N;
|
package/dist/vpe-core-sdk.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const g = {
|
|
2
2
|
common: {
|
|
3
3
|
cancel: "Cancel",
|
|
4
4
|
auto: "Auto",
|
|
@@ -50,6 +50,14 @@ const f = {
|
|
|
50
50
|
14: {
|
|
51
51
|
title: "Cannot play video",
|
|
52
52
|
desc: "Screen capture / screen recording has been detected."
|
|
53
|
+
},
|
|
54
|
+
15: {
|
|
55
|
+
title: "Player Execution Failed",
|
|
56
|
+
desc: "Required module was not loaded. (hls.js)"
|
|
57
|
+
},
|
|
58
|
+
16: {
|
|
59
|
+
title: "Player Execution Failed",
|
|
60
|
+
desc: "Required module was not loaded. (dash.js)"
|
|
53
61
|
}
|
|
54
62
|
},
|
|
55
63
|
alternative: {
|
|
@@ -64,7 +72,7 @@ const f = {
|
|
|
64
72
|
nextPlay: "Next video will play in {timeTxt} seconds.",
|
|
65
73
|
afterPlay: "Scheduled"
|
|
66
74
|
}
|
|
67
|
-
},
|
|
75
|
+
}, m = {
|
|
68
76
|
common: {
|
|
69
77
|
cancel: "취소",
|
|
70
78
|
auto: "자동",
|
|
@@ -152,6 +160,14 @@ const f = {
|
|
|
152
160
|
14: {
|
|
153
161
|
title: "동영상을 재생할 수 없음",
|
|
154
162
|
desc: "화면 캡쳐 / 화면 녹화가 감지되었습니다."
|
|
163
|
+
},
|
|
164
|
+
15: {
|
|
165
|
+
title: "플레이어 실행 실패",
|
|
166
|
+
desc: "필수 모듈이 로드되지 않았습니다. (hls.js)"
|
|
167
|
+
},
|
|
168
|
+
16: {
|
|
169
|
+
title: "플레이어 실행 실패",
|
|
170
|
+
desc: "필수 모듈이 로드되지 않았습니다. (dash.js)"
|
|
155
171
|
}
|
|
156
172
|
},
|
|
157
173
|
alternative: {
|
|
@@ -166,7 +182,7 @@ const f = {
|
|
|
166
182
|
nextPlay: "{timeTxt}초 후 다음 영상이 재생됩니다.",
|
|
167
183
|
afterPlay: "예정"
|
|
168
184
|
}
|
|
169
|
-
},
|
|
185
|
+
}, h = {
|
|
170
186
|
common: {
|
|
171
187
|
cancel: "キャンセル",
|
|
172
188
|
auto: "自動",
|
|
@@ -215,6 +231,14 @@ const f = {
|
|
|
215
231
|
14: {
|
|
216
232
|
title: "動画を再生できません",
|
|
217
233
|
desc: "画面キャプチャ/画面録画が検出されました。"
|
|
234
|
+
},
|
|
235
|
+
15: {
|
|
236
|
+
title: "プレーヤーの起動に失敗しました",
|
|
237
|
+
desc: "必須モジュールが読み込まれていません。(hls.js)"
|
|
238
|
+
},
|
|
239
|
+
16: {
|
|
240
|
+
title: "プレーヤーの起動に失敗しました",
|
|
241
|
+
desc: "必須モジュールが読み込まれていません。(dash.js)"
|
|
218
242
|
}
|
|
219
243
|
},
|
|
220
244
|
alternative: {
|
|
@@ -229,92 +253,23 @@ const f = {
|
|
|
229
253
|
nextPlay: "{timeTxt}秒後に次の動画が再生されます。",
|
|
230
254
|
afterPlay: "予定"
|
|
231
255
|
}
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
prev: "上一个视频",
|
|
239
|
-
next: "下一个视频",
|
|
240
|
-
delayText: "{0}秒后自动播放",
|
|
241
|
-
license: "许可",
|
|
242
|
-
play: "播放",
|
|
243
|
-
pause: "暂停",
|
|
244
|
-
replay: "重新观看",
|
|
245
|
-
fullOn: "全屏",
|
|
246
|
-
fullOff: "解除全屏",
|
|
247
|
-
muteOn: "静音",
|
|
248
|
-
muteOff: "解除静音",
|
|
249
|
-
captionOff: "关闭字幕",
|
|
250
|
-
captionOn: "开启字幕",
|
|
251
|
-
setting: "设定",
|
|
252
|
-
live: "LIVE",
|
|
253
|
-
miniPlayer: "迷你播放器",
|
|
254
|
-
isMute: "当前处于静音状态。"
|
|
255
|
-
},
|
|
256
|
-
settings: {
|
|
257
|
-
autoplay: "自动播放",
|
|
258
|
-
playbackRate: "播放速度",
|
|
259
|
-
captions: "字幕",
|
|
260
|
-
quality: "分辨率"
|
|
261
|
-
},
|
|
262
|
-
error: {
|
|
263
|
-
"01": {
|
|
264
|
-
title: "无法播放视频",
|
|
265
|
-
desc: "错误的访问。"
|
|
266
|
-
},
|
|
267
|
-
"02": {
|
|
268
|
-
title: "无法播放视频",
|
|
269
|
-
desc: "因权限问题,无法播放视频。"
|
|
270
|
-
},
|
|
271
|
-
"03": {
|
|
272
|
-
title: "认证失败",
|
|
273
|
-
desc: "网络连接不稳定。"
|
|
274
|
-
},
|
|
275
|
-
"04": {
|
|
276
|
-
title: "无法播放视频",
|
|
277
|
-
desc: "无法播放视频。"
|
|
278
|
-
},
|
|
279
|
-
"05": {
|
|
280
|
-
title: "无法播放视频",
|
|
281
|
-
desc: "该许可无效。"
|
|
282
|
-
},
|
|
283
|
-
"06": {
|
|
284
|
-
title: "无法播放视频",
|
|
285
|
-
desc: "已超过每月基本提供的调用次数。请转换为付费版本后使用。"
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
alternative: {
|
|
289
|
-
hour: "小时",
|
|
290
|
-
minute: "分钟",
|
|
291
|
-
second: "秒",
|
|
292
|
-
after: "请稍后",
|
|
293
|
-
afterMin: "分钟后",
|
|
294
|
-
afterHour: "小时后",
|
|
295
|
-
afterDay: "天后",
|
|
296
|
-
startPlay: "{timeTxt}之后开始播放视频。",
|
|
297
|
-
nextPlay: "{timeTxt}秒后,将播放下一个视频。",
|
|
298
|
-
afterPlay: "预计"
|
|
299
|
-
}
|
|
300
|
-
}, c = {
|
|
301
|
-
en: f,
|
|
302
|
-
ko: y,
|
|
303
|
-
ja: g,
|
|
304
|
-
zh: m
|
|
305
|
-
}, h = () => typeof navigator < "u" && typeof navigator.language < "u";
|
|
306
|
-
function v(t) {
|
|
256
|
+
}, u = {
|
|
257
|
+
en: g,
|
|
258
|
+
ko: m,
|
|
259
|
+
ja: h
|
|
260
|
+
}, v = () => typeof navigator < "u" && typeof navigator.language < "u";
|
|
261
|
+
function S(t) {
|
|
307
262
|
const e = t.split("-")[0];
|
|
308
|
-
return e in
|
|
263
|
+
return e in u ? e : "en";
|
|
309
264
|
}
|
|
310
|
-
function
|
|
265
|
+
function p(t) {
|
|
311
266
|
let e = "en";
|
|
312
|
-
t ? e = t :
|
|
313
|
-
const n =
|
|
314
|
-
return
|
|
267
|
+
t ? e = t : v() && (e = navigator.language);
|
|
268
|
+
const n = S(e);
|
|
269
|
+
return u[n];
|
|
315
270
|
}
|
|
316
|
-
|
|
317
|
-
const
|
|
271
|
+
p();
|
|
272
|
+
const b = {
|
|
318
273
|
AF: "Afghanistan",
|
|
319
274
|
AX: "Åland Islands",
|
|
320
275
|
AL: "Albania",
|
|
@@ -564,7 +519,7 @@ const S = {
|
|
|
564
519
|
YE: "Yemen",
|
|
565
520
|
ZM: "Zambia",
|
|
566
521
|
ZW: "Zimbabwe"
|
|
567
|
-
},
|
|
522
|
+
}, M = {
|
|
568
523
|
gov: {
|
|
569
524
|
prod: {
|
|
570
525
|
log: "https://papi.vpe.gov-ntruss.com/player/maSync",
|
|
@@ -607,40 +562,40 @@ let s = {
|
|
|
607
562
|
sync: !1,
|
|
608
563
|
syncResult: {}
|
|
609
564
|
};
|
|
610
|
-
const
|
|
611
|
-
const t = /* @__PURE__ */ new Date(), e = (
|
|
565
|
+
const C = (/* @__PURE__ */ new Date()).getTime(), y = () => {
|
|
566
|
+
const t = /* @__PURE__ */ new Date(), e = (i) => String(i).padStart(2, "0"), n = `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`, a = Math.floor(t.getTime() / 1e3), r = (/* @__PURE__ */ new Date()).getTime() - C;
|
|
612
567
|
return {
|
|
613
568
|
logDate: n,
|
|
614
569
|
logDateUnix: a,
|
|
615
|
-
thisSec:
|
|
570
|
+
thisSec: r
|
|
616
571
|
};
|
|
617
572
|
};
|
|
618
|
-
function
|
|
573
|
+
function I(t) {
|
|
619
574
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
620
575
|
}
|
|
621
|
-
function
|
|
576
|
+
function w(t, e) {
|
|
622
577
|
Object.entries(e).forEach(([n, a]) => {
|
|
623
|
-
|
|
624
|
-
|
|
578
|
+
I(a) ? (t[n] || (t[n] = {}), Object.entries(a).forEach(([r, i]) => {
|
|
579
|
+
i != null && (t[n][r] = i);
|
|
625
580
|
})) : a != null && (t[n] = a);
|
|
626
581
|
});
|
|
627
582
|
}
|
|
628
|
-
function
|
|
583
|
+
function P(t) {
|
|
629
584
|
const e = [];
|
|
630
585
|
return t?.r1 && e.push(t.r1), t?.r2 && e.push(t.r2), t?.r3 && e.push(t.r3), e.join(" ");
|
|
631
586
|
}
|
|
632
|
-
function
|
|
587
|
+
function R(t) {
|
|
633
588
|
try {
|
|
634
589
|
const e = l.syncResult?.geoLocation;
|
|
635
|
-
e && (t.address =
|
|
590
|
+
e && (t.address = P(e), t.isp = e.net || "", t.ip = l.syncResult?.ip || "", t.nation = e.country || "");
|
|
636
591
|
} catch {
|
|
637
592
|
}
|
|
638
593
|
}
|
|
639
594
|
const T = async (t) => {
|
|
640
595
|
if (!t) return;
|
|
641
|
-
const { platform: e, stage: n } = l, a =
|
|
596
|
+
const { platform: e, stage: n } = l, a = M[e][n].log;
|
|
642
597
|
try {
|
|
643
|
-
const
|
|
598
|
+
const i = await (await fetch(a, {
|
|
644
599
|
method: "POST",
|
|
645
600
|
headers: {
|
|
646
601
|
"Content-Type": "application/json"
|
|
@@ -649,19 +604,19 @@ const T = async (t) => {
|
|
|
649
604
|
access_key: t
|
|
650
605
|
})
|
|
651
606
|
})).json();
|
|
652
|
-
l.sync =
|
|
653
|
-
const { logDate: o, logDateUnix:
|
|
654
|
-
return s.extra.logDate = o, s.extra.logDateUnix =
|
|
655
|
-
} catch (
|
|
656
|
-
return console.error("MA config initialization failed:",
|
|
607
|
+
l.sync = i.result?.sync || !1, l.syncResult = i.result || {};
|
|
608
|
+
const { logDate: o, logDateUnix: c } = y();
|
|
609
|
+
return s.extra.logDate = o, s.extra.logDateUnix = c, l.syncResult?.geoLocation && R(s.extra), i;
|
|
610
|
+
} catch (r) {
|
|
611
|
+
return console.error("MA config initialization failed:", r), null;
|
|
657
612
|
}
|
|
658
613
|
};
|
|
659
|
-
async function
|
|
660
|
-
l.platform = t, l.stage = e,
|
|
661
|
-
const { logDate:
|
|
662
|
-
s.extra.logDate =
|
|
614
|
+
async function B(t, e, n, a, r) {
|
|
615
|
+
l.platform = t, l.stage = e, w(s, n), a && (s.extra.vpePackageId = a), r && (s.extra.vpeKey = r), s.extra.nation ? s.browser.country = b[s.extra.nation] || "Korea, Republic of" : s.browser.country = "Korea, Republic of";
|
|
616
|
+
const { logDate: i, logDateUnix: o } = y();
|
|
617
|
+
s.extra.logDate = i, s.extra.logDateUnix = o, s.extra.created_at = o;
|
|
663
618
|
}
|
|
664
|
-
const
|
|
619
|
+
const A = (t = {}) => {
|
|
665
620
|
const e = {
|
|
666
621
|
autostart: !0,
|
|
667
622
|
muted: !1,
|
|
@@ -725,7 +680,7 @@ const B = (t = {}) => {
|
|
|
725
680
|
...e.captionStyle,
|
|
726
681
|
...t.captionStyle
|
|
727
682
|
}), n.objectFit === "fill" && (n.objectFit = "stretch"), n.controlBtn?.progressBar === void 0 && (n.controlBtn.progressBar = !0), n;
|
|
728
|
-
},
|
|
683
|
+
}, L = {
|
|
729
684
|
gov: {
|
|
730
685
|
prod: {
|
|
731
686
|
config: "aHR0cHM6Ly9wYXBpLnZwZS5nb3YtbnRydXNzLmNvbS9wbGF5ZXIvY29uZmln",
|
|
@@ -746,13 +701,15 @@ const B = (t = {}) => {
|
|
|
746
701
|
report: "aHR0cHM6Ly9sb2cuYmV0YS12cGUubmF2ZXJuY3AuY29tL3N0YXRz"
|
|
747
702
|
}
|
|
748
703
|
}
|
|
749
|
-
}
|
|
704
|
+
};
|
|
705
|
+
let d = [];
|
|
706
|
+
const E = (t) => {
|
|
750
707
|
try {
|
|
751
708
|
return atob(t);
|
|
752
709
|
} catch (e) {
|
|
753
710
|
return console.error("Base64 decoding failed:", e), "";
|
|
754
711
|
}
|
|
755
|
-
}
|
|
712
|
+
};
|
|
756
713
|
class N {
|
|
757
714
|
serverConfig = {};
|
|
758
715
|
playerInfo = null;
|
|
@@ -762,41 +719,54 @@ class N {
|
|
|
762
719
|
stage;
|
|
763
720
|
isDev;
|
|
764
721
|
translator;
|
|
765
|
-
|
|
766
|
-
|
|
722
|
+
errorState;
|
|
723
|
+
// SDK 초기화에 필요한 기본 옵션을 보관한다.
|
|
724
|
+
constructor({ accessKey: e, appId: n, platform: a, stage: r, isDev: i = !1, language: o }) {
|
|
725
|
+
this.accessKey = e, this.appId = n || location.origin, this.platform = a, this.stage = r, this.isDev = i, this.translator = p(o), this.errorState = {
|
|
726
|
+
errorCode: null,
|
|
727
|
+
errorMessage: null
|
|
728
|
+
};
|
|
767
729
|
}
|
|
730
|
+
// 인증 키를 확인하고 서버 설정 및 MA를 초기화한다.
|
|
768
731
|
async initialize() {
|
|
769
|
-
|
|
770
|
-
|
|
732
|
+
const e = ["accessKey", "appId", "E0002", "E0001", "E0003"], n = "VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다.";
|
|
733
|
+
if ([this[e[0]], this[e[1]]].some((i) => !i))
|
|
734
|
+
return console.warn(n), { error: this.setErrorRun(e[2]) };
|
|
735
|
+
const r = (i) => (this.serverConfig = i, this.playerInfo = this.createPlayerInfo(i), this.playerInfo);
|
|
771
736
|
try {
|
|
772
|
-
const
|
|
773
|
-
|
|
737
|
+
const i = await this.performKeyCheck();
|
|
738
|
+
if (i.code !== 200)
|
|
739
|
+
return { error: this.setErrorRun(e[3]) };
|
|
740
|
+
const o = r(i);
|
|
741
|
+
return await B(this.platform, this.stage, o, this.appId, this.accessKey), await T(this.accessKey), {
|
|
774
742
|
options: this.serverConfig.result?.options,
|
|
775
|
-
playerInfo:
|
|
776
|
-
}
|
|
777
|
-
} catch (
|
|
778
|
-
return console.error("VPE SDK Initialization failed:",
|
|
743
|
+
playerInfo: o
|
|
744
|
+
};
|
|
745
|
+
} catch (i) {
|
|
746
|
+
return console.error("VPE SDK Initialization failed:", i), { error: this.setErrorRun(e[4]) };
|
|
779
747
|
}
|
|
780
748
|
}
|
|
749
|
+
// AccessKey 유효성을 검사하기 위해 서버에 구성 정보를 요청한다.
|
|
781
750
|
async performKeyCheck() {
|
|
782
|
-
const e =
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
})
|
|
751
|
+
const e = ["?preview=true", "config", "Content-Type", "application/json", "access_key", "domain", "POST"], n = this.isDev ? e[0] : "", a = E(L[this.platform][this.stage][e[1]]) + n, r = JSON.stringify(
|
|
752
|
+
[e[4], e[5]].reduce((o, c, f) => (o[c] = [this.accessKey, this.appId][f], o), {})
|
|
753
|
+
), i = await fetch(a, {
|
|
754
|
+
method: e[6],
|
|
755
|
+
headers: { [e[2]]: e[3] },
|
|
756
|
+
body: r
|
|
789
757
|
});
|
|
790
|
-
if (!
|
|
791
|
-
throw new Error(
|
|
792
|
-
return
|
|
758
|
+
if (!i.ok)
|
|
759
|
+
throw new Error(["API", "Error:", i.status, i.statusText].join(" "));
|
|
760
|
+
return i.json();
|
|
793
761
|
}
|
|
762
|
+
// 브라우저 UA 문자열을 파싱해 종류와 버전을 반환한다.
|
|
794
763
|
getBrowserInfo() {
|
|
795
764
|
const e = navigator.userAgent;
|
|
796
765
|
return /Edg\/(\d+\.\d+)/.test(e) ? { origin: "Edge", version: RegExp.$1 } : /Chrome\/(\d+\.\d+)/.test(e) && !e.includes("Edg") ? { origin: "Chrome", version: RegExp.$1 } : /Firefox\/(\d+\.\d+)/.test(e) ? { origin: "Firefox", version: RegExp.$1 } : /Version\/(\d+\.\d+)/.test(e) && e.includes("Safari") ? { origin: "Safari", version: RegExp.$1 } : { origin: "Unknown", version: "Unknown" };
|
|
797
766
|
}
|
|
767
|
+
// 서버에서 받은 정보와 클라이언트 환경을 합쳐 PlayerInfo를 구성한다.
|
|
798
768
|
createPlayerInfo(e) {
|
|
799
|
-
const [n, a] = e.result.name.split("|"),
|
|
769
|
+
const [n, a] = e.result.name.split("|"), r = navigator.connection || navigator.mozConnection || navigator.webkitConnection, i = this.getBrowserInfo(), o = navigator.userAgentData;
|
|
800
770
|
return {
|
|
801
771
|
cid: e.result.cid,
|
|
802
772
|
player_name: n,
|
|
@@ -812,10 +782,10 @@ class N {
|
|
|
812
782
|
height: window.screen.height
|
|
813
783
|
},
|
|
814
784
|
connection: {
|
|
815
|
-
network:
|
|
816
|
-
downlink:
|
|
817
|
-
rtt:
|
|
818
|
-
save_data:
|
|
785
|
+
network: r?.effectiveType ?? "unknown",
|
|
786
|
+
downlink: r?.downlink ?? null,
|
|
787
|
+
rtt: r?.rtt ?? null,
|
|
788
|
+
save_data: r?.saveData ?? !1
|
|
819
789
|
},
|
|
820
790
|
device: {
|
|
821
791
|
platform: o?.platform ?? "Unknown",
|
|
@@ -835,9 +805,9 @@ class N {
|
|
|
835
805
|
vpePackageId: this.appId,
|
|
836
806
|
actionDuration: 0,
|
|
837
807
|
actionType: "ready",
|
|
838
|
-
browser:
|
|
839
|
-
browserOrigin:
|
|
840
|
-
browserVersion:
|
|
808
|
+
browser: i.origin,
|
|
809
|
+
browserOrigin: i.origin,
|
|
810
|
+
browserVersion: i.version,
|
|
841
811
|
protocol: location.protocol,
|
|
842
812
|
quality: "Other",
|
|
843
813
|
qualityOrigin: "Auto",
|
|
@@ -847,33 +817,46 @@ class N {
|
|
|
847
817
|
}
|
|
848
818
|
};
|
|
849
819
|
}
|
|
820
|
+
// 에러 코드를 번역하고 공통 포맷으로 반환한다.
|
|
850
821
|
setErrorRun(e) {
|
|
851
|
-
const n = e.slice(-2), a = this.translator.error[n] || this.translator.error["01"],
|
|
822
|
+
const n = e.slice(-2), a = this.translator.error[n] || this.translator.error["01"], r = {
|
|
852
823
|
errorCode: e,
|
|
853
824
|
errorMessage: a
|
|
854
825
|
};
|
|
855
|
-
return console.
|
|
826
|
+
return this.errorState = r, console.error("ncplayer : ", r), r;
|
|
856
827
|
}
|
|
828
|
+
// 마지막 에러 상태를 반환한다.
|
|
829
|
+
getErrorState() {
|
|
830
|
+
return this.errorState;
|
|
831
|
+
}
|
|
832
|
+
// 현재 요금제가 유료인지 여부를 반환한다.
|
|
857
833
|
isPaidTier() {
|
|
858
834
|
return this.serverConfig.result?.pricing === "pay";
|
|
859
835
|
}
|
|
836
|
+
// 서버 설정이 존재해 초기화가 완료되었는지 확인한다.
|
|
860
837
|
isInitialized() {
|
|
861
838
|
return !!this.serverConfig.result;
|
|
862
839
|
}
|
|
840
|
+
// 서버 옵션과 전달된 옵션을 병합해 유효한 플레이어 옵션을 생성한다.
|
|
863
841
|
getValidatedOptions(e) {
|
|
864
|
-
const n =
|
|
865
|
-
return e?.controlBtn && (a.controlBtn = { ...n.controlBtn, ...e.controlBtn }), e?.watermarkConfig && (a.watermarkConfig = { ...n.watermarkConfig, ...e.watermarkConfig }), a.playlist && !Array.isArray(a.playlist) && (a.playlist = [{ file: a.playlist }]), a;
|
|
842
|
+
const n = A(this.serverConfig.result?.options?.options), a = { ...n, ...e ?? {} };
|
|
843
|
+
return e?.controlBtn && (a.controlBtn = { ...n.controlBtn, ...e.controlBtn }), e?.watermarkConfig && (a.watermarkConfig = { ...n.watermarkConfig, ...e.watermarkConfig }), a.playlist && !Array.isArray(a.playlist) && (a.playlist = [{ file: a.playlist }]), d = a.playlist || [], a;
|
|
844
|
+
}
|
|
845
|
+
// 정규화된 플레이리스트를 반환한다.
|
|
846
|
+
getPlaylist() {
|
|
847
|
+
return d || [];
|
|
866
848
|
}
|
|
867
849
|
/**
|
|
868
850
|
*
|
|
869
851
|
* @param key
|
|
870
852
|
*/
|
|
853
|
+
// 다국어 키를 점 표기법으로 찾아 문자열을 반환한다.
|
|
871
854
|
$t(e) {
|
|
872
855
|
const n = e.split(".");
|
|
873
856
|
let a = this.translator;
|
|
874
|
-
for (const
|
|
875
|
-
if (a && typeof a == "object" &&
|
|
876
|
-
a = a[
|
|
857
|
+
for (const r of n)
|
|
858
|
+
if (a && typeof a == "object" && r in a)
|
|
859
|
+
a = a[r];
|
|
877
860
|
else
|
|
878
861
|
return e;
|
|
879
862
|
return typeof a == "string" ? a : e;
|
package/package.json
CHANGED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
common: {
|
|
3
|
-
cancel: string;
|
|
4
|
-
auto: string;
|
|
5
|
-
normal: string;
|
|
6
|
-
notUse: string;
|
|
7
|
-
prev: string;
|
|
8
|
-
next: string;
|
|
9
|
-
delayText: string;
|
|
10
|
-
license: string;
|
|
11
|
-
play: string;
|
|
12
|
-
pause: string;
|
|
13
|
-
replay: string;
|
|
14
|
-
fullOn: string;
|
|
15
|
-
fullOff: string;
|
|
16
|
-
muteOn: string;
|
|
17
|
-
muteOff: string;
|
|
18
|
-
captionOff: string;
|
|
19
|
-
captionOn: string;
|
|
20
|
-
setting: string;
|
|
21
|
-
live: string;
|
|
22
|
-
miniPlayer: string;
|
|
23
|
-
isMute: string;
|
|
24
|
-
};
|
|
25
|
-
settings: {
|
|
26
|
-
autoplay: string;
|
|
27
|
-
playbackRate: string;
|
|
28
|
-
captions: string;
|
|
29
|
-
quality: string;
|
|
30
|
-
};
|
|
31
|
-
error: {
|
|
32
|
-
"01": {
|
|
33
|
-
title: string;
|
|
34
|
-
desc: string;
|
|
35
|
-
};
|
|
36
|
-
"02": {
|
|
37
|
-
title: string;
|
|
38
|
-
desc: string;
|
|
39
|
-
};
|
|
40
|
-
"03": {
|
|
41
|
-
title: string;
|
|
42
|
-
desc: string;
|
|
43
|
-
};
|
|
44
|
-
"04": {
|
|
45
|
-
title: string;
|
|
46
|
-
desc: string;
|
|
47
|
-
};
|
|
48
|
-
"05": {
|
|
49
|
-
title: string;
|
|
50
|
-
desc: string;
|
|
51
|
-
};
|
|
52
|
-
"06": {
|
|
53
|
-
title: string;
|
|
54
|
-
desc: string;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
alternative: {
|
|
58
|
-
hour: string;
|
|
59
|
-
minute: string;
|
|
60
|
-
second: string;
|
|
61
|
-
after: string;
|
|
62
|
-
afterMin: string;
|
|
63
|
-
afterHour: string;
|
|
64
|
-
afterDay: string;
|
|
65
|
-
startPlay: string;
|
|
66
|
-
nextPlay: string;
|
|
67
|
-
afterPlay: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
export default _default;
|