@streamscloud/embeddable 2.0.4 → 2.1.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/dist/short-videos/short-videos-player/index.d.ts +3 -0
- package/dist/short-videos/short-videos-player/index.js +1 -1
- package/dist/streams/stream-player/index.d.ts +1 -0
- package/dist/streams/stream-player/index.js +2 -2
- package/dist/ui/shadow-dom/shadow-host.d.ts +4 -1
- package/dist/ui/shadow-dom/shadow-host.js +6 -1
- package/package.json +1 -1
|
@@ -25,4 +25,7 @@ export type { IShortVideosPlayerLocalization };
|
|
|
25
25
|
export declare const openShortVideosPlayer: (init: {
|
|
26
26
|
shortVideosProvider: PlayerItemsProvider<ShortVideoViewerModel>;
|
|
27
27
|
localization?: IShortVideosPlayerLocalization;
|
|
28
|
+
on?: {
|
|
29
|
+
playerClosed?: () => void;
|
|
30
|
+
};
|
|
28
31
|
}) => void;
|
|
@@ -23,7 +23,7 @@ import { mount } from 'svelte';
|
|
|
23
23
|
*/
|
|
24
24
|
export const openShortVideosPlayer = (init) => {
|
|
25
25
|
const { shortVideosProvider, localization } = init;
|
|
26
|
-
const shadowHost = new ShadowHost();
|
|
26
|
+
const shadowHost = new ShadowHost({ onClosed: () => init.on?.playerClosed?.() });
|
|
27
27
|
mount(ShortVideosPlayer, {
|
|
28
28
|
target: shadowHost.shadowRoot,
|
|
29
29
|
props: {
|
|
@@ -27,7 +27,7 @@ import { mount } from 'svelte';
|
|
|
27
27
|
*/
|
|
28
28
|
export const openStreamPlayer = (init) => {
|
|
29
29
|
const { streamId, graphqlUrl, localization } = init;
|
|
30
|
-
const shadowHost = new ShadowHost();
|
|
30
|
+
const shadowHost = new ShadowHost({ onClosed: () => init.on?.playerClosed?.() });
|
|
31
31
|
mount(StreamPlayer, {
|
|
32
32
|
target: shadowHost.shadowRoot,
|
|
33
33
|
props: {
|
|
@@ -35,7 +35,7 @@ export const openStreamPlayer = (init) => {
|
|
|
35
35
|
graphql: createLocalGQLClient(graphqlUrl),
|
|
36
36
|
localization,
|
|
37
37
|
on: {
|
|
38
|
-
streamActivated: data => {
|
|
38
|
+
streamActivated: (data) => {
|
|
39
39
|
if (init.on?.streamActivated) {
|
|
40
40
|
init.on.streamActivated({ title: data.title, image: data.image });
|
|
41
41
|
}
|
|
@@ -3,7 +3,11 @@ import reset from './_reset.scss?raw';
|
|
|
3
3
|
export class ShadowHost {
|
|
4
4
|
shadowRoot;
|
|
5
5
|
host;
|
|
6
|
-
|
|
6
|
+
callbacks;
|
|
7
|
+
constructor(init) {
|
|
8
|
+
this.callbacks = {
|
|
9
|
+
onClosed: init.onClosed
|
|
10
|
+
};
|
|
7
11
|
const host = document.createElement('div');
|
|
8
12
|
host.style.all = 'unset';
|
|
9
13
|
host.style.position = 'fixed';
|
|
@@ -30,6 +34,7 @@ export class ShadowHost {
|
|
|
30
34
|
this.host.remove();
|
|
31
35
|
document.getElementsByTagName('html')[0].style.overflow = '';
|
|
32
36
|
document.removeEventListener('keydown', this.handleEsc);
|
|
37
|
+
this.callbacks.onClosed();
|
|
33
38
|
}
|
|
34
39
|
handleEsc = (event) => {
|
|
35
40
|
if (event.key === 'Escape' || event.key === 'Esc') {
|