@sgrsoft/vpe-core-sdk 0.8.0 → 0.10.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.
@@ -87,6 +87,14 @@ declare const _default: {
87
87
  title: string;
88
88
  desc: string;
89
89
  };
90
+ '15': {
91
+ title: string;
92
+ desc: string;
93
+ };
94
+ '16': {
95
+ title: string;
96
+ desc: string;
97
+ };
90
98
  };
91
99
  alternative: {
92
100
  hour: string;
@@ -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
- "06": {
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
- "06": {
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
- "03": {
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
  };
@@ -87,6 +87,14 @@ declare const _default: {
87
87
  title: string;
88
88
  desc: string;
89
89
  };
90
+ '15': {
91
+ title: string;
92
+ desc: string;
93
+ };
94
+ '16': {
95
+ title: string;
96
+ desc: string;
97
+ };
90
98
  };
91
99
  alternative: {
92
100
  hour: string;
@@ -87,6 +87,14 @@ declare const _default: {
87
87
  title: string;
88
88
  desc: string;
89
89
  };
90
+ '15': {
91
+ title: string;
92
+ desc: string;
93
+ };
94
+ '16': {
95
+ title: string;
96
+ desc: string;
97
+ };
90
98
  };
91
99
  alternative: {
92
100
  hour: string;
package/dist/main.d.ts CHANGED
@@ -82,6 +82,7 @@ export declare class VpeCore {
82
82
  private readonly stage;
83
83
  private readonly isDev;
84
84
  private readonly translator;
85
+ private errorState;
85
86
  constructor({ accessKey, appId, platform, stage, isDev, language }: VpeCoreOptions);
86
87
  initialize(): Promise<{
87
88
  error: {
@@ -158,6 +159,78 @@ export declare class VpeCore {
158
159
  } | {
159
160
  title: string;
160
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;
161
234
  };
162
235
  };
163
236
  options?: undefined;
@@ -171,6 +244,10 @@ export declare class VpeCore {
171
244
  private getBrowserInfo;
172
245
  private createPlayerInfo;
173
246
  private setErrorRun;
247
+ getErrorState(): {
248
+ errorCode: string | null;
249
+ errorMessage: any;
250
+ };
174
251
  isPaidTier(): boolean;
175
252
  isInitialized(): boolean;
176
253
  getValidatedOptions(options?: Partial<VpePlayerOptions>): VpePlayerOptions;
@@ -180,5 +257,10 @@ export declare class VpeCore {
180
257
  * @param key
181
258
  */
182
259
  $t(key: string): string;
260
+ hlsPaser(url: string): Promise<Array<{
261
+ quality: string;
262
+ url: string;
263
+ levelIndex: number;
264
+ }>>;
183
265
  }
184
266
  export {};
package/dist/options.d.ts CHANGED
@@ -35,6 +35,7 @@ export interface VpePlayerOptions {
35
35
  playIndex?: number;
36
36
  lowLatencyMode?: boolean;
37
37
  descriptionNotVisible?: boolean;
38
+ iosFullscreenNativeMode?: boolean;
38
39
  visibleWatermark?: boolean;
39
40
  watermarkText?: string;
40
41
  watermarkConfig?: {
@@ -1 +1 @@
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."}},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:"화면 캡쳐 / 화면 녹화가 감지되었습니다."}},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:"画面キャプチャ/画面録画が検出されました。"}},alternative:{hour:"時間",minute:"分",second:"秒",after:"しばらくして",afterMin:"分後",afterHour:"時間後",afterDay:"日後",startPlay:"{timeTxt}後に動画が始まります。",nextPlay:"{timeTxt}秒後に次の動画が再生されます。",afterPlay:"予定"}},v={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:"预计"}},d={en:g,ko:m,ja:h,zh:v},S=()=>typeof navigator<"u"&&typeof navigator.language<"u";function b(t){const e=t.split("-")[0];return e in d?e:"en"}function p(t){let e="en";t?e=t:S()&&(e=navigator.language);const n=b(e);return d[n]}p();const M={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"},C={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 I=new Date().getTime(),f=()=>{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()-I;return{logDate:n,logDateUnix:a,thisSec:r}};function P(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function w(t,e){Object.entries(e).forEach(([n,a])=>{P(a)?(t[n]||(t[n]={}),Object.entries(a).forEach(([r,i])=>{i!=null&&(t[n][r]=i)})):a!=null&&(t[n]=a)})}function T(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=T(e),t.isp=e.net||"",t.ip=l.syncResult?.ip||"",t.nation=e.country||"")}catch{}}const B=async t=>{if(!t)return;const{platform:e,stage:n}=l,a=C[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}=f();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 A(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=M[s.extra.nation]||"Korea, Republic of":s.browser.country="Korea, Republic of";const{logDate:i,logDateUnix:o}=f();s.extra.logDate=i,s.extra.logDateUnix=o,s.extra.created_at=o}const L=(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},E={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 N=t=>{try{return atob(t)}catch(e){return console.error("Base64 decoding failed:",e),""}};class D{serverConfig={};playerInfo=null;accessKey;appId;platform;stage;isDev;translator;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)}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 A(this.platform,this.stage,o,this.appId,this.accessKey),await B(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=N(E[this.platform][this.stage][e[1]])+n,r=JSON.stringify([e[4],e[5]].reduce((o,c,y)=>(o[c]=[this.accessKey,this.appId][y],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 console.log("VPE Error : ",r),r}isPaidTier(){return this.serverConfig.result?.pricing==="pay"}isInitialized(){return!!this.serverConfig.result}getValidatedOptions(e){const n=L(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=D;
1
+ "use strict";const h={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"}},v={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:"예정"}},S={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:"予定"}},y={en:h,ko:v,ja:S},b=()=>typeof navigator<"u"&&typeof navigator.language<"u";function M(t){const e=t.split("-")[0];return e in y?e:"en"}function g(t){let e="en";t?e=t:b()&&(e=navigator.language);const a=M(e);return y[a]}g();const C={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"},I={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 c={video:{},browser:{},device:{},connection:{},screen:{},player_version:"latest",extra:{sessionId:null,playerType:"VPE React Native"},log_type:"vpe",privacy:{cookie_enabled:!0}},u={platform:"pub",stage:"prod",sync:!1,syncResult:{}};const w=new Date().getTime(),m=()=>{const t=new Date,e=r=>String(r).padStart(2,"0"),a=`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`,n=Math.floor(t.getTime()/1e3),o=new Date().getTime()-w;return{logDate:a,logDateUnix:n,thisSec:o}};function P(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R(t,e){Object.entries(e).forEach(([a,n])=>{P(n)?(t[a]||(t[a]={}),Object.entries(n).forEach(([o,r])=>{r!=null&&(t[a][o]=r)})):n!=null&&(t[a]=n)})}function T(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 A(t){try{const e=u.syncResult?.geoLocation;e&&(t.address=T(e),t.isp=e.net||"",t.ip=u.syncResult?.ip||"",t.nation=e.country||"")}catch{}}const B=async t=>{if(!t)return;const{platform:e,stage:a}=u,n=I[e][a].log;try{const r=await(await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({access_key:t})})).json();u.sync=r.result?.sync||!1,u.syncResult=r.result||{};const{logDate:i,logDateUnix:s}=m();return c.extra.logDate=i,c.extra.logDateUnix=s,u.syncResult?.geoLocation&&A(c.extra),r}catch(o){return console.error("MA config initialization failed:",o),null}};async function N(t,e,a,n,o){u.platform=t,u.stage=e,R(c,a),n&&(c.extra.vpePackageId=n),o&&(c.extra.vpeKey=o),c.extra.nation?c.browser.country=C[c.extra.nation]||"Korea, Republic of":c.browser.country="Korea, Republic of";const{logDate:r,logDateUnix:i}=m();c.extra.logDate=r,c.extra.logDateUnix=i,c.extra.created_at=i}const L=(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,iosFullscreenNativeMode:!0,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},a={...e,...t};return t.controlBtn&&(a.controlBtn={...e.controlBtn,...t.controlBtn}),t.watermarkConfig&&(a.watermarkConfig={...e.watermarkConfig,...t.watermarkConfig}),t.captionStyle&&(a.captionStyle={...e.captionStyle,...t.captionStyle}),a.objectFit==="fill"&&(a.objectFit="stretch"),a.controlBtn?.progressBar===void 0&&(a.controlBtn.progressBar=!0),a},E={gov:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5nb3YtbnRydXNzLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cudnBlLmdvdi1udHJ1c3MuY29tL3N0YXRz"},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLmdvdi1udHJ1c3MuY29tL3BsYXllci9jb25maWc=",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUuZ292LW50cnVzcy5jb20vc3RhdHM="}},pub:{prod:{config:"aHR0cHM6Ly9wYXBpLnZwZS5uYXZlcm5jcC5jb20vcGxheWVyL2NvbmZpZw==",report:"aHR0cHM6Ly9sb2cudnBlLm5hdmVybmNwLmNvbS9zdGF0cw=="},beta:{config:"aHR0cHM6Ly9wYXBpLmJldGEtdnBlLm5hdmVybmNwLmNvbS9wbGF5ZXIvY29uZmln",report:"aHR0cHM6Ly9sb2cuYmV0YS12cGUubmF2ZXJuY3AuY29tL3N0YXRz"}}};let f=[];const D=t=>{try{return atob(t)}catch(e){return console.error("Base64 decoding failed:",e),""}};class k{serverConfig={};playerInfo=null;accessKey;appId;platform;stage;isDev;translator;errorState;constructor({accessKey:e,appId:a,platform:n,stage:o,isDev:r=!1,language:i}){this.accessKey=e,this.appId=a||location.origin,this.platform=n,this.stage=o,this.isDev=r,this.translator=g(i),this.errorState={errorCode:null,errorMessage:null}}async initialize(){const e=["accessKey","appId","E0002","E0001","E0003"],a="VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다.";if([this[e[0]],this[e[1]]].some(r=>!r))return console.warn(a),{error:this.setErrorRun(e[2])};const o=r=>(this.serverConfig=r,this.playerInfo=this.createPlayerInfo(r),this.playerInfo);try{const r=await this.performKeyCheck();if(r.code!==200)return{error:this.setErrorRun(e[3])};const i=o(r);return await N(this.platform,this.stage,i,this.appId,this.accessKey),await B(this.accessKey),{options:this.serverConfig.result?.options,playerInfo:i}}catch(r){return console.error("VPE SDK Initialization failed:",r),{error:this.setErrorRun(e[4])}}}async performKeyCheck(){const e=["?preview=true","config","Content-Type","application/json","access_key","domain","POST"],a=this.isDev?e[0]:"",n=D(E[this.platform][this.stage][e[1]])+a,o=JSON.stringify([e[4],e[5]].reduce((i,s,l)=>(i[s]=[this.accessKey,this.appId][l],i),{})),r=await fetch(n,{method:e[6],headers:{[e[2]]:e[3]},body:o});if(!r.ok)throw new Error(["API","Error:",r.status,r.statusText].join(" "));return r.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[a,n]=e.result.name.split("|"),o=navigator.connection||navigator.mozConnection||navigator.webkitConnection,r=this.getBrowserInfo(),i=navigator.userAgentData;return{cid:e.result.cid,player_name:a,player_version:n,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:o?.effectiveType??"unknown",downlink:o?.downlink??null,rtt:o?.rtt??null,save_data:o?.saveData??!1},device:{platform:i?.platform??"Unknown",mobile:i?.mobile??!1,memory:navigator.deviceMemory??null,processor:navigator.hardwareConcurrency??null},video:{url:""},extra:{vpeKey:this.accessKey,playerType:"VPE",playerVersion:n,device:i?.platform??"Unknown",os:i?.platform??"Unknown",osOrigin:i?.platform??"Unknown",osVersion:i?.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}&${i?.platform??"Unknown"}&${i?.platformVersion??"Unknown"}`,location:`${this.appId}://appView/video/vpe`,title:""}}}setErrorRun(e){const a=e.slice(-2),n=this.translator.error[a]||this.translator.error["01"],o={errorCode:e,errorMessage:n};return this.errorState=o,console.error("ncplayer : ",o),o}getErrorState(){return this.errorState}isPaidTier(){return this.serverConfig.result?.pricing==="pay"}isInitialized(){return!!this.serverConfig.result}getValidatedOptions(e){const a=L(this.serverConfig.result?.options?.options),n={...a,...e??{}};return e?.controlBtn&&(n.controlBtn={...a.controlBtn,...e.controlBtn}),e?.watermarkConfig&&(n.watermarkConfig={...a.watermarkConfig,...e.watermarkConfig}),n.playlist&&!Array.isArray(n.playlist)&&(n.playlist=[{file:n.playlist}]),f=n.playlist||[],n}getPlaylist(){return f||[]}$t(e){const a=e.split(".");let n=this.translator;for(const o of a)if(n&&typeof n=="object"&&o in n)n=n[o];else return e;return typeof n=="string"?n:e}async hlsPaser(e){const a=[];if(!e||e.indexOf(".m3u8")===-1)return a;const n=(i,s)=>{try{return new URL(s,i).toString()}catch{return s}},o=i=>{const s=i.match(/RESOLUTION=(\d+)x(\d+)/);if(s)return`${s[2]}p`;const l=i.match(/BANDWIDTH=(\d+)/);return l?`${Math.round(Number(l[1])/1e3)}kbps`:"auto"},r=i=>{const s=i.split(/\r?\n/).map(l=>l.trim()).filter(l=>l.length>0);for(let l=0;l<s.length;l+=1){const p=s[l];if(p.startsWith("#EXT-X-STREAM-INF")){const d=s[l+1];d&&!d.startsWith("#")&&(a.push({quality:o(p),url:n(e,d),levelIndex:a.length}),l+=1)}}};try{const i=await fetch(e);if(!i.ok)return a;const s=await i.text();return s&&r(s),a}catch(i){return console.error("HLS 파싱 실패:",i),a}}}module.exports=k;
@@ -1,4 +1,4 @@
1
- const g = {
1
+ const h = {
2
2
  common: {
3
3
  cancel: "Cancel",
4
4
  auto: "Auto",
@@ -50,6 +50,14 @@ const g = {
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 g = {
64
72
  nextPlay: "Next video will play in {timeTxt} seconds.",
65
73
  afterPlay: "Scheduled"
66
74
  }
67
- }, m = {
75
+ }, v = {
68
76
  common: {
69
77
  cancel: "취소",
70
78
  auto: "자동",
@@ -152,6 +160,14 @@ const g = {
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 g = {
166
182
  nextPlay: "{timeTxt}초 후 다음 영상이 재생됩니다.",
167
183
  afterPlay: "예정"
168
184
  }
169
- }, h = {
185
+ }, S = {
170
186
  common: {
171
187
  cancel: "キャンセル",
172
188
  auto: "自動",
@@ -215,6 +231,14 @@ const g = {
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 g = {
229
253
  nextPlay: "{timeTxt}秒後に次の動画が再生されます。",
230
254
  afterPlay: "予定"
231
255
  }
232
- }, v = {
233
- common: {
234
- cancel: "取消",
235
- auto: "自动",
236
- normal: "一般",
237
- notUse: "不使用",
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
- }, d = {
301
- en: g,
302
- ko: m,
303
- ja: h,
304
- zh: v
305
- }, S = () => typeof navigator < "u" && typeof navigator.language < "u";
306
- function b(t) {
256
+ }, y = {
257
+ en: h,
258
+ ko: v,
259
+ ja: S
260
+ }, b = () => typeof navigator < "u" && typeof navigator.language < "u";
261
+ function M(t) {
307
262
  const e = t.split("-")[0];
308
- return e in d ? e : "en";
263
+ return e in y ? e : "en";
309
264
  }
310
- function p(t) {
265
+ function g(t) {
311
266
  let e = "en";
312
- t ? e = t : S() && (e = navigator.language);
313
- const n = b(e);
314
- return d[n];
267
+ t ? e = t : b() && (e = navigator.language);
268
+ const a = M(e);
269
+ return y[a];
315
270
  }
316
- p();
317
- const M = {
271
+ g();
272
+ const C = {
318
273
  AF: "Afghanistan",
319
274
  AX: "Åland Islands",
320
275
  AL: "Albania",
@@ -564,7 +519,7 @@ const M = {
564
519
  YE: "Yemen",
565
520
  ZM: "Zambia",
566
521
  ZW: "Zimbabwe"
567
- }, C = {
522
+ }, I = {
568
523
  gov: {
569
524
  prod: {
570
525
  log: "https://papi.vpe.gov-ntruss.com/player/maSync",
@@ -586,7 +541,7 @@ const M = {
586
541
  }
587
542
  }
588
543
  };
589
- let s = {
544
+ let c = {
590
545
  video: {},
591
546
  browser: {},
592
547
  device: {},
@@ -601,46 +556,46 @@ let s = {
601
556
  privacy: {
602
557
  cookie_enabled: !0
603
558
  }
604
- }, l = {
559
+ }, u = {
605
560
  platform: "pub",
606
561
  stage: "prod",
607
562
  sync: !1,
608
563
  syncResult: {}
609
564
  };
610
- const I = (/* @__PURE__ */ new Date()).getTime(), f = () => {
611
- 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() - I;
565
+ const w = (/* @__PURE__ */ new Date()).getTime(), m = () => {
566
+ const t = /* @__PURE__ */ new Date(), e = (r) => String(r).padStart(2, "0"), a = `${t.getFullYear()}-${e(t.getMonth() + 1)}-${e(t.getDate())} ${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`, n = Math.floor(t.getTime() / 1e3), o = (/* @__PURE__ */ new Date()).getTime() - w;
612
567
  return {
613
- logDate: n,
614
- logDateUnix: a,
615
- thisSec: r
568
+ logDate: a,
569
+ logDateUnix: n,
570
+ thisSec: o
616
571
  };
617
572
  };
618
573
  function P(t) {
619
574
  return typeof t == "object" && t !== null && !Array.isArray(t);
620
575
  }
621
- function w(t, e) {
622
- Object.entries(e).forEach(([n, a]) => {
623
- P(a) ? (t[n] || (t[n] = {}), Object.entries(a).forEach(([r, i]) => {
624
- i != null && (t[n][r] = i);
625
- })) : a != null && (t[n] = a);
576
+ function R(t, e) {
577
+ Object.entries(e).forEach(([a, n]) => {
578
+ P(n) ? (t[a] || (t[a] = {}), Object.entries(n).forEach(([o, r]) => {
579
+ r != null && (t[a][o] = r);
580
+ })) : n != null && (t[a] = n);
626
581
  });
627
582
  }
628
583
  function T(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 R(t) {
587
+ function A(t) {
633
588
  try {
634
- const e = l.syncResult?.geoLocation;
635
- e && (t.address = T(e), t.isp = e.net || "", t.ip = l.syncResult?.ip || "", t.nation = e.country || "");
589
+ const e = u.syncResult?.geoLocation;
590
+ e && (t.address = T(e), t.isp = e.net || "", t.ip = u.syncResult?.ip || "", t.nation = e.country || "");
636
591
  } catch {
637
592
  }
638
593
  }
639
594
  const B = async (t) => {
640
595
  if (!t) return;
641
- const { platform: e, stage: n } = l, a = C[e][n].log;
596
+ const { platform: e, stage: a } = u, n = I[e][a].log;
642
597
  try {
643
- const i = await (await fetch(a, {
598
+ const r = await (await fetch(n, {
644
599
  method: "POST",
645
600
  headers: {
646
601
  "Content-Type": "application/json"
@@ -649,17 +604,17 @@ const B = async (t) => {
649
604
  access_key: t
650
605
  })
651
606
  })).json();
652
- l.sync = i.result?.sync || !1, l.syncResult = i.result || {};
653
- const { logDate: o, logDateUnix: c } = f();
654
- return s.extra.logDate = o, s.extra.logDateUnix = c, l.syncResult?.geoLocation && R(s.extra), i;
655
- } catch (r) {
656
- return console.error("MA config initialization failed:", r), null;
607
+ u.sync = r.result?.sync || !1, u.syncResult = r.result || {};
608
+ const { logDate: i, logDateUnix: s } = m();
609
+ return c.extra.logDate = i, c.extra.logDateUnix = s, u.syncResult?.geoLocation && A(c.extra), r;
610
+ } catch (o) {
611
+ return console.error("MA config initialization failed:", o), null;
657
612
  }
658
613
  };
659
- async function A(t, e, n, a, r) {
660
- 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 = M[s.extra.nation] || "Korea, Republic of" : s.browser.country = "Korea, Republic of";
661
- const { logDate: i, logDateUnix: o } = f();
662
- s.extra.logDate = i, s.extra.logDateUnix = o, s.extra.created_at = o;
614
+ async function N(t, e, a, n, o) {
615
+ u.platform = t, u.stage = e, R(c, a), n && (c.extra.vpePackageId = n), o && (c.extra.vpeKey = o), c.extra.nation ? c.browser.country = C[c.extra.nation] || "Korea, Republic of" : c.browser.country = "Korea, Republic of";
616
+ const { logDate: r, logDateUnix: i } = m();
617
+ c.extra.logDate = r, c.extra.logDateUnix = i, c.extra.created_at = i;
663
618
  }
664
619
  const L = (t = {}) => {
665
620
  const e = {
@@ -699,6 +654,7 @@ const L = (t = {}) => {
699
654
  devTestAppId: void 0,
700
655
  token: "",
701
656
  visibleWatermark: !1,
657
+ iosFullscreenNativeMode: !0,
702
658
  watermarkText: "NAVER CLOUD PLATFORM",
703
659
  watermarkConfig: {
704
660
  randPosition: !0,
@@ -714,17 +670,17 @@ const L = (t = {}) => {
714
670
  edgeStyle: "dropshadow"
715
671
  },
716
672
  override: null
717
- }, n = { ...e, ...t };
718
- return t.controlBtn && (n.controlBtn = {
673
+ }, a = { ...e, ...t };
674
+ return t.controlBtn && (a.controlBtn = {
719
675
  ...e.controlBtn,
720
676
  ...t.controlBtn
721
- }), t.watermarkConfig && (n.watermarkConfig = {
677
+ }), t.watermarkConfig && (a.watermarkConfig = {
722
678
  ...e.watermarkConfig,
723
679
  ...t.watermarkConfig
724
- }), t.captionStyle && (n.captionStyle = {
680
+ }), t.captionStyle && (a.captionStyle = {
725
681
  ...e.captionStyle,
726
682
  ...t.captionStyle
727
- }), n.objectFit === "fill" && (n.objectFit = "stretch"), n.controlBtn?.progressBar === void 0 && (n.controlBtn.progressBar = !0), n;
683
+ }), a.objectFit === "fill" && (a.objectFit = "stretch"), a.controlBtn?.progressBar === void 0 && (a.controlBtn.progressBar = !0), a;
728
684
  }, E = {
729
685
  gov: {
730
686
  prod: {
@@ -747,15 +703,15 @@ const L = (t = {}) => {
747
703
  }
748
704
  }
749
705
  };
750
- let u = [];
751
- const N = (t) => {
706
+ let f = [];
707
+ const D = (t) => {
752
708
  try {
753
709
  return atob(t);
754
710
  } catch (e) {
755
711
  return console.error("Base64 decoding failed:", e), "";
756
712
  }
757
713
  };
758
- class D {
714
+ class k {
759
715
  serverConfig = {};
760
716
  playerInfo = null;
761
717
  accessKey;
@@ -764,49 +720,58 @@ class D {
764
720
  stage;
765
721
  isDev;
766
722
  translator;
767
- constructor({ accessKey: e, appId: n, platform: a, stage: r, isDev: i = !1, language: o }) {
768
- this.accessKey = e, this.appId = n || location.origin, this.platform = a, this.stage = r, this.isDev = i, this.translator = p(o);
723
+ errorState;
724
+ // SDK 초기화에 필요한 기본 옵션을 보관한다.
725
+ constructor({ accessKey: e, appId: a, platform: n, stage: o, isDev: r = !1, language: i }) {
726
+ this.accessKey = e, this.appId = a || location.origin, this.platform = n, this.stage = o, this.isDev = r, this.translator = g(i), this.errorState = {
727
+ errorCode: null,
728
+ errorMessage: null
729
+ };
769
730
  }
731
+ // 인증 키를 확인하고 서버 설정 및 MA를 초기화한다.
770
732
  async initialize() {
771
- const e = ["accessKey", "appId", "E0002", "E0001", "E0003"], n = "VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다.";
772
- if ([this[e[0]], this[e[1]]].some((i) => !i))
773
- return console.warn(n), { error: this.setErrorRun(e[2]) };
774
- const r = (i) => (this.serverConfig = i, this.playerInfo = this.createPlayerInfo(i), this.playerInfo);
733
+ const e = ["accessKey", "appId", "E0002", "E0001", "E0003"], a = "VPE Player: accessKey 또는 appId가 없어 키 인증을 건너뜁니다.";
734
+ if ([this[e[0]], this[e[1]]].some((r) => !r))
735
+ return console.warn(a), { error: this.setErrorRun(e[2]) };
736
+ const o = (r) => (this.serverConfig = r, this.playerInfo = this.createPlayerInfo(r), this.playerInfo);
775
737
  try {
776
- const i = await this.performKeyCheck();
777
- if (i.code !== 200)
738
+ const r = await this.performKeyCheck();
739
+ if (r.code !== 200)
778
740
  return { error: this.setErrorRun(e[3]) };
779
- const o = r(i);
780
- return await A(this.platform, this.stage, o, this.appId, this.accessKey), await B(this.accessKey), {
741
+ const i = o(r);
742
+ return await N(this.platform, this.stage, i, this.appId, this.accessKey), await B(this.accessKey), {
781
743
  options: this.serverConfig.result?.options,
782
- playerInfo: o
744
+ playerInfo: i
783
745
  };
784
- } catch (i) {
785
- return console.error("VPE SDK Initialization failed:", i), { error: this.setErrorRun(e[4]) };
746
+ } catch (r) {
747
+ return console.error("VPE SDK Initialization failed:", r), { error: this.setErrorRun(e[4]) };
786
748
  }
787
749
  }
750
+ // AccessKey 유효성을 검사하기 위해 서버에 구성 정보를 요청한다.
788
751
  async performKeyCheck() {
789
- const e = ["?preview=true", "config", "Content-Type", "application/json", "access_key", "domain", "POST"], n = this.isDev ? e[0] : "", a = N(E[this.platform][this.stage][e[1]]) + n, r = JSON.stringify(
790
- [e[4], e[5]].reduce((o, c, y) => (o[c] = [this.accessKey, this.appId][y], o), {})
791
- ), i = await fetch(a, {
752
+ const e = ["?preview=true", "config", "Content-Type", "application/json", "access_key", "domain", "POST"], a = this.isDev ? e[0] : "", n = D(E[this.platform][this.stage][e[1]]) + a, o = JSON.stringify(
753
+ [e[4], e[5]].reduce((i, s, l) => (i[s] = [this.accessKey, this.appId][l], i), {})
754
+ ), r = await fetch(n, {
792
755
  method: e[6],
793
756
  headers: { [e[2]]: e[3] },
794
- body: r
757
+ body: o
795
758
  });
796
- if (!i.ok)
797
- throw new Error(["API", "Error:", i.status, i.statusText].join(" "));
798
- return i.json();
759
+ if (!r.ok)
760
+ throw new Error(["API", "Error:", r.status, r.statusText].join(" "));
761
+ return r.json();
799
762
  }
763
+ // 브라우저 UA 문자열을 파싱해 종류와 버전을 반환한다.
800
764
  getBrowserInfo() {
801
765
  const e = navigator.userAgent;
802
766
  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" };
803
767
  }
768
+ // 서버에서 받은 정보와 클라이언트 환경을 합쳐 PlayerInfo를 구성한다.
804
769
  createPlayerInfo(e) {
805
- const [n, a] = e.result.name.split("|"), r = navigator.connection || navigator.mozConnection || navigator.webkitConnection, i = this.getBrowserInfo(), o = navigator.userAgentData;
770
+ const [a, n] = e.result.name.split("|"), o = navigator.connection || navigator.mozConnection || navigator.webkitConnection, r = this.getBrowserInfo(), i = navigator.userAgentData;
806
771
  return {
807
772
  cid: e.result.cid,
808
- player_name: n,
809
- player_version: a,
773
+ player_name: a,
774
+ player_version: n,
810
775
  pricing: e.result.pricing,
811
776
  maUse: e.result.options?.maUse === "Y" ? "Y" : "N",
812
777
  browser: {
@@ -818,14 +783,14 @@ class D {
818
783
  height: window.screen.height
819
784
  },
820
785
  connection: {
821
- network: r?.effectiveType ?? "unknown",
822
- downlink: r?.downlink ?? null,
823
- rtt: r?.rtt ?? null,
824
- save_data: r?.saveData ?? !1
786
+ network: o?.effectiveType ?? "unknown",
787
+ downlink: o?.downlink ?? null,
788
+ rtt: o?.rtt ?? null,
789
+ save_data: o?.saveData ?? !1
825
790
  },
826
791
  device: {
827
- platform: o?.platform ?? "Unknown",
828
- mobile: o?.mobile ?? !1,
792
+ platform: i?.platform ?? "Unknown",
793
+ mobile: i?.mobile ?? !1,
829
794
  memory: navigator.deviceMemory ?? null,
830
795
  processor: navigator.hardwareConcurrency ?? null
831
796
  },
@@ -833,61 +798,111 @@ class D {
833
798
  extra: {
834
799
  vpeKey: this.accessKey,
835
800
  playerType: "VPE",
836
- playerVersion: a,
837
- device: o?.platform ?? "Unknown",
838
- os: o?.platform ?? "Unknown",
839
- osOrigin: o?.platform ?? "Unknown",
840
- osVersion: o?.platformVersion ?? "Unknown",
801
+ playerVersion: n,
802
+ device: i?.platform ?? "Unknown",
803
+ os: i?.platform ?? "Unknown",
804
+ osOrigin: i?.platform ?? "Unknown",
805
+ osVersion: i?.platformVersion ?? "Unknown",
841
806
  vpePackageId: this.appId,
842
807
  actionDuration: 0,
843
808
  actionType: "ready",
844
- browser: i.origin,
845
- browserOrigin: i.origin,
846
- browserVersion: i.version,
809
+ browser: r.origin,
810
+ browserOrigin: r.origin,
811
+ browserVersion: r.version,
847
812
  protocol: location.protocol,
848
813
  quality: "Other",
849
814
  qualityOrigin: "Auto",
850
- host: `${this.appId}&${o?.platform ?? "Unknown"}&${o?.platformVersion ?? "Unknown"}`,
815
+ host: `${this.appId}&${i?.platform ?? "Unknown"}&${i?.platformVersion ?? "Unknown"}`,
851
816
  location: `${this.appId}://appView/video/vpe`,
852
817
  title: ""
853
818
  }
854
819
  };
855
820
  }
821
+ // 에러 코드를 번역하고 공통 포맷으로 반환한다.
856
822
  setErrorRun(e) {
857
- const n = e.slice(-2), a = this.translator.error[n] || this.translator.error["01"], r = {
823
+ const a = e.slice(-2), n = this.translator.error[a] || this.translator.error["01"], o = {
858
824
  errorCode: e,
859
- errorMessage: a
825
+ errorMessage: n
860
826
  };
861
- return console.log("VPE Error : ", r), r;
827
+ return this.errorState = o, console.error("ncplayer : ", o), o;
828
+ }
829
+ // 마지막 에러 상태를 반환한다.
830
+ getErrorState() {
831
+ return this.errorState;
862
832
  }
833
+ // 현재 요금제가 유료인지 여부를 반환한다.
863
834
  isPaidTier() {
864
835
  return this.serverConfig.result?.pricing === "pay";
865
836
  }
837
+ // 서버 설정이 존재해 초기화가 완료되었는지 확인한다.
866
838
  isInitialized() {
867
839
  return !!this.serverConfig.result;
868
840
  }
841
+ // 서버 옵션과 전달된 옵션을 병합해 유효한 플레이어 옵션을 생성한다.
869
842
  getValidatedOptions(e) {
870
- const n = L(this.serverConfig.result?.options?.options), a = { ...n, ...e ?? {} };
871
- 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;
843
+ const a = L(this.serverConfig.result?.options?.options), n = { ...a, ...e ?? {} };
844
+ return e?.controlBtn && (n.controlBtn = { ...a.controlBtn, ...e.controlBtn }), e?.watermarkConfig && (n.watermarkConfig = { ...a.watermarkConfig, ...e.watermarkConfig }), n.playlist && !Array.isArray(n.playlist) && (n.playlist = [{ file: n.playlist }]), f = n.playlist || [], n;
872
845
  }
846
+ // 정규화된 플레이리스트를 반환한다.
873
847
  getPlaylist() {
874
- return u || [];
848
+ return f || [];
875
849
  }
876
850
  /**
877
851
  *
878
852
  * @param key
879
853
  */
854
+ // 다국어 키를 점 표기법으로 찾아 문자열을 반환한다.
880
855
  $t(e) {
881
- const n = e.split(".");
882
- let a = this.translator;
883
- for (const r of n)
884
- if (a && typeof a == "object" && r in a)
885
- a = a[r];
856
+ const a = e.split(".");
857
+ let n = this.translator;
858
+ for (const o of a)
859
+ if (n && typeof n == "object" && o in n)
860
+ n = n[o];
886
861
  else
887
862
  return e;
888
- return typeof a == "string" ? a : e;
863
+ return typeof n == "string" ? n : e;
864
+ }
865
+ async hlsPaser(e) {
866
+ const a = [];
867
+ if (!e || e.indexOf(".m3u8") === -1)
868
+ return a;
869
+ const n = (i, s) => {
870
+ try {
871
+ return new URL(s, i).toString();
872
+ } catch {
873
+ return s;
874
+ }
875
+ }, o = (i) => {
876
+ const s = i.match(/RESOLUTION=(\d+)x(\d+)/);
877
+ if (s)
878
+ return `${s[2]}p`;
879
+ const l = i.match(/BANDWIDTH=(\d+)/);
880
+ return l ? `${Math.round(Number(l[1]) / 1e3)}kbps` : "auto";
881
+ }, r = (i) => {
882
+ const s = i.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
883
+ for (let l = 0; l < s.length; l += 1) {
884
+ const p = s[l];
885
+ if (p.startsWith("#EXT-X-STREAM-INF")) {
886
+ const d = s[l + 1];
887
+ d && !d.startsWith("#") && (a.push({
888
+ quality: o(p),
889
+ url: n(e, d),
890
+ levelIndex: a.length
891
+ }), l += 1);
892
+ }
893
+ }
894
+ };
895
+ try {
896
+ const i = await fetch(e);
897
+ if (!i.ok)
898
+ return a;
899
+ const s = await i.text();
900
+ return s && r(s), a;
901
+ } catch (i) {
902
+ return console.error("HLS 파싱 실패:", i), a;
903
+ }
889
904
  }
890
905
  }
891
906
  export {
892
- D as default
907
+ k as default
893
908
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sgrsoft/vpe-core-sdk",
3
3
  "private": false,
4
- "version": "0.8.0",
4
+ "version": "0.10.0",
5
5
  "type": "module",
6
6
  "main": "dist/vpe-core-sdk.cjs.js",
7
7
  "module": "dist/vpe-core-sdk.es.js",
@@ -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;