@sgrsoft/vpe-core-sdk 0.6.0 → 0.8.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/maManager.d.ts +1 -1
- package/dist/main.d.ts +87 -4
- package/dist/options.d.ts +5 -4
- package/dist/vpe-core-sdk.cjs.js +1 -1
- package/dist/vpe-core-sdk.es.js +94 -85
- package/package.json +8 -6
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/maManager.d.ts
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Language } from './locales/i18n';
|
|
2
|
-
import {
|
|
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;
|
|
@@ -76,7 +86,79 @@ export declare class VpeCore {
|
|
|
76
86
|
initialize(): Promise<{
|
|
77
87
|
error: {
|
|
78
88
|
errorCode: string;
|
|
79
|
-
errorMessage:
|
|
89
|
+
errorMessage: {
|
|
90
|
+
title: string;
|
|
91
|
+
desc: string;
|
|
92
|
+
} | {
|
|
93
|
+
title: string;
|
|
94
|
+
desc: string;
|
|
95
|
+
} | {
|
|
96
|
+
title: string;
|
|
97
|
+
desc: string;
|
|
98
|
+
} | {
|
|
99
|
+
title: string;
|
|
100
|
+
desc: string;
|
|
101
|
+
} | {
|
|
102
|
+
title: string;
|
|
103
|
+
desc: string;
|
|
104
|
+
} | {
|
|
105
|
+
title: string;
|
|
106
|
+
desc: string;
|
|
107
|
+
} | {
|
|
108
|
+
title: string;
|
|
109
|
+
desc: string;
|
|
110
|
+
} | {
|
|
111
|
+
title: string;
|
|
112
|
+
desc: string;
|
|
113
|
+
} | {
|
|
114
|
+
title: string;
|
|
115
|
+
desc: string;
|
|
116
|
+
} | {
|
|
117
|
+
title: string;
|
|
118
|
+
desc: string;
|
|
119
|
+
} | {
|
|
120
|
+
title: string;
|
|
121
|
+
desc: string;
|
|
122
|
+
} | {
|
|
123
|
+
title: string;
|
|
124
|
+
desc: string;
|
|
125
|
+
} | {
|
|
126
|
+
title: string;
|
|
127
|
+
desc: string;
|
|
128
|
+
} | {
|
|
129
|
+
title: string;
|
|
130
|
+
desc: string;
|
|
131
|
+
} | {
|
|
132
|
+
title: string;
|
|
133
|
+
desc: string;
|
|
134
|
+
} | {
|
|
135
|
+
title: string;
|
|
136
|
+
desc: string;
|
|
137
|
+
} | {
|
|
138
|
+
title: string;
|
|
139
|
+
desc: string;
|
|
140
|
+
} | {
|
|
141
|
+
title: string;
|
|
142
|
+
desc: string;
|
|
143
|
+
} | {
|
|
144
|
+
title: string;
|
|
145
|
+
desc: string;
|
|
146
|
+
} | {
|
|
147
|
+
title: string;
|
|
148
|
+
desc: string;
|
|
149
|
+
} | {
|
|
150
|
+
title: string;
|
|
151
|
+
desc: string;
|
|
152
|
+
} | {
|
|
153
|
+
title: string;
|
|
154
|
+
desc: string;
|
|
155
|
+
} | {
|
|
156
|
+
title: string;
|
|
157
|
+
desc: string;
|
|
158
|
+
} | {
|
|
159
|
+
title: string;
|
|
160
|
+
desc: string;
|
|
161
|
+
};
|
|
80
162
|
};
|
|
81
163
|
options?: undefined;
|
|
82
164
|
playerInfo?: undefined;
|
|
@@ -91,7 +173,8 @@ export declare class VpeCore {
|
|
|
91
173
|
private setErrorRun;
|
|
92
174
|
isPaidTier(): boolean;
|
|
93
175
|
isInitialized(): boolean;
|
|
94
|
-
getValidatedOptions(options?: Partial<
|
|
176
|
+
getValidatedOptions(options?: Partial<VpePlayerOptions>): VpePlayerOptions;
|
|
177
|
+
getPlaylist(): PlaylistItem[];
|
|
95
178
|
/**
|
|
96
179
|
*
|
|
97
180
|
* @param key
|
package/dist/options.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface VpePlayerOptions {
|
|
|
5
5
|
autostart?: boolean;
|
|
6
6
|
muted?: boolean;
|
|
7
7
|
aspectRatio?: string;
|
|
8
|
-
objectFit?: 'contain' | 'cover' | 'fill' | 'scale-down';
|
|
8
|
+
objectFit?: 'contain' | 'cover' | 'fill' | 'scale-down' | 'stretch';
|
|
9
9
|
controls?: boolean;
|
|
10
10
|
allowsPictureInPicture?: boolean;
|
|
11
11
|
staysActiveInBackground?: boolean;
|
|
@@ -47,7 +47,7 @@ export interface VpePlayerOptions {
|
|
|
47
47
|
devTestAppId?: string;
|
|
48
48
|
token?: string;
|
|
49
49
|
override?: any;
|
|
50
|
-
captionStyle
|
|
50
|
+
captionStyle?: VpePlayerCaptionStyle;
|
|
51
51
|
}
|
|
52
52
|
export interface VpePlayerCaptionStyle {
|
|
53
53
|
fontSize?: number;
|
|
@@ -75,7 +75,7 @@ export interface VpePlayerEvents {
|
|
|
75
75
|
error?: (data: any) => void;
|
|
76
76
|
}
|
|
77
77
|
export interface VpePlayerProps {
|
|
78
|
-
options?: VpePlayerOptions
|
|
78
|
+
options?: Partial<VpePlayerOptions>;
|
|
79
79
|
events?: VpePlayerEvents;
|
|
80
80
|
accessKey?: string;
|
|
81
81
|
devTestAppId?: string;
|
|
@@ -87,10 +87,11 @@ export interface VpePlayerProps {
|
|
|
87
87
|
override?: any;
|
|
88
88
|
icon?: any;
|
|
89
89
|
isDev?: any;
|
|
90
|
+
maUse?: 'Y' | 'N';
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
93
|
* 사용자가 전달한 옵션과 기본 옵션을 병합하여 완전한 옵션 객체를 반환합니다.
|
|
93
94
|
* @param options - 사용자가 VpePlayer에 전달한 옵션 객체
|
|
94
95
|
* @returns 기본값이 채워진 완전한 옵션 객체
|
|
95
96
|
*/
|
|
96
|
-
export declare const getValidatedOptions: (options?: VpePlayerOptions) => VpePlayerOptions;
|
|
97
|
+
export declare const getValidatedOptions: (options?: Partial<VpePlayerOptions>) => VpePlayerOptions;
|
package/dist/vpe-core-sdk.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});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.browser.lang=S[s.extra.nation]||"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:null,playIndex:0,lowLatencyMode:!0,touchGestures:!0,descriptionNotVisible:!1,devTestAppId:null,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==null&&(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),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}}exports.default=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."}},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;
|
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",
|
|
@@ -64,7 +64,7 @@ const f = {
|
|
|
64
64
|
nextPlay: "Next video will play in {timeTxt} seconds.",
|
|
65
65
|
afterPlay: "Scheduled"
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, m = {
|
|
68
68
|
common: {
|
|
69
69
|
cancel: "취소",
|
|
70
70
|
auto: "자동",
|
|
@@ -166,7 +166,7 @@ const f = {
|
|
|
166
166
|
nextPlay: "{timeTxt}초 후 다음 영상이 재생됩니다.",
|
|
167
167
|
afterPlay: "예정"
|
|
168
168
|
}
|
|
169
|
-
},
|
|
169
|
+
}, h = {
|
|
170
170
|
common: {
|
|
171
171
|
cancel: "キャンセル",
|
|
172
172
|
auto: "自動",
|
|
@@ -229,7 +229,7 @@ const f = {
|
|
|
229
229
|
nextPlay: "{timeTxt}秒後に次の動画が再生されます。",
|
|
230
230
|
afterPlay: "予定"
|
|
231
231
|
}
|
|
232
|
-
},
|
|
232
|
+
}, v = {
|
|
233
233
|
common: {
|
|
234
234
|
cancel: "取消",
|
|
235
235
|
auto: "自动",
|
|
@@ -297,24 +297,24 @@ const f = {
|
|
|
297
297
|
nextPlay: "{timeTxt}秒后,将播放下一个视频。",
|
|
298
298
|
afterPlay: "预计"
|
|
299
299
|
}
|
|
300
|
-
},
|
|
301
|
-
en:
|
|
302
|
-
ko:
|
|
303
|
-
ja:
|
|
304
|
-
zh:
|
|
305
|
-
},
|
|
306
|
-
function
|
|
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) {
|
|
307
307
|
const e = t.split("-")[0];
|
|
308
|
-
return e in
|
|
308
|
+
return e in d ? e : "en";
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function p(t) {
|
|
311
311
|
let e = "en";
|
|
312
|
-
t ? e = t :
|
|
313
|
-
const n =
|
|
314
|
-
return
|
|
312
|
+
t ? e = t : S() && (e = navigator.language);
|
|
313
|
+
const n = b(e);
|
|
314
|
+
return d[n];
|
|
315
315
|
}
|
|
316
|
-
|
|
317
|
-
const
|
|
316
|
+
p();
|
|
317
|
+
const M = {
|
|
318
318
|
AF: "Afghanistan",
|
|
319
319
|
AX: "Åland Islands",
|
|
320
320
|
AL: "Albania",
|
|
@@ -564,7 +564,7 @@ const S = {
|
|
|
564
564
|
YE: "Yemen",
|
|
565
565
|
ZM: "Zambia",
|
|
566
566
|
ZW: "Zimbabwe"
|
|
567
|
-
},
|
|
567
|
+
}, C = {
|
|
568
568
|
gov: {
|
|
569
569
|
prod: {
|
|
570
570
|
log: "https://papi.vpe.gov-ntruss.com/player/maSync",
|
|
@@ -607,40 +607,40 @@ let s = {
|
|
|
607
607
|
sync: !1,
|
|
608
608
|
syncResult: {}
|
|
609
609
|
};
|
|
610
|
-
const
|
|
611
|
-
const t = /* @__PURE__ */ new Date(), e = (
|
|
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;
|
|
612
612
|
return {
|
|
613
613
|
logDate: n,
|
|
614
614
|
logDateUnix: a,
|
|
615
|
-
thisSec:
|
|
615
|
+
thisSec: r
|
|
616
616
|
};
|
|
617
617
|
};
|
|
618
|
-
function
|
|
618
|
+
function P(t) {
|
|
619
619
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function w(t, e) {
|
|
622
622
|
Object.entries(e).forEach(([n, a]) => {
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
P(a) ? (t[n] || (t[n] = {}), Object.entries(a).forEach(([r, i]) => {
|
|
624
|
+
i != null && (t[n][r] = i);
|
|
625
625
|
})) : a != null && (t[n] = a);
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function T(t) {
|
|
629
629
|
const e = [];
|
|
630
630
|
return t?.r1 && e.push(t.r1), t?.r2 && e.push(t.r2), t?.r3 && e.push(t.r3), e.join(" ");
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function R(t) {
|
|
633
633
|
try {
|
|
634
634
|
const e = l.syncResult?.geoLocation;
|
|
635
|
-
e && (t.address =
|
|
635
|
+
e && (t.address = T(e), t.isp = e.net || "", t.ip = l.syncResult?.ip || "", t.nation = e.country || "");
|
|
636
636
|
} catch {
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
const
|
|
639
|
+
const B = async (t) => {
|
|
640
640
|
if (!t) return;
|
|
641
|
-
const { platform: e, stage: n } = l, a =
|
|
641
|
+
const { platform: e, stage: n } = l, a = C[e][n].log;
|
|
642
642
|
try {
|
|
643
|
-
const
|
|
643
|
+
const i = await (await fetch(a, {
|
|
644
644
|
method: "POST",
|
|
645
645
|
headers: {
|
|
646
646
|
"Content-Type": "application/json"
|
|
@@ -649,19 +649,19 @@ const T = async (t) => {
|
|
|
649
649
|
access_key: t
|
|
650
650
|
})
|
|
651
651
|
})).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:",
|
|
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;
|
|
657
657
|
}
|
|
658
658
|
};
|
|
659
|
-
async function
|
|
660
|
-
l.platform = t, l.stage = e,
|
|
661
|
-
const { logDate:
|
|
662
|
-
s.extra.logDate =
|
|
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;
|
|
663
663
|
}
|
|
664
|
-
const
|
|
664
|
+
const L = (t = {}) => {
|
|
665
665
|
const e = {
|
|
666
666
|
autostart: !0,
|
|
667
667
|
muted: !1,
|
|
@@ -691,12 +691,12 @@ const B = (t = {}) => {
|
|
|
691
691
|
playRateSetting: [0.5, 0.75, 1, 1.5, 2],
|
|
692
692
|
autoPause: !1,
|
|
693
693
|
repeat: !1,
|
|
694
|
-
setStartTime:
|
|
694
|
+
setStartTime: void 0,
|
|
695
695
|
playIndex: 0,
|
|
696
696
|
lowLatencyMode: !0,
|
|
697
697
|
touchGestures: !0,
|
|
698
698
|
descriptionNotVisible: !1,
|
|
699
|
-
devTestAppId:
|
|
699
|
+
devTestAppId: void 0,
|
|
700
700
|
token: "",
|
|
701
701
|
visibleWatermark: !1,
|
|
702
702
|
watermarkText: "NAVER CLOUD PLATFORM",
|
|
@@ -724,8 +724,8 @@ const B = (t = {}) => {
|
|
|
724
724
|
}), t.captionStyle && (n.captionStyle = {
|
|
725
725
|
...e.captionStyle,
|
|
726
726
|
...t.captionStyle
|
|
727
|
-
}), n.objectFit
|
|
728
|
-
},
|
|
727
|
+
}), n.objectFit === "fill" && (n.objectFit = "stretch"), n.controlBtn?.progressBar === void 0 && (n.controlBtn.progressBar = !0), n;
|
|
728
|
+
}, E = {
|
|
729
729
|
gov: {
|
|
730
730
|
prod: {
|
|
731
731
|
config: "aHR0cHM6Ly9wYXBpLnZwZS5nb3YtbnRydXNzLmNvbS9wbGF5ZXIvY29uZmln",
|
|
@@ -746,14 +746,16 @@ const B = (t = {}) => {
|
|
|
746
746
|
report: "aHR0cHM6Ly9sb2cuYmV0YS12cGUubmF2ZXJuY3AuY29tL3N0YXRz"
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
|
-
}
|
|
749
|
+
};
|
|
750
|
+
let u = [];
|
|
751
|
+
const N = (t) => {
|
|
750
752
|
try {
|
|
751
753
|
return atob(t);
|
|
752
754
|
} catch (e) {
|
|
753
755
|
return console.error("Base64 decoding failed:", e), "";
|
|
754
756
|
}
|
|
755
|
-
}
|
|
756
|
-
class
|
|
757
|
+
};
|
|
758
|
+
class D {
|
|
757
759
|
serverConfig = {};
|
|
758
760
|
playerInfo = null;
|
|
759
761
|
accessKey;
|
|
@@ -762,41 +764,45 @@ class N {
|
|
|
762
764
|
stage;
|
|
763
765
|
isDev;
|
|
764
766
|
translator;
|
|
765
|
-
constructor({ accessKey: e, appId: n, platform: a, stage:
|
|
766
|
-
this.accessKey = e, this.appId =
|
|
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);
|
|
767
769
|
}
|
|
768
770
|
async initialize() {
|
|
769
|
-
|
|
770
|
-
|
|
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);
|
|
771
775
|
try {
|
|
772
|
-
const
|
|
773
|
-
|
|
776
|
+
const i = await this.performKeyCheck();
|
|
777
|
+
if (i.code !== 200)
|
|
778
|
+
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), {
|
|
774
781
|
options: this.serverConfig.result?.options,
|
|
775
|
-
playerInfo:
|
|
776
|
-
}
|
|
777
|
-
} catch (
|
|
778
|
-
return console.error("VPE SDK Initialization failed:",
|
|
782
|
+
playerInfo: o
|
|
783
|
+
};
|
|
784
|
+
} catch (i) {
|
|
785
|
+
return console.error("VPE SDK Initialization failed:", i), { error: this.setErrorRun(e[4]) };
|
|
779
786
|
}
|
|
780
787
|
}
|
|
781
788
|
async performKeyCheck() {
|
|
782
|
-
const e =
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
})
|
|
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, {
|
|
792
|
+
method: e[6],
|
|
793
|
+
headers: { [e[2]]: e[3] },
|
|
794
|
+
body: r
|
|
789
795
|
});
|
|
790
|
-
if (!
|
|
791
|
-
throw new Error(
|
|
792
|
-
return
|
|
796
|
+
if (!i.ok)
|
|
797
|
+
throw new Error(["API", "Error:", i.status, i.statusText].join(" "));
|
|
798
|
+
return i.json();
|
|
793
799
|
}
|
|
794
800
|
getBrowserInfo() {
|
|
795
801
|
const e = navigator.userAgent;
|
|
796
802
|
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
803
|
}
|
|
798
804
|
createPlayerInfo(e) {
|
|
799
|
-
const [n, a] = e.result.name.split("|"),
|
|
805
|
+
const [n, a] = e.result.name.split("|"), r = navigator.connection || navigator.mozConnection || navigator.webkitConnection, i = this.getBrowserInfo(), o = navigator.userAgentData;
|
|
800
806
|
return {
|
|
801
807
|
cid: e.result.cid,
|
|
802
808
|
player_name: n,
|
|
@@ -812,10 +818,10 @@ class N {
|
|
|
812
818
|
height: window.screen.height
|
|
813
819
|
},
|
|
814
820
|
connection: {
|
|
815
|
-
network:
|
|
816
|
-
downlink:
|
|
817
|
-
rtt:
|
|
818
|
-
save_data:
|
|
821
|
+
network: r?.effectiveType ?? "unknown",
|
|
822
|
+
downlink: r?.downlink ?? null,
|
|
823
|
+
rtt: r?.rtt ?? null,
|
|
824
|
+
save_data: r?.saveData ?? !1
|
|
819
825
|
},
|
|
820
826
|
device: {
|
|
821
827
|
platform: o?.platform ?? "Unknown",
|
|
@@ -835,9 +841,9 @@ class N {
|
|
|
835
841
|
vpePackageId: this.appId,
|
|
836
842
|
actionDuration: 0,
|
|
837
843
|
actionType: "ready",
|
|
838
|
-
browser:
|
|
839
|
-
browserOrigin:
|
|
840
|
-
browserVersion:
|
|
844
|
+
browser: i.origin,
|
|
845
|
+
browserOrigin: i.origin,
|
|
846
|
+
browserVersion: i.version,
|
|
841
847
|
protocol: location.protocol,
|
|
842
848
|
quality: "Other",
|
|
843
849
|
qualityOrigin: "Auto",
|
|
@@ -848,11 +854,11 @@ class N {
|
|
|
848
854
|
};
|
|
849
855
|
}
|
|
850
856
|
setErrorRun(e) {
|
|
851
|
-
const n = e.slice(-2), a = this.translator.error[n] || this.translator.error["01"],
|
|
857
|
+
const n = e.slice(-2), a = this.translator.error[n] || this.translator.error["01"], r = {
|
|
852
858
|
errorCode: e,
|
|
853
859
|
errorMessage: a
|
|
854
860
|
};
|
|
855
|
-
return console.log("VPE Error : ",
|
|
861
|
+
return console.log("VPE Error : ", r), r;
|
|
856
862
|
}
|
|
857
863
|
isPaidTier() {
|
|
858
864
|
return this.serverConfig.result?.pricing === "pay";
|
|
@@ -861,8 +867,11 @@ class N {
|
|
|
861
867
|
return !!this.serverConfig.result;
|
|
862
868
|
}
|
|
863
869
|
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;
|
|
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;
|
|
872
|
+
}
|
|
873
|
+
getPlaylist() {
|
|
874
|
+
return u || [];
|
|
866
875
|
}
|
|
867
876
|
/**
|
|
868
877
|
*
|
|
@@ -871,14 +880,14 @@ class N {
|
|
|
871
880
|
$t(e) {
|
|
872
881
|
const n = e.split(".");
|
|
873
882
|
let a = this.translator;
|
|
874
|
-
for (const
|
|
875
|
-
if (a && typeof a == "object" &&
|
|
876
|
-
a = a[
|
|
883
|
+
for (const r of n)
|
|
884
|
+
if (a && typeof a == "object" && r in a)
|
|
885
|
+
a = a[r];
|
|
877
886
|
else
|
|
878
887
|
return e;
|
|
879
888
|
return typeof a == "string" ? a : e;
|
|
880
889
|
}
|
|
881
890
|
}
|
|
882
891
|
export {
|
|
883
|
-
|
|
892
|
+
D as default
|
|
884
893
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sgrsoft/vpe-core-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/vpe-core-sdk.cjs.js",
|
|
7
7
|
"module": "dist/vpe-core-sdk.es.js",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
"dev": "vite",
|
|
14
14
|
"build:types": "tsc --emitDeclarationOnly",
|
|
15
15
|
"build": "vite build && npm run build:types",
|
|
16
|
-
"
|
|
17
|
-
"release
|
|
18
|
-
"release": "release-it --
|
|
19
|
-
"release:
|
|
16
|
+
"build local cp": "cp -R ./dist/* ../vpe-react-ui/node_modules/@sgrsoft/vpe-core-sdk/dist",
|
|
17
|
+
"release Private": "vite build && npm run build:types && release-it --only-version --access=restricted",
|
|
18
|
+
"release:beta Private": "vite build && npm run build:types && release-it --preRelease=beta --access=restricted",
|
|
19
|
+
"release": "vite build && npm run build:types && release-it --only-version",
|
|
20
|
+
"release:beta": "vite build && npm run build:types && release-it --preRelease=beta"
|
|
20
21
|
},
|
|
21
22
|
"exports": {
|
|
22
23
|
".": {
|
|
@@ -33,5 +34,6 @@
|
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"path": "^0.12.7",
|
|
35
36
|
"vite": "^7.2.7"
|
|
36
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"packageManager": "pnpm@10.23.0+sha256.a1cdd7b468386a9d78a081da05d6049d7e598db62a299db92df21a7062a4b183"
|
|
37
39
|
}
|