@hopecloud/jetstream-player 0.2.3 → 0.2.4
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.
|
@@ -2,9 +2,18 @@ type CallbackType = (index: number) => void;
|
|
|
2
2
|
export declare const onEnded: (callback: CallbackType) => void;
|
|
3
3
|
export declare const playVideo: (callback: CallbackType) => void;
|
|
4
4
|
export declare const pauseVideo: (callback: CallbackType) => void;
|
|
5
|
-
export declare const initPlayerMethods: () =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export declare const initPlayerMethods: () => {
|
|
6
|
+
new (selector: string): {
|
|
7
|
+
iframe: HTMLIFrameElement;
|
|
8
|
+
play(): void;
|
|
9
|
+
pause(): void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const JetstreamPlayer: {
|
|
13
|
+
new (selector: string): {
|
|
14
|
+
iframe: HTMLIFrameElement;
|
|
15
|
+
play(): void;
|
|
16
|
+
pause(): void;
|
|
17
|
+
};
|
|
9
18
|
};
|
|
10
19
|
export {};
|
|
@@ -32,16 +32,19 @@ export const initPlayerMethods = () => {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
+
class JetstreamPlayer {
|
|
36
|
+
iframe;
|
|
37
|
+
constructor(selector) {
|
|
38
|
+
this.iframe = document.querySelector(selector);
|
|
39
|
+
}
|
|
40
|
+
play() {
|
|
41
|
+
this.iframe.contentWindow?.postMessage('play', '*');
|
|
42
|
+
}
|
|
43
|
+
pause() {
|
|
44
|
+
this.iframe.contentWindow?.postMessage('pause', '*');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return JetstreamPlayer;
|
|
35
48
|
};
|
|
49
|
+
export const JetstreamPlayer = initPlayerMethods();
|
|
36
50
|
document.addEventListener('DOMContentLoaded', initPlayerMethods);
|
|
37
|
-
export const embedPlayer = new Proxy({
|
|
38
|
-
play: (index) => { },
|
|
39
|
-
pause: (index) => { }
|
|
40
|
-
}, {
|
|
41
|
-
get(target, prop) {
|
|
42
|
-
return (index) => {
|
|
43
|
-
const method = prop.toString();
|
|
44
|
-
iframesWithEmbedVideo[index].contentWindow?.postMessage(method, '*');
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
});
|