@streamscloud/embeddable 2.0.3 → 2.0.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.
@@ -30,7 +30,7 @@ let loading = $state(true);
30
30
  let activePageId = $derived.by(() => { var _a, _b; return (_b = (_a = buffer === null || buffer === void 0 ? void 0 : buffer.current) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : ''; });
31
31
  const uiManager = new StreamPlayerUiManager();
32
32
  onMount(() => __awaiter(void 0, void 0, void 0, function* () {
33
- var _a, _b;
33
+ var _a, _b, _c, _d;
34
34
  uiManager.overviewCollapsed = window && window.innerWidth < window.innerHeight;
35
35
  try {
36
36
  const streamPayload = yield graphql.query(GetStreamDocument, { id: streamId }).toPromise();
@@ -39,6 +39,10 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
39
39
  (_b = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _b === void 0 ? void 0 : _b.call(on);
40
40
  return;
41
41
  }
42
+ (_c = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _c === void 0 ? void 0 : _c.call(on, {
43
+ title: streamPayload.data.stream.title,
44
+ image: ((_d = streamPayload.data.stream.cover) === null || _d === void 0 ? void 0 : _d.url) || null
45
+ });
42
46
  // start tracking the stream
43
47
  model = mapStreamPlayerModel(streamPayload.data.stream);
44
48
  buffer = new StreamPlayerBuffer({ graphql, streamId });
@@ -8,6 +8,7 @@ type Props = {
8
8
  closePlayer?: () => void;
9
9
  streamActivated?: (data: {
10
10
  title: string;
11
+ image: string | null;
11
12
  }) => void;
12
13
  };
13
14
  };
@@ -7,6 +7,7 @@ export type { IStreamPlayerLocalization };
7
7
  * @param {string} init.streamId - The ID of the stream to open.
8
8
  * @param {string} init.graphqlUrl - The URL of the GraphQL endpoint.
9
9
  * @param {IStreamPlayerLocalization} [init.localization] - Optional localization settings for the player UI.
10
+ * @param init.on - Available callbacks.
10
11
  *
11
12
  * @example
12
13
  * ```ts
@@ -26,4 +27,10 @@ export declare const openStreamPlayer: (init: {
26
27
  streamId: string;
27
28
  graphqlUrl: string;
28
29
  localization?: IStreamPlayerLocalization;
30
+ on?: {
31
+ streamActivated?: (data: {
32
+ title: string;
33
+ image: string | null;
34
+ }) => void;
35
+ };
29
36
  }) => void;
@@ -9,6 +9,7 @@ import { mount } from 'svelte';
9
9
  * @param {string} init.streamId - The ID of the stream to open.
10
10
  * @param {string} init.graphqlUrl - The URL of the GraphQL endpoint.
11
11
  * @param {IStreamPlayerLocalization} [init.localization] - Optional localization settings for the player UI.
12
+ * @param init.on - Available callbacks.
12
13
  *
13
14
  * @example
14
15
  * ```ts
@@ -34,6 +35,11 @@ export const openStreamPlayer = (init) => {
34
35
  graphql: createLocalGQLClient(graphqlUrl),
35
36
  localization,
36
37
  on: {
38
+ streamActivated: data => {
39
+ if (init.on?.streamActivated) {
40
+ init.on.streamActivated({ title: data.title, image: data.image });
41
+ }
42
+ },
37
43
  closePlayer: () => {
38
44
  shadowHost.remove();
39
45
  }
@@ -11,6 +11,9 @@ export type GetStreamQuery = {
11
11
  createdAt: any;
12
12
  publishedAt: any | null;
13
13
  pagesCount: number;
14
+ cover: {
15
+ url: string;
16
+ } | null;
14
17
  ownerProfile: {
15
18
  image: string | null;
16
19
  name: string;
@@ -45,6 +48,9 @@ export type StreamPlayerPayloadFragment = {
45
48
  createdAt: any;
46
49
  publishedAt: any | null;
47
50
  pagesCount: number;
51
+ cover: {
52
+ url: string;
53
+ } | null;
48
54
  ownerProfile: {
49
55
  image: string | null;
50
56
  name: string;
@@ -13,6 +13,11 @@ export const StreamPlayerPayloadFragmentDoc = {
13
13
  { kind: 'Field', name: { kind: 'Name', value: 'subTitle' } },
14
14
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
15
15
  { kind: 'Field', name: { kind: 'Name', value: 'publishedAt' } },
16
+ {
17
+ kind: 'Field',
18
+ name: { kind: 'Name', value: 'cover' },
19
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'url' } }] }
20
+ },
16
21
  {
17
22
  kind: 'Field',
18
23
  name: { kind: 'Name', value: 'ownerProfile' },
@@ -88,6 +93,11 @@ export const GetStreamDocument = {
88
93
  { kind: 'Field', name: { kind: 'Name', value: 'subTitle' } },
89
94
  { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } },
90
95
  { kind: 'Field', name: { kind: 'Name', value: 'publishedAt' } },
96
+ {
97
+ kind: 'Field',
98
+ name: { kind: 'Name', value: 'cover' },
99
+ selectionSet: { kind: 'SelectionSet', selections: [{ kind: 'Field', name: { kind: 'Name', value: 'url' } }] }
100
+ },
91
101
  {
92
102
  kind: 'Field',
93
103
  name: { kind: 'Name', value: 'ownerProfile' },
@@ -20,6 +20,9 @@ fragment StreamPlayerPayloadFragment on Stream {
20
20
  subTitle
21
21
  createdAt
22
22
  publishedAt
23
+ cover {
24
+ url
25
+ }
23
26
  ownerProfile {
24
27
  image
25
28
  name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",