@hopecloud/jetstream-player 1.0.31 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { IFrameBuilderSrcOpt } from './player.type';
1
+ import { type IFrameBuilderSrcOpt } from './player.type';
2
2
  export declare class IFrameBuilderSrc {
3
3
  private options;
4
4
  origin: string;
@@ -8,4 +8,3 @@ export declare class IFrameBuilderSrc {
8
8
  appendPath(path: string, builtUrl: string): string;
9
9
  buildSrc(): string;
10
10
  }
11
- //# sourceMappingURL=iframe-builder-src.d.ts.map
@@ -1,4 +1,4 @@
1
- import { IFrameBuilderOpt } from './player.type';
1
+ import { type IFrameBuilderOpt } from './player.type';
2
2
  export declare class IFrameBuilder {
3
3
  options: IFrameBuilderOpt;
4
4
  iframe: HTMLIFrameElement | null;
@@ -6,4 +6,3 @@ export declare class IFrameBuilder {
6
6
  private generateIframe;
7
7
  insertIframe(iframe: HTMLIFrameElement): void;
8
8
  }
9
- //# sourceMappingURL=iframe-builder.d.ts.map
@@ -6,4 +6,3 @@ export declare class IFramePiPPlugin {
6
6
  init(): void;
7
7
  destory(): void;
8
8
  }
9
- //# sourceMappingURL=iframe-pip-plugin.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export { JetstreamPlayer } from './player';
2
2
  export * from './player.type';
3
3
  export * from './utils';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { JetstreamPlayerOptions } from './player.type';
1
+ import type { JetstreamPlayerOptions } from './player.type';
2
2
  export declare class JetstreamPlayer {
3
3
  private iframe;
4
4
  private options;
@@ -23,4 +23,3 @@ export declare class JetstreamPlayer {
23
23
  getDuration(): Promise<number>;
24
24
  dispose(): void;
25
25
  }
26
- //# sourceMappingURL=player.d.ts.map
@@ -25,4 +25,3 @@ export type JetstreamPlayerOptions = {
25
25
  sticky?: boolean;
26
26
  events?: Partial<Record<PlayerEvents, (value?: unknown) => void>>;
27
27
  } & Omit<IFrameBuilderOpt, 'selector' | 'src'> & IFrameBuilderSrcOpt;
28
- //# sourceMappingURL=player.type.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export declare const normalizeEventData: <T = unknown>(event: MessageEvent<string>) => T;
2
2
  export declare const denormalizeEventData: <T = unknown>(data: T) => string;
3
3
  export declare const isValidEventData: (rawData: string) => boolean;
4
- //# sourceMappingURL=utils.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export { JetstreamPlayer } from './player';
2
- export * from './player.type';
3
- export * from './utils';
1
+ const e=["ready","timeupdate","play","pause","loadedmetadata","ended","volumechange","error"];class t{options;iframe=null;constructor(e){this.options=e,this.iframe=this.generateIframe()}generateIframe(){const e=document.createElement("iframe");return e.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",e.allowFullscreen=!0,e.frameBorder="0",e.src=this.options.src,e.width=this.options.width||"480px",e.height=this.options.height||"270px",e.classList.add("jet-stream-iframe-player"),e}insertIframe(e){const t=document.querySelector(this.options.selector);t?t.appendChild(e):console.error(`Div with id "${this.options.selector}" not found.`)}}class i{options;origin="https://jstre.am";baseURL=new URL(this.origin);constructor(e){if(""===e.mediaId)throw new Error("mediaId not provided!");this.options=e}getRegionBasedOrigin(){const e=this.baseURL,t=e.hostname.split(".");return this.options.region&&"eu"===this.options.region&&(t.length>2?t.splice(1,0,"eu"):t.splice(0,0,"eu")),e.hostname=t.join("."),e.origin}appendPath(e,t){const i=String(e).trim();return 0===i.indexOf("/")?t+=i:t+=`/${i}`,t}buildSrc(){const e=new URL(`${this.getRegionBasedOrigin()}/embed/${this.options.mediaId}`);return this.options.playerId&&(e.href=this.appendPath(this.options.playerId,e.href)),"eu"===this.options.region&&e.searchParams.append("region","eu"),e.href}}const s="fixed",r="20px",n="20px",o="330px",a="180px";class h{containerSelector;iframe;observer=null;constructor(e,t){this.containerSelector=e,this.iframe=t,this.containerSelector=e,this.iframe=t,this.init()}init(){if(!this.iframe||!this.containerSelector)return;const e=document.querySelector(this.containerSelector);if(!e)throw new Error("Selector of iframe not found");this.observer=new IntersectionObserver((([{isIntersecting:t}])=>{if(t)e.style.height="auto",this.iframe.removeAttribute("style");else{const t=e.getBoundingClientRect().height;e.style.height=`${t}px`,this.iframe.style.position=s,this.iframe.style.bottom=r,this.iframe.style.right=n,this.iframe.style.width=o,this.iframe.style.height=a}}),{root:null,rootMargin:"0px",threshold:.1}),this.observer.observe(e)}destory(){this.observer&&(this.observer.disconnect(),this.observer=null)}}const d=e=>JSON.parse(e.data),c=e=>JSON.stringify(e),p=e=>{if("string"!=typeof e)return!1;try{return JSON.parse(e),!0}catch(e){return console.log("Error parsing JSON",e),!1}};class m{iframe=null;options;registeredEvents={};iFramePiP=null;constructor(e,s){this.options=s;const r=new i({mediaId:s.mediaId,playerId:s.playerId,region:s.region}).buildSrc(),n=new t({selector:e,src:r,width:this.options.width,height:this.options.height});this.iframe=n.iframe,this.iframe&&(n.insertIframe(this.iframe),this.iframe.addEventListener("load",(()=>{this.registerEvents(),this.subscribeToRegisteredEvents()}),{once:!0}),void 0!==this.options.sticky&&this.options.sticky&&(this.iFramePiP=new h(e,this.iframe)))}registerEvents(){!this.options.events||this.options.events&&Object.keys(this.options.events).length<0||Object.entries(this.options.events).forEach((([e,t])=>{e in this.registeredEvents||(this.registeredEvents[e]=t)}))}subscribeEventHandler(e){if(e.source!==this.iframe.contentWindow)return;const t=d(e),i=t.type;i in this.registeredEvents&&this.registeredEvents[i](t.value)}subscribeToRegisteredEvents(){window.addEventListener("message",this.subscribeEventHandler.bind(this))}dispatch(e){if(!this.iframe||!this.iframe.contentWindow)throw new Error("iframe is not provided or parent window not found!");this.iframe.contentWindow.postMessage(c(e),"*")}getterDispatch(e){return new Promise((t=>{this.dispatch(e),window.addEventListener("message",(i=>{const s=d(i);s.type===e.name&&t(s.value)}),{once:!0})}))}play(){this.dispatch({name:"play"})}pause(){this.dispatch({name:"pause"})}mute(){this.dispatch({name:"mute"})}unmute(){this.dispatch({name:"unmute"})}seekTo(e){this.dispatch({name:"seekTo",params:e})}playNext(){this.dispatch({name:"play-next"})}playPrev(){this.dispatch({name:"play-prev"})}isMuted(){return this.getterDispatch({name:"is-muted"})}isPaused(){return this.getterDispatch({name:"is-paused"})}getVideoCurrentTime(){return this.getterDispatch({name:"get-video-current-time"})}getDuration(){return this.getterDispatch({name:"get-duration"})}dispose(){window.removeEventListener("message",this.subscribeEventHandler.bind(this)),this.registeredEvents={},this.iFramePiP?.destory()}}export{m as JetstreamPlayer,c as denormalizeEventData,p as isValidEventData,d as normalizeEventData,e as playerListenEvents};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hopecloud/jetstream-player",
3
- "version": "1.0.31",
3
+ "version": "1.1.2",
4
4
  "description": "Jetstream Embed Player API",
5
5
  "type": "module",
6
6
  "author": {
@@ -11,46 +11,48 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/deeepvision/hcc-jetstream-player.git"
13
13
  },
14
- "source": "src/index.ts",
15
14
  "main": "dist/index.js",
16
- "types": "dist/index.d.ts",
15
+ "module": "dist/index.js",
16
+ "types": "dist/@types/index.d.ts",
17
17
  "exports": {
18
18
  ".": {
19
19
  "import": {
20
- "types": "./dist/index.d.ts",
20
+ "types": "./dist/@types/index.d.ts",
21
21
  "default": "./dist/index.js"
22
22
  }
23
- },
24
- "./dist/main.css": {
25
- "import": "./dist/main.css"
26
23
  }
27
24
  },
28
25
  "files": [
29
26
  "dist"
30
27
  ],
31
28
  "scripts": {
32
- "clean": "rimraf dist/",
33
- "copy-files": "copyfiles -u 1 src/main.css dist/",
34
- "build": "npm run clean && tsc && npm run copy-files",
29
+ "build": "rollup -c",
35
30
  "pack": "npm run build && npm pack",
31
+ "publish:patch": "npm version patch -m \"release: %s\"",
32
+ "publish:minor": "npm version minor -m \"release: %s\"",
33
+ "postpublish:patch": "git push origin && git push origin --tags",
34
+ "postpublish:minor": "git push origin && git push origin --tags",
36
35
  "docs:dev": "vitepress dev docs",
37
36
  "docs:build": "vitepress build docs",
38
37
  "docs:preview": "vitepress preview docs",
39
38
  "lint": "eslint",
40
39
  "lint:fix": "eslint --fix",
41
- "publish:next": "npm version patch -m \"release: %s\" && npm publish && git push origin"
40
+ "typecheck": "tsc --noEmit"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@eslint/eslintrc": "^3.2.0",
45
44
  "@eslint/js": "^9.17.0",
45
+ "@rollup/plugin-terser": "^0.4.4",
46
46
  "@typescript-eslint/eslint-plugin": "^8.19.1",
47
47
  "@typescript-eslint/parser": "^8.19.1",
48
- "copyfiles": "^2.4.1",
49
48
  "eslint": "^9.17.0",
50
49
  "eslint-config-prettier": "^9.1.0",
51
50
  "globals": "^15.14.0",
52
51
  "prettier": "3.4.2",
53
52
  "rimraf": "^6.0.1",
53
+ "rollup": "^4.30.1",
54
+ "rollup-plugin-delete": "^2.1.0",
55
+ "rollup-plugin-typescript2": "^0.36.0",
54
56
  "typescript": "^5.7.3",
55
57
  "vitepress": "1.5.0"
56
58
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe-builder-src.d.ts","sourceRoot":"","sources":["../src/iframe-builder-src.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAsB;IAErC,MAAM,SAAsB;IAE5B,OAAO,MAAwB;gBAEnB,OAAO,EAAE,mBAAmB;IAQxC,oBAAoB;IAiBpB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAYzC,QAAQ;CAeT"}
@@ -1,44 +0,0 @@
1
- export class IFrameBuilderSrc {
2
- constructor(options) {
3
- this.origin = 'https://jstre.am';
4
- this.baseURL = new URL(this.origin);
5
- if (options.mediaId === '') {
6
- throw new Error('mediaId not provided!');
7
- }
8
- this.options = options;
9
- }
10
- getRegionBasedOrigin() {
11
- const url = this.baseURL;
12
- const urlParts = url.hostname.split('.');
13
- if (this.options.region && this.options.region === 'eu') {
14
- if (urlParts.length > 2) {
15
- urlParts.splice(1, 0, 'eu');
16
- }
17
- else {
18
- urlParts.splice(0, 0, 'eu');
19
- }
20
- }
21
- url.hostname = urlParts.join('.');
22
- return url.origin;
23
- }
24
- appendPath(path, builtUrl) {
25
- const pathString = String(path).trim();
26
- if (pathString.indexOf('/') === 0) {
27
- builtUrl += pathString;
28
- }
29
- else {
30
- builtUrl += `/${pathString}`;
31
- }
32
- return builtUrl;
33
- }
34
- buildSrc() {
35
- const url = new URL(`${this.getRegionBasedOrigin()}/embed/${this.options.mediaId}`);
36
- if (this.options.playerId) {
37
- url.href = this.appendPath(this.options.playerId, url.href);
38
- }
39
- if (this.options.region === 'eu') {
40
- url.searchParams.append('region', 'eu');
41
- }
42
- return url.href;
43
- }
44
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe-builder.d.ts","sourceRoot":"","sources":["../src/iframe-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,qBAAa,aAAa;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAQ;gBAE5B,OAAO,EAAE,gBAAgB;IAMrC,OAAO,CAAC,cAAc;IAgBtB,YAAY,CAAC,MAAM,EAAE,iBAAiB;CASvC"}
@@ -1,28 +0,0 @@
1
- export class IFrameBuilder {
2
- constructor(options) {
3
- this.iframe = null;
4
- this.options = options;
5
- this.iframe = this.generateIframe();
6
- }
7
- generateIframe() {
8
- const iframe = document.createElement('iframe');
9
- iframe.allow =
10
- 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture';
11
- iframe.allowFullscreen = true;
12
- iframe.frameBorder = '0';
13
- iframe.src = this.options.src;
14
- iframe.width = this.options.width || '480px';
15
- iframe.height = this.options.height || '270px';
16
- iframe.classList.add('jet-stream-iframe-player');
17
- return iframe;
18
- }
19
- insertIframe(iframe) {
20
- const parent = document.querySelector(this.options.selector);
21
- if (parent) {
22
- parent.appendChild(iframe);
23
- }
24
- else {
25
- console.error(`Div with id "${this.options.selector}" not found.`);
26
- }
27
- }
28
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe-pip-plugin.d.ts","sourceRoot":"","sources":["../src/iframe-pip-plugin.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe;IAIjB,iBAAiB,EAAE,MAAM;IACzB,MAAM,EAAE,iBAAiB;IAJlC,OAAO,CAAC,QAAQ,CAAqC;gBAG5C,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,iBAAiB;IAQlC,IAAI;IAmCJ,OAAO;CAMR"}
@@ -1,40 +0,0 @@
1
- export class IFramePiPPlugin {
2
- constructor(containerSelector, iframe) {
3
- this.containerSelector = containerSelector;
4
- this.iframe = iframe;
5
- this.observer = null;
6
- this.containerSelector = containerSelector;
7
- this.iframe = iframe;
8
- this.init();
9
- }
10
- init() {
11
- if (!this.iframe || !this.containerSelector)
12
- return;
13
- const parent = document.querySelector(this.containerSelector);
14
- if (!parent) {
15
- throw new Error('Selector of iframe not found');
16
- }
17
- this.observer = new IntersectionObserver(([{ isIntersecting }]) => {
18
- if (!isIntersecting) {
19
- const height = parent.getBoundingClientRect().height;
20
- parent.style.height = `${height}px`;
21
- this.iframe.classList.add('pip-active');
22
- }
23
- else {
24
- parent.style.height = 'auto';
25
- this.iframe.classList.remove('pip-active');
26
- }
27
- }, {
28
- root: null,
29
- rootMargin: '0px',
30
- threshold: 0.1,
31
- });
32
- this.observer.observe(parent);
33
- }
34
- destory() {
35
- if (this.observer) {
36
- this.observer.disconnect();
37
- this.observer = null;
38
- }
39
- }
40
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
package/dist/main.css DELETED
@@ -1,7 +0,0 @@
1
- .pip-active {
2
- position: fixed;
3
- bottom: 20px;
4
- right: 20px;
5
- width: 330px;
6
- height: 180px;
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,sBAAsB,EAGvB,MAAM,eAAe,CAAC;AAGvB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,gBAAgB,CAAwC;IAEhE,OAAO,CAAC,SAAS,CAAqD;gBAE1D,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB;IAsCvD,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,qBAAqB;IAa7B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,cAAc;IAoBtB,IAAI;IAMJ,KAAK;IAML,IAAI;IAMJ,MAAM;IAMN,MAAM,CAAC,OAAO,EAAE,MAAM;IAOtB,QAAQ;IAMR,QAAQ;IAMR,OAAO;IAMP,QAAQ;IAMR,mBAAmB;IAMnB,WAAW;IAMX,OAAO;CAUR"}
package/dist/player.js DELETED
@@ -1,142 +0,0 @@
1
- import { IFrameBuilder } from './iframe-builder';
2
- import { IFrameBuilderSrc } from './iframe-builder-src';
3
- import { IFramePiPPlugin } from './iframe-pip-plugin';
4
- import { denormalizeEventData, normalizeEventData } from './utils';
5
- export class JetstreamPlayer {
6
- constructor(el, options) {
7
- this.iframe = null;
8
- this.registeredEvents = {};
9
- this.iFramePiP = null;
10
- this.options = options;
11
- const sourceBuilder = new IFrameBuilderSrc({
12
- mediaId: options.mediaId,
13
- playerId: options.playerId,
14
- region: options.region,
15
- });
16
- const src = sourceBuilder.buildSrc();
17
- const iframeBuilder = new IFrameBuilder({
18
- selector: el,
19
- src: src,
20
- width: this.options.width,
21
- height: this.options.height,
22
- });
23
- this.iframe = iframeBuilder.iframe;
24
- if (this.iframe) {
25
- iframeBuilder.insertIframe(this.iframe);
26
- this.iframe.addEventListener('load', () => {
27
- this.registerEvents();
28
- this.subscribeToRegisteredEvents();
29
- }, {
30
- once: true,
31
- });
32
- if (typeof this.options.sticky !== 'undefined' && this.options.sticky) {
33
- this.iFramePiP = new IFramePiPPlugin(el, this.iframe);
34
- }
35
- }
36
- }
37
- registerEvents() {
38
- if (!this.options.events ||
39
- (this.options.events && Object.keys(this.options.events).length < 0)) {
40
- return;
41
- }
42
- Object.entries(this.options.events).forEach(([eventName, cb]) => {
43
- if (!(eventName in this.registeredEvents)) {
44
- this.registeredEvents[eventName] = cb;
45
- }
46
- });
47
- }
48
- subscribeEventHandler(event) {
49
- if (event.source !== this.iframe.contentWindow) {
50
- return;
51
- }
52
- const data = normalizeEventData(event);
53
- const eventType = data.type;
54
- if (eventType in this.registeredEvents) {
55
- this.registeredEvents[eventType](data.value);
56
- }
57
- }
58
- subscribeToRegisteredEvents() {
59
- window.addEventListener('message', this.subscribeEventHandler.bind(this));
60
- }
61
- dispatch(event) {
62
- if (!this.iframe || !this.iframe.contentWindow) {
63
- throw new Error('iframe is not provided or parent window not found!');
64
- }
65
- this.iframe.contentWindow.postMessage(denormalizeEventData(event), '*');
66
- }
67
- getterDispatch(getterEvent) {
68
- return new Promise((resolve) => {
69
- this.dispatch(getterEvent);
70
- window.addEventListener('message', (event) => {
71
- const data = normalizeEventData(event);
72
- if (data.type === getterEvent.name) {
73
- resolve(data.value);
74
- }
75
- }, {
76
- once: true,
77
- });
78
- });
79
- }
80
- play() {
81
- this.dispatch({
82
- name: 'play',
83
- });
84
- }
85
- pause() {
86
- this.dispatch({
87
- name: 'pause',
88
- });
89
- }
90
- mute() {
91
- this.dispatch({
92
- name: 'mute',
93
- });
94
- }
95
- unmute() {
96
- this.dispatch({
97
- name: 'unmute',
98
- });
99
- }
100
- seekTo(seconds) {
101
- this.dispatch({
102
- name: 'seekTo',
103
- params: seconds,
104
- });
105
- }
106
- playNext() {
107
- this.dispatch({
108
- name: 'play-next',
109
- });
110
- }
111
- playPrev() {
112
- this.dispatch({
113
- name: 'play-prev',
114
- });
115
- }
116
- isMuted() {
117
- return this.getterDispatch({
118
- name: 'is-muted',
119
- });
120
- }
121
- isPaused() {
122
- return this.getterDispatch({
123
- name: 'is-paused',
124
- });
125
- }
126
- getVideoCurrentTime() {
127
- return this.getterDispatch({
128
- name: 'get-video-current-time',
129
- });
130
- }
131
- getDuration() {
132
- return this.getterDispatch({
133
- name: 'get-duration',
134
- });
135
- }
136
- dispose() {
137
- var _a;
138
- window.removeEventListener('message', this.subscribeEventHandler.bind(this));
139
- this.registeredEvents = {};
140
- (_a = this.iFramePiP) === null || _a === void 0 ? void 0 : _a.destory();
141
- }
142
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"player.type.d.ts","sourceRoot":"","sources":["../src/player.type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,uGASrB,CAAC;AACX,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,YAAY,GACZ,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,OAAO,GACP,cAAc,GACd,OAAO,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,wBAAwB,GACxB,cAAc,GACd,WAAW,CAAC;AAChB,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,WAAW,CAAC;AAChB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC;CACnE,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,KAAK,CAAC,GAC5C,mBAAmB,CAAC"}
@@ -1,10 +0,0 @@
1
- export const playerListenEvents = [
2
- 'ready',
3
- 'timeupdate',
4
- 'play',
5
- 'pause',
6
- 'loadedmetadata',
7
- 'ended',
8
- 'volumechange',
9
- 'error',
10
- ];
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,GAAI,CAAC,mBAC3B,YAAY,CAAC,MAAM,CAAC,KAEM,CAClC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,kBAAkB,CAAC,WAExD,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAa,MAAM,YAa/C,CAAC"}
package/dist/utils.js DELETED
@@ -1,19 +0,0 @@
1
- export const normalizeEventData = (event) => {
2
- return JSON.parse(event.data);
3
- };
4
- export const denormalizeEventData = (data) => {
5
- return JSON.stringify(data);
6
- };
7
- export const isValidEventData = (rawData) => {
8
- if (typeof rawData !== 'string') {
9
- return false;
10
- }
11
- try {
12
- JSON.parse(rawData);
13
- return true;
14
- }
15
- catch (error) {
16
- console.log('Error parsing JSON', error);
17
- return false;
18
- }
19
- };