@streamscloud/embeddable 12.2.0 → 13.0.1
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/content-player/content-player-config.svelte.d.ts +2 -13
- package/dist/content-player/content-player-config.svelte.js +1 -1
- package/dist/content-player/content-player-settings.svelte.d.ts +16 -0
- package/dist/content-player/content-player-settings.svelte.js +27 -0
- package/dist/content-player/index.d.ts +1 -0
- package/dist/content-player/index.js +1 -0
- package/dist/core/theme/index.d.ts +1 -0
- package/dist/core/theme/theme-store.svelte.d.ts +3 -2
- package/dist/external-api/data-providers/index.d.ts +6 -0
- package/dist/external-api/data-providers/index.js +6 -0
- package/dist/external-api/data-providers/internal-media-center-data-provider.svelte.d.ts +15 -0
- package/dist/{media-center/config/internal-media-center-config.js → external-api/data-providers/internal-media-center-data-provider.svelte.js} +33 -17
- package/dist/{posts/handlers → external-api/data-providers}/internal-post-analytics-handler.d.ts +1 -1
- package/dist/{short-videos → external-api}/data-providers/internal-short-video-player-items-provider.js +1 -1
- package/dist/{streams/streams-player → external-api/data-providers}/internal-stream-analytics-handler.d.ts +1 -1
- package/dist/{streams/streams-player → external-api/data-providers}/internal-streams-player-data-provider.d.ts +1 -1
- package/dist/{streams/streams-player → external-api/data-providers}/internal-streams-player-data-provider.js +1 -1
- package/dist/{media-center/config → external-api/data-providers}/operations.generated.d.ts +6 -0
- package/dist/{media-center/config → external-api/data-providers}/operations.generated.js +13 -0
- package/dist/{media-center/config → external-api/data-providers}/operations.graphql +6 -0
- package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/mapper.d.ts +1 -1
- package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/mapper.js +2 -2
- package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/operations.generated.d.ts +1 -1
- package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/posts-loader.d.ts +2 -2
- package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/posts-loader.js +1 -1
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/mapper.d.ts +1 -1
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/mapper.js +1 -1
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/operations.generated.d.ts +1 -1
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/stream-pages-loader.d.ts +1 -1
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/stream-pages-loader.js +2 -2
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/streams-loader.d.ts +2 -2
- package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/streams-loader.js +1 -1
- package/dist/external-api/index.d.ts +3 -0
- package/dist/external-api/index.js +3 -0
- package/dist/external-api/media-page/index.d.ts +83 -0
- package/dist/external-api/media-page/index.js +82 -0
- package/dist/{short-videos → external-api}/short-videos-player/index.d.ts +27 -12
- package/dist/{short-videos → external-api}/short-videos-player/index.js +35 -28
- package/dist/external-api/streams-player/index.d.ts +105 -0
- package/dist/external-api/streams-player/index.js +110 -0
- package/dist/media-center/config/types.d.ts +28 -27
- package/dist/media-center/index.d.ts +3 -1
- package/dist/media-center/media-center/cmp.media-center-proxy.svelte +4 -4
- package/dist/media-center/media-center/cmp.media-center-proxy.svelte.d.ts +7 -4
- package/dist/media-center/media-center/discover/community-features-localization.d.ts +8 -0
- package/dist/media-center/media-center/discover/community-features-localization.js +31 -0
- package/dist/media-center/media-center/discover/community-features.svelte +171 -0
- package/dist/media-center/media-center/discover/community-features.svelte.d.ts +11 -0
- package/dist/media-center/media-center/discover/data-loading.d.ts +3 -3
- package/dist/media-center/media-center/discover/data-loading.js +5 -5
- package/dist/media-center/media-center/discover/discover-header.svelte +7 -56
- package/dist/media-center/media-center/discover/discover-view-handler.svelte.d.ts +3 -3
- package/dist/media-center/media-center/discover/discover-view-handler.svelte.js +4 -4
- package/dist/media-center/media-center/feed/feed-handler.svelte.d.ts +5 -3
- package/dist/media-center/media-center/feed/feed-handler.svelte.js +18 -10
- package/dist/media-center/media-center/feed/feed-providers-generator.d.ts +11 -5
- package/dist/media-center/media-center/feed/feed-providers-generator.js +13 -9
- package/dist/media-center/media-center/footer/index.d.ts +1 -0
- package/dist/media-center/media-center/footer/index.js +1 -0
- package/dist/media-center/media-center/handlers/categories-handler.svelte.d.ts +3 -5
- package/dist/media-center/media-center/handlers/categories-handler.svelte.js +16 -13
- package/dist/media-center/media-center/handlers/media-center-settings-handler.svelte.d.ts +18 -7
- package/dist/media-center/media-center/handlers/media-center-settings-handler.svelte.js +18 -25
- package/dist/media-center/media-center/{header-footer → header}/index.d.ts +0 -1
- package/dist/media-center/media-center/{header-footer → header}/index.js +0 -1
- package/dist/media-center/media-center/{header-footer → header}/media-center-header.svelte +138 -31
- package/dist/media-center/media-center/{header-footer → header}/media-center-header.svelte.d.ts +2 -0
- package/dist/media-center/media-center/index.d.ts +1 -0
- package/dist/media-center/media-center/index.js +1 -0
- package/dist/media-center/media-center/media-center-context.svelte.d.ts +15 -9
- package/dist/media-center/media-center/media-center-context.svelte.js +57 -19
- package/dist/media-center/media-center/media-center-settings.svelte.d.ts +11 -0
- package/dist/media-center/media-center/media-center-settings.svelte.js +23 -0
- package/dist/media-center/media-center/media-center-view.svelte +11 -3
- package/dist/media-center/media-center/media-center-view.svelte.d.ts +2 -0
- package/dist/media-center/media-center/menu/category-following-wrapper.svelte.d.ts +1 -1
- package/dist/media-center/media-center/menu/menu.svelte +15 -14
- package/dist/media-center/media-center/menu/popular-streams-panel-handler.svelte.d.ts +3 -3
- package/dist/media-center/media-center/menu/popular-streams-panel-handler.svelte.js +4 -4
- package/dist/media-center/media-center/moments/cmp.moments-circle.svelte +22 -9
- package/dist/media-center/media-center/moments/index.d.ts +1 -0
- package/dist/media-center/media-center/moments/index.js +1 -0
- package/dist/media-center/media-center/moments/moments-feed-handler.svelte.d.ts +26 -0
- package/dist/media-center/media-center/moments/moments-feed-handler.svelte.js +49 -0
- package/dist/media-center/media-center/moments/moments-state.svelte.d.ts +20 -0
- package/dist/media-center/media-center/moments/moments-state.svelte.js +82 -0
- package/dist/media-center/media-center/streams-in-category/streams-in-category-panel-handler.svelte.d.ts +3 -3
- package/dist/media-center/media-center/streams-in-category/streams-in-category-panel-handler.svelte.js +4 -4
- package/dist/media-center/media-center/types.d.ts +3 -3
- package/dist/media-center/membership/index.d.ts +1 -0
- package/dist/media-center/membership/index.js +1 -0
- package/dist/media-center/membership/mock-membership-handler.svelte.d.ts +10 -0
- package/dist/media-center/membership/mock-membership-handler.svelte.js +21 -0
- package/dist/media-center/membership/types.d.ts +10 -0
- package/dist/media-center/membership/types.js +1 -0
- package/dist/media-center/navigation/index.d.ts +2 -0
- package/dist/media-center/navigation/index.js +1 -0
- package/dist/media-center/navigation/media-center-state.d.ts +19 -0
- package/dist/media-center/navigation/media-center-state.js +1 -0
- package/dist/media-center/navigation/mock-navigation-handler.svelte.d.ts +6 -0
- package/dist/media-center/navigation/mock-navigation-handler.svelte.js +6 -0
- package/dist/media-center/navigation/types.d.ts +5 -0
- package/dist/media-center/navigation/types.js +1 -0
- package/dist/media-page/cmp.media-page.svelte +10 -4
- package/dist/media-page/cmp.media-page.svelte.d.ts +6 -5
- package/dist/media-page/index.d.ts +40 -58
- package/dist/media-page/index.js +129 -16
- package/dist/posts/posts-player/index.d.ts +31 -33
- package/dist/posts/posts-player/index.js +90 -35
- package/dist/posts/posts-player/posts-player-view.svelte +1 -1
- package/dist/posts/posts-player/types.d.ts +2 -1
- package/dist/streams/layout/styles-transformer.d.ts +1 -1
- package/dist/streams/streams-player/index.d.ts +17 -83
- package/dist/streams/streams-player/index.js +84 -64
- package/dist/streams/streams-player/streams-player-buffer.svelte.js +2 -1
- package/dist/streams/streams-player/streams-player-view.svelte +1 -1
- package/dist/streams/streams-player/types.d.ts +3 -1
- package/dist/ui/button/cmp.options-button.svelte +123 -0
- package/dist/ui/button/cmp.options-button.svelte.d.ts +20 -0
- package/dist/ui/button/index.d.ts +1 -0
- package/dist/ui/button/index.js +1 -0
- package/dist/ui/button/resources/button-theme.svelte +16 -2
- package/dist/ui/player/colors/index.d.ts +1 -1
- package/dist/ui/player/colors/index.js +1 -1
- package/dist/ui/player/colors/player-colors.d.ts +14 -1
- package/dist/ui/player/colors/player-colors.js +24 -1
- package/dist/ui/player/providers/default-chunks-player-buffer.svelte.d.ts +1 -0
- package/dist/ui/player/providers/default-chunks-player-buffer.svelte.js +7 -1
- package/dist/ui/player/providers/default-feed-player-buffer.svelte.d.ts +1 -0
- package/dist/ui/player/providers/default-feed-player-buffer.svelte.js +7 -1
- package/dist/ui/player/providers/types.d.ts +3 -1
- package/dist/ui/shadow-dom/cmp.shadow-root.svelte +6 -4
- package/dist/ui/shadow-dom/colors.scss +6 -4
- package/package.json +5 -1
- package/dist/content-player/content-player-settings.d.ts +0 -12
- package/dist/content-player/content-player-settings.js +0 -23
- package/dist/media-center/config/internal-media-center-config.d.ts +0 -14
- package/dist/media-center/media-center/discover/discover-header-localization.d.ts +0 -6
- package/dist/media-center/media-center/discover/discover-header-localization.js +0 -15
- package/dist/posts/handlers/index.d.ts +0 -1
- package/dist/posts/handlers/index.js +0 -1
- package/dist/short-videos/data-providers/index.d.ts +0 -1
- package/dist/short-videos/data-providers/index.js +0 -1
- /package/dist/{media-center/config → external-api/data-providers}/internal-media-center-analytics-handler.d.ts +0 -0
- /package/dist/{media-center/config → external-api/data-providers}/internal-media-center-analytics-handler.js +0 -0
- /package/dist/{posts/handlers → external-api/data-providers}/internal-post-analytics-handler.js +0 -0
- /package/dist/{short-videos → external-api}/data-providers/internal-short-video-player-items-provider.d.ts +0 -0
- /package/dist/{streams/streams-player → external-api/data-providers}/internal-stream-analytics-handler.js +0 -0
- /package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/index.d.ts +0 -0
- /package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/index.js +0 -0
- /package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/operations.generated.js +0 -0
- /package/dist/{posts/data-loaders → external-api/data-providers/post-data-loaders}/operations.graphql +0 -0
- /package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/index.d.ts +0 -0
- /package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/index.js +0 -0
- /package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/operations.generated.js +0 -0
- /package/dist/{streams/data-loaders → external-api/data-providers/stream-data-loaders}/operations.graphql +0 -0
- /package/dist/media-center/media-center/{header-footer → footer}/media-center-footer.svelte +0 -0
- /package/dist/media-center/media-center/{header-footer → footer}/media-center-footer.svelte.d.ts +0 -0
- /package/dist/media-center/media-center/{header-footer → header}/media-center-header-localization.d.ts +0 -0
- /package/dist/media-center/media-center/{header-footer → header}/media-center-header-localization.js +0 -0
- /package/dist/media-center/media-center/{header-footer → header}/media-center-header-mobile.svelte +0 -0
- /package/dist/media-center/media-center/{header-footer → header}/media-center-header-mobile.svelte.d.ts +0 -0
|
@@ -1,50 +1,30 @@
|
|
|
1
1
|
import type { Locale } from '../../core/locale';
|
|
2
|
-
import { type
|
|
2
|
+
import { type IMediaCenterDataProvider } from '../../media-center/config/types';
|
|
3
3
|
import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
|
|
4
4
|
import type { StreamPageViewerModel } from '../stream-page-viewer/types';
|
|
5
5
|
import type { IStreamAnalyticsHandler, IStreamsPlayerDataProvider, StreamAmplificationParameters, StreamPlayerModel } from './types';
|
|
6
6
|
export { type StreamPlayerModel, type StreamPageViewerModel };
|
|
7
|
-
export {
|
|
8
|
-
export type { IStreamsPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterConfig };
|
|
7
|
+
export type { IStreamsPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterDataProvider };
|
|
9
8
|
/**
|
|
10
9
|
* Opens the streams player modal.
|
|
11
10
|
*
|
|
12
|
-
* Two overloads (mutually exclusive; enforced by TypeScript):
|
|
13
|
-
* - Provider mode: openStreamsPlayer({ dataProvider, mediaCenterConfig?, analyticsHandler? })
|
|
14
|
-
* - Internal provider mode: openStreamsPlayer({ ids, initiator, graphqlOrigin?, initialId?, mediaPageId? })
|
|
15
|
-
*
|
|
16
11
|
* @param init Configuration options.
|
|
17
12
|
*
|
|
18
|
-
*
|
|
13
|
+
* Required
|
|
19
14
|
* @param {IStreamsPlayerDataProvider} init.dataProvider
|
|
20
15
|
* Provider that supplies the stream data to the player.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* Optional
|
|
23
18
|
* @param {IStreamAnalyticsHandler} [init.analyticsHandler]
|
|
24
19
|
* Optional analytics handler to capture player/stream analytics events.
|
|
25
|
-
* If omitted in provider mode, analytics is not auto-initialized.
|
|
26
|
-
*
|
|
27
|
-
* Internal provider mode (overload 2)
|
|
28
|
-
* @param {string[]} init.ids
|
|
29
|
-
* List of stream IDs to display.
|
|
30
|
-
* @param {string} init.initiator
|
|
31
|
-
* Initiator identifier (used for tracking/analytics and GraphQL).
|
|
32
|
-
* @param {string} [init.graphqlOrigin]
|
|
33
|
-
* Optional GraphQL origin (base URL). If omitted, the default origin is determined internally.
|
|
34
|
-
* @param {string} [init.initialId]
|
|
35
|
-
* ID of the stream to open first (optional).
|
|
36
|
-
* @param {string} [init.mediaPageId]
|
|
37
|
-
* Optional media page ID used to construct an internal media-center config.
|
|
38
|
-
*
|
|
39
|
-
* Common (optional)
|
|
40
20
|
* @param {IPostSocialInteractionsHandler} [init.postSocialInteractionsHandler]
|
|
41
21
|
* Handler for social interactions (like, share, etc.).
|
|
42
22
|
* @param {StreamAmplificationParameters} [init.amplificationParameters]
|
|
43
23
|
* Optional parameters to configure amplification behavior.
|
|
44
|
-
* @param {
|
|
24
|
+
* @param {StreamsPlayerSettings} [init.playerSettings]
|
|
45
25
|
* Player UI and behavior settings.
|
|
46
26
|
*
|
|
47
|
-
* Fields of
|
|
27
|
+
* Fields of StreamsPlayerSettings:
|
|
48
28
|
* - {boolean} [disableBackground]
|
|
49
29
|
* If true, hides the player's background image.
|
|
50
30
|
* - {boolean} [hideCloseButton]
|
|
@@ -54,6 +34,8 @@ export type { IStreamsPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterC
|
|
|
54
34
|
* If omitted, the default locale 'en' is used.
|
|
55
35
|
* - {boolean} [showStreamsCloudWatermark]
|
|
56
36
|
* If true, shows the StreamsCloud watermark.
|
|
37
|
+
* - {'light' | 'dark'} [theme]
|
|
38
|
+
* Optional theme for the player UI.
|
|
57
39
|
*
|
|
58
40
|
* Events
|
|
59
41
|
* @param {{ streamActivated?: (data: { title: string; image: string | null }) => void; playerClosed?: () => void }} [init.on]
|
|
@@ -65,63 +47,31 @@ export type { IStreamsPlayerDataProvider, IStreamAnalyticsHandler, IMediaCenterC
|
|
|
65
47
|
*
|
|
66
48
|
* @returns {void}
|
|
67
49
|
*
|
|
68
|
-
* @example
|
|
50
|
+
* @example
|
|
69
51
|
* ```ts
|
|
70
|
-
* import {
|
|
52
|
+
* import { openStreamsPlayer } from '@streamscloud/embeddable/stream-player';
|
|
71
53
|
*
|
|
72
|
-
*
|
|
54
|
+
* openStreamsPlayer({
|
|
73
55
|
* dataProvider: myStreamProvider,
|
|
74
|
-
* mediaCenterConfig: myMediaCenterProvider,
|
|
75
56
|
* analyticsHandler: myAnalyticsHandler,
|
|
57
|
+
* amplificationParameters: {
|
|
58
|
+
* // ...your amplification parameters
|
|
59
|
+
* },
|
|
76
60
|
* playerSettings: {
|
|
77
61
|
* // Locale defaults to 'en'; set 'no' to switch to Norwegian:
|
|
78
62
|
* locale: 'no',
|
|
79
63
|
* disableBackground: false,
|
|
80
64
|
* hideCloseButton: false,
|
|
81
65
|
* showStreamsCloudWatermark: true,
|
|
66
|
+
* theme: 'dark',
|
|
82
67
|
* },
|
|
83
68
|
* on: {
|
|
84
69
|
* streamActivated: ({ title, image }) => console.log('Stream active:', title, image),
|
|
85
|
-
* playerClosed: () => console.log('Player closed')
|
|
86
|
-
* }
|
|
87
|
-
* });
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @example <caption>Internal provider mode</caption>
|
|
91
|
-
* ```ts
|
|
92
|
-
* import { openStreamPlayer } from '@streamscloud/embeddable/stream-player';
|
|
93
|
-
*
|
|
94
|
-
* openStreamsPlayer({
|
|
95
|
-
* ids: ['stream_123'],
|
|
96
|
-
* initiator: 'marketing-campaign',
|
|
97
|
-
* graphqlOrigin: 'https://api.example.com',
|
|
98
|
-
* mediaPageId: 'media-page-123',
|
|
99
|
-
* playerSettings: {
|
|
100
|
-
* locale: 'en',
|
|
101
|
-
* disableBackground: true,
|
|
102
|
-
* hideCloseButton: false,
|
|
103
|
-
* showStreamsCloudWatermark: false,
|
|
70
|
+
* playerClosed: () => console.log('Player closed'),
|
|
104
71
|
* },
|
|
105
|
-
* on: {
|
|
106
|
-
* streamActivated: ({ title, image }) => console.log('Stream active:', title, image),
|
|
107
|
-
* playerClosed: () => console.log('Player closed')
|
|
108
|
-
* }
|
|
109
72
|
* });
|
|
110
73
|
* ```
|
|
111
74
|
*/
|
|
112
|
-
export declare function openStreamsPlayer(init: {
|
|
113
|
-
dataProvider: IStreamsPlayerDataProvider;
|
|
114
|
-
mediaCenterConfig: IMediaCenterConfig;
|
|
115
|
-
amplificationParameters?: StreamAmplificationParameters;
|
|
116
|
-
playerSettings?: StreamsPlayerSettings;
|
|
117
|
-
on?: {
|
|
118
|
-
streamActivated?: (data: {
|
|
119
|
-
title: string;
|
|
120
|
-
image: string | null;
|
|
121
|
-
}) => void;
|
|
122
|
-
playerClosed?: () => void;
|
|
123
|
-
};
|
|
124
|
-
}): void;
|
|
125
75
|
export declare function openStreamsPlayer(init: {
|
|
126
76
|
dataProvider: IStreamsPlayerDataProvider;
|
|
127
77
|
postSocialInteractionsHandler?: IPostSocialInteractionsHandler;
|
|
@@ -136,22 +86,6 @@ export declare function openStreamsPlayer(init: {
|
|
|
136
86
|
playerClosed?: () => void;
|
|
137
87
|
};
|
|
138
88
|
}): void;
|
|
139
|
-
export declare function openStreamsPlayer(init: {
|
|
140
|
-
ids: string[];
|
|
141
|
-
initiator: string;
|
|
142
|
-
graphqlOrigin?: string;
|
|
143
|
-
initialId?: string;
|
|
144
|
-
mediaPageId?: string;
|
|
145
|
-
amplificationParameters?: StreamAmplificationParameters;
|
|
146
|
-
playerSettings?: StreamsPlayerSettings;
|
|
147
|
-
on?: {
|
|
148
|
-
streamActivated?: (data: {
|
|
149
|
-
title: string;
|
|
150
|
-
image: string | null;
|
|
151
|
-
}) => void;
|
|
152
|
-
playerClosed?: () => void;
|
|
153
|
-
};
|
|
154
|
-
}): void;
|
|
155
89
|
export type StreamsPlayerSettings = {
|
|
156
90
|
disableBackground?: boolean;
|
|
157
91
|
locale?: Locale;
|
|
@@ -1,36 +1,80 @@
|
|
|
1
|
-
import { toastrWarning } from '../../core/toastr';
|
|
2
|
-
import { InternalMediaCenterConfig } from '../../media-center/config/internal-media-center-config';
|
|
3
1
|
import {} from '../../media-center/config/types';
|
|
4
|
-
import { MediaCenterProxy } from '../../media-center/media-center';
|
|
5
2
|
import { CloseOrchestrator } from '../../ui/player/close-orchestrator';
|
|
6
3
|
import { ModalShadowHost } from '../../ui/shadow-dom';
|
|
7
|
-
import { InternalStreamAnalyticsHandler } from './internal-stream-analytics-handler';
|
|
8
|
-
import { InternalStreamsPlayerDataProvider } from './internal-streams-player-data-provider';
|
|
9
4
|
import { default as StreamsPlayerProxy } from './streams-player-proxy.svelte';
|
|
10
5
|
import { mount, unmount } from 'svelte';
|
|
11
6
|
export {};
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Opens the streams player modal.
|
|
9
|
+
*
|
|
10
|
+
* @param init Configuration options.
|
|
11
|
+
*
|
|
12
|
+
* Required
|
|
13
|
+
* @param {IStreamsPlayerDataProvider} init.dataProvider
|
|
14
|
+
* Provider that supplies the stream data to the player.
|
|
15
|
+
*
|
|
16
|
+
* Optional
|
|
17
|
+
* @param {IStreamAnalyticsHandler} [init.analyticsHandler]
|
|
18
|
+
* Optional analytics handler to capture player/stream analytics events.
|
|
19
|
+
* @param {IPostSocialInteractionsHandler} [init.postSocialInteractionsHandler]
|
|
20
|
+
* Handler for social interactions (like, share, etc.).
|
|
21
|
+
* @param {StreamAmplificationParameters} [init.amplificationParameters]
|
|
22
|
+
* Optional parameters to configure amplification behavior.
|
|
23
|
+
* @param {StreamsPlayerSettings} [init.playerSettings]
|
|
24
|
+
* Player UI and behavior settings.
|
|
25
|
+
*
|
|
26
|
+
* Fields of StreamsPlayerSettings:
|
|
27
|
+
* - {boolean} [disableBackground]
|
|
28
|
+
* If true, hides the player's background image.
|
|
29
|
+
* - {boolean} [hideCloseButton]
|
|
30
|
+
* If true, hides the close button.
|
|
31
|
+
* - {Locale} [locale='en']
|
|
32
|
+
* Localization for the player UI. Supported values: 'en' | 'no'.
|
|
33
|
+
* If omitted, the default locale 'en' is used.
|
|
34
|
+
* - {boolean} [showStreamsCloudWatermark]
|
|
35
|
+
* If true, shows the StreamsCloud watermark.
|
|
36
|
+
* - {'light' | 'dark'} [theme]
|
|
37
|
+
* Optional theme for the player UI.
|
|
38
|
+
*
|
|
39
|
+
* Events
|
|
40
|
+
* @param {{ streamActivated?: (data: { title: string; image: string | null }) => void; playerClosed?: () => void }} [init.on]
|
|
41
|
+
* Optional event handlers.
|
|
42
|
+
* @param {(data: { title: string; image: string | null }) => void} [init.on.streamActivated]
|
|
43
|
+
* Called when the stream becomes active. Receives a subset of data with title and image.
|
|
44
|
+
* @param {() => void} [init.on.playerClosed]
|
|
45
|
+
* Called after the player is fully closed (after unmount and removal from the DOM).
|
|
46
|
+
*
|
|
47
|
+
* @returns {void}
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { openStreamsPlayer } from '@streamscloud/embeddable/stream-player';
|
|
52
|
+
*
|
|
53
|
+
* openStreamsPlayer({
|
|
54
|
+
* dataProvider: myStreamProvider,
|
|
55
|
+
* analyticsHandler: myAnalyticsHandler,
|
|
56
|
+
* amplificationParameters: {
|
|
57
|
+
* // ...your amplification parameters
|
|
58
|
+
* },
|
|
59
|
+
* playerSettings: {
|
|
60
|
+
* // Locale defaults to 'en'; set 'no' to switch to Norwegian:
|
|
61
|
+
* locale: 'no',
|
|
62
|
+
* disableBackground: false,
|
|
63
|
+
* hideCloseButton: false,
|
|
64
|
+
* showStreamsCloudWatermark: true,
|
|
65
|
+
* theme: 'dark',
|
|
66
|
+
* },
|
|
67
|
+
* on: {
|
|
68
|
+
* streamActivated: ({ title, image }) => console.log('Stream active:', title, image),
|
|
69
|
+
* playerClosed: () => console.log('Player closed'),
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
13
74
|
export function openStreamsPlayer(init) {
|
|
14
|
-
const {
|
|
15
|
-
let dataProvider = init.dataProvider;
|
|
16
|
-
if (!dataProvider && ids?.length) {
|
|
17
|
-
dataProvider = new InternalStreamsPlayerDataProvider({ ids, initialId, graphqlOrigin, initiator });
|
|
18
|
-
}
|
|
19
|
-
if (!dataProvider) {
|
|
20
|
-
toastrWarning('Data provider is not specified.');
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
let mediaCenterConfig = init.mediaCenterConfig;
|
|
24
|
-
if (!mediaCenterConfig && init.mediaPageId) {
|
|
25
|
-
mediaCenterConfig = new InternalMediaCenterConfig({ mediaPageId: init.mediaPageId, graphqlOrigin, initiator });
|
|
26
|
-
}
|
|
27
|
-
let analyticsHandler = init.analyticsHandler;
|
|
28
|
-
if (!analyticsHandler && !init.dataProvider) {
|
|
29
|
-
// Only create internal analytics handler if using internal data provider
|
|
30
|
-
analyticsHandler = new InternalStreamAnalyticsHandler(graphqlOrigin);
|
|
31
|
-
}
|
|
75
|
+
const { dataProvider, analyticsHandler, postSocialInteractionsHandler, amplificationParameters, playerSettings, on } = init;
|
|
32
76
|
const shadowHost = new ModalShadowHost();
|
|
33
|
-
let mounted;
|
|
77
|
+
let mounted = null;
|
|
34
78
|
const makeCloseOrchestrator = () => new CloseOrchestrator({
|
|
35
79
|
closeFn: async () => {
|
|
36
80
|
await unmount(mounted);
|
|
@@ -41,47 +85,23 @@ export function openStreamsPlayer(init) {
|
|
|
41
85
|
},
|
|
42
86
|
canClose: !playerSettings?.hideCloseButton
|
|
43
87
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
init.on.streamActivated({ title: data.title, image: data.image });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
closeOrchestrator: makeCloseOrchestrator()
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
mounted = mount(StreamsPlayerProxy, {
|
|
68
|
-
target: shadowHost.shadowRoot,
|
|
69
|
-
props: {
|
|
70
|
-
dataProvider,
|
|
71
|
-
analyticsHandler,
|
|
72
|
-
amplificationParameters,
|
|
73
|
-
playerSettings,
|
|
74
|
-
postSocialInteractionsHandler,
|
|
75
|
-
closeOrchestrator: makeCloseOrchestrator(),
|
|
76
|
-
on: {
|
|
77
|
-
streamActivated: (data) => {
|
|
78
|
-
if (init.on?.streamActivated) {
|
|
79
|
-
init.on.streamActivated({ title: data.title, image: data.image });
|
|
80
|
-
}
|
|
88
|
+
mounted = mount(StreamsPlayerProxy, {
|
|
89
|
+
target: shadowHost.shadowRoot,
|
|
90
|
+
props: {
|
|
91
|
+
dataProvider,
|
|
92
|
+
analyticsHandler,
|
|
93
|
+
amplificationParameters,
|
|
94
|
+
playerSettings,
|
|
95
|
+
postSocialInteractionsHandler,
|
|
96
|
+
closeOrchestrator: makeCloseOrchestrator(),
|
|
97
|
+
on: {
|
|
98
|
+
streamActivated: (data) => {
|
|
99
|
+
if (init.on?.streamActivated) {
|
|
100
|
+
init.on.streamActivated({ title: data.title, image: data.image });
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
86
106
|
shadowHost.attachToBody();
|
|
87
107
|
}
|
|
@@ -9,7 +9,8 @@ export class StreamsPlayerBuffer extends DefaultChunksPlayerBuffer {
|
|
|
9
9
|
loadMoreChunks: async () => {
|
|
10
10
|
return await provider.loadMoreStreams();
|
|
11
11
|
},
|
|
12
|
-
loadChunkItems: provider.getStreamPages
|
|
12
|
+
loadChunkItems: provider.getStreamPages,
|
|
13
|
+
onEndReached: provider.onEndReached
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
};
|
|
10
10
|
var _a;
|
|
11
11
|
import { ContentPlayer, ContentPlayerConfig } from '../../content-player';
|
|
12
|
-
import { ContentPlayerSettings } from '../../content-player/content-player-settings';
|
|
12
|
+
import { ContentPlayerSettings } from '../../content-player/content-player-settings.svelte';
|
|
13
13
|
import { preloadImage } from '../../core/image-preloader';
|
|
14
14
|
import { mapToPostModel } from '../layout/models';
|
|
15
15
|
import { StreamPageViewer } from '../stream-page-viewer';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Locale } from '../../core/locale';
|
|
2
|
+
import type { ThemeValue } from '../../core/theme';
|
|
2
3
|
import type { IPostSocialInteractionsHandler } from '../../posts/social-interactions';
|
|
3
4
|
import type { StreamPageViewerModel } from '../stream-page-viewer';
|
|
4
5
|
import type { ICloseOrchestrator } from '../../ui/player/close-orchestrator';
|
|
@@ -38,7 +39,7 @@ export type StreamsPlayerProps = {
|
|
|
38
39
|
export type StreamsPlayerSettings = {
|
|
39
40
|
locale?: Locale;
|
|
40
41
|
showStreamsCloudWatermark?: boolean;
|
|
41
|
-
playerColors?: PlayerColors
|
|
42
|
+
playerColors?: Record<ThemeValue, PlayerColors>;
|
|
42
43
|
};
|
|
43
44
|
export type StreamAmplificationParameters = {
|
|
44
45
|
campaignId: string;
|
|
@@ -54,6 +55,7 @@ export interface IStreamsPlayerDataProvider {
|
|
|
54
55
|
items: StreamPageViewerModel[];
|
|
55
56
|
continuationToken: string | null;
|
|
56
57
|
}>;
|
|
58
|
+
onEndReached?: () => void;
|
|
57
59
|
}
|
|
58
60
|
export interface IStreamAnalyticsHandler {
|
|
59
61
|
setOrganizationId: (organizationId: string) => void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script lang="ts">import { Dropdown } from '../dropdown';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
import ButtonBase from './resources/button-base.svelte';
|
|
4
|
+
import ButtonTheme from './resources/button-theme.svelte';
|
|
5
|
+
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
6
|
+
let { type = 'button', disabled = false, autofocus = false, style = null, size = null, optionsPosition = 'bottom-start', on, children, options, rightOptions } = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<ButtonTheme style={style} size={size}>
|
|
10
|
+
<div class="options-button" class:options-button--disabled={disabled}>
|
|
11
|
+
{#if options}
|
|
12
|
+
<div class="options-button__options">
|
|
13
|
+
<Dropdown position={optionsPosition} disabled={disabled} offset={4}>
|
|
14
|
+
{#snippet trigger()}
|
|
15
|
+
<button class="options-button__options-trigger" type="button" disabled={disabled} aria-label="none">
|
|
16
|
+
<Icon src={IconChevronDown} />
|
|
17
|
+
</button>
|
|
18
|
+
{/snippet}
|
|
19
|
+
{@render options()}
|
|
20
|
+
</Dropdown>
|
|
21
|
+
</div>
|
|
22
|
+
<span class="options-button__options-separator">‍</span>
|
|
23
|
+
{/if}
|
|
24
|
+
<div class="options-button__trigger">
|
|
25
|
+
<ButtonBase type={type} disabled={disabled} autofocus={autofocus} on={on}>
|
|
26
|
+
{@render children()}
|
|
27
|
+
</ButtonBase>
|
|
28
|
+
</div>
|
|
29
|
+
{#if rightOptions}
|
|
30
|
+
<span class="options-button__options-separator">‍</span>
|
|
31
|
+
<div class="options-button__options">
|
|
32
|
+
<Dropdown position={optionsPosition} disabled={disabled} offset={4}>
|
|
33
|
+
{#snippet trigger()}
|
|
34
|
+
<button class="options-button__options-trigger" type="button" disabled={disabled} aria-label="none">
|
|
35
|
+
<Icon src={IconChevronDown} />
|
|
36
|
+
</button>
|
|
37
|
+
{/snippet}
|
|
38
|
+
{@render rightOptions()}
|
|
39
|
+
</Dropdown>
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
</ButtonTheme>
|
|
44
|
+
|
|
45
|
+
<style>@keyframes fadeIn {
|
|
46
|
+
0% {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
50% {
|
|
50
|
+
opacity: 0.4;
|
|
51
|
+
}
|
|
52
|
+
100% {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.options-button {
|
|
57
|
+
--_options-button--font--color: var(--button--font--color, black);
|
|
58
|
+
--_options-button--font-weight: var(--button--font-weight, 400);
|
|
59
|
+
--_options-button--text--font-size: var(--button--text--font-size, 0.875em);
|
|
60
|
+
--_options-button--background: var(--button--background, white);
|
|
61
|
+
--_options-button--background--hover: var(--button--background--hover, var(--_options-button--background));
|
|
62
|
+
--_options-button--background--active: var(--button--background--active, var(--_options-button--background));
|
|
63
|
+
--_options-button--background--disabled: var(--button--background--disabled, var(--_options-button--background));
|
|
64
|
+
--_options-button--border: var(--button--border, none);
|
|
65
|
+
--_options-button--border-radius: var(--button--border-radius, 0.25em);
|
|
66
|
+
--_options-button--box-shadow: var(--button--box-shadow, none);
|
|
67
|
+
--_options-button--padding--vertical: var(--button--padding--vertical, 0);
|
|
68
|
+
--_options-button--min-width: var(--button--min-width, 0);
|
|
69
|
+
--_options-button--height: var(--button--height, 2em);
|
|
70
|
+
--_options-button--separator--border: 1px solid var(--_options-button--font--color);
|
|
71
|
+
--_options-button--dropdown--min-width: var(--options-button--dropdown--min-width, 10em);
|
|
72
|
+
font-weight: var(--_options-button--font-weight);
|
|
73
|
+
color: var(--_options-button--font--color);
|
|
74
|
+
background: var(--_options-button--background);
|
|
75
|
+
border: var(--_options-button--border);
|
|
76
|
+
border-radius: var(--_options-button--border-radius);
|
|
77
|
+
min-width: var(--_options-button--min-width);
|
|
78
|
+
height: var(--_options-button--height);
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
vertical-align: middle;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
box-shadow: var(--_options-button--box-shadow);
|
|
84
|
+
}
|
|
85
|
+
.options-button--disabled {
|
|
86
|
+
background: var(--_options-button--background--disabled);
|
|
87
|
+
}
|
|
88
|
+
.options-button__trigger {
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
height: 100%;
|
|
91
|
+
flex: 1;
|
|
92
|
+
--button--min-width: 100%;
|
|
93
|
+
--button--box-shadow: none;
|
|
94
|
+
--button--border: none;
|
|
95
|
+
--button--border--disabled: none;
|
|
96
|
+
--button--height: 100%;
|
|
97
|
+
--button--background: transparent;
|
|
98
|
+
--button--background--disabled: transparent;
|
|
99
|
+
}
|
|
100
|
+
.options-button__options-trigger {
|
|
101
|
+
height: 100%;
|
|
102
|
+
font-size: var(--_options-button--text--font-size);
|
|
103
|
+
border-radius: var(--_options-button--border-radius);
|
|
104
|
+
}
|
|
105
|
+
.options-button__options {
|
|
106
|
+
height: 100%;
|
|
107
|
+
--dropdown-item--min-width: var(--_options-button--dropdown--min-width);
|
|
108
|
+
--button--min-width: 100%;
|
|
109
|
+
--button--justify-content: flex-start;
|
|
110
|
+
}
|
|
111
|
+
.options-button__options-trigger {
|
|
112
|
+
padding: var(--_options-button--padding--vertical) 0.5em;
|
|
113
|
+
}
|
|
114
|
+
.options-button__options-trigger:not(:disabled):hover {
|
|
115
|
+
background: var(--_options-button--background--hover);
|
|
116
|
+
}
|
|
117
|
+
.options-button__options-trigger:not(:disabled):active {
|
|
118
|
+
background: var(--_options-button--background--active);
|
|
119
|
+
}
|
|
120
|
+
.options-button__options-separator {
|
|
121
|
+
border-right: var(--_options-button--separator--border);
|
|
122
|
+
height: var(--_options-button--text--font-size);
|
|
123
|
+
}</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type DropdownPosition } from '../dropdown';
|
|
2
|
+
import type { ButtonStyle, ButtonSize } from './resources/button-types';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
type Props = {
|
|
5
|
+
type?: 'button' | 'submit' | 'reset';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
autofocus?: boolean;
|
|
8
|
+
style?: ButtonStyle | null;
|
|
9
|
+
size?: ButtonSize | null;
|
|
10
|
+
optionsPosition?: DropdownPosition;
|
|
11
|
+
on?: {
|
|
12
|
+
click: (e: MouseEvent) => void;
|
|
13
|
+
};
|
|
14
|
+
children: Snippet;
|
|
15
|
+
options?: Snippet;
|
|
16
|
+
rightOptions?: Snippet;
|
|
17
|
+
};
|
|
18
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
20
|
+
export default Cmp;
|
package/dist/ui/button/index.js
CHANGED
|
@@ -38,6 +38,20 @@ let { style = undefined, size = ButtonSize.Standard, children } = $props();
|
|
|
38
38
|
display: contents;
|
|
39
39
|
/*Size*/
|
|
40
40
|
}
|
|
41
|
+
.button-theme--standard {
|
|
42
|
+
--button--font--color: var(--sc-mc-color--text-primary);
|
|
43
|
+
--button--background: var(--sc-mc-color--bg-button);
|
|
44
|
+
--button--background--hover: #f9fafb;
|
|
45
|
+
--button--background--active: #f2f2f3;
|
|
46
|
+
--button--background--disabled: #f2f2f3;
|
|
47
|
+
--button--border: 1px solid #e5e7eb;
|
|
48
|
+
}
|
|
49
|
+
:global([data-theme="dark"]) .button-theme--standard {
|
|
50
|
+
--button--background--hover: #1f2937;
|
|
51
|
+
--button--background--active: #374151;
|
|
52
|
+
--button--background--disabled: #374151;
|
|
53
|
+
--button--border: 1px solid #4b5563;
|
|
54
|
+
}
|
|
41
55
|
.button-theme--size-standard {
|
|
42
56
|
--button--height: 2em;
|
|
43
57
|
--button--text--font-size: 0.75em;
|
|
@@ -49,6 +63,6 @@ let { style = undefined, size = ButtonSize.Standard, children } = $props();
|
|
|
49
63
|
--button--text--font-size: 0.9375em;
|
|
50
64
|
}
|
|
51
65
|
.button-theme--size-small {
|
|
52
|
-
--button--height: 1.
|
|
53
|
-
--button--text--font-size: 0.
|
|
66
|
+
--button--height: 1.75em;
|
|
67
|
+
--button--text--font-size: 0.75em;
|
|
54
68
|
}</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PlayerColors, type IPlayerColors } from './player-colors';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { PlayerColors } from './player-colors';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type IPlayerColors = {
|
|
2
2
|
brand: string | null;
|
|
3
3
|
button: string | null;
|
|
4
4
|
buttonInactive: string | null;
|
|
@@ -10,3 +10,16 @@ export type PlayerColors = {
|
|
|
10
10
|
salePrice: string | null;
|
|
11
11
|
sidebarBackground: string | null;
|
|
12
12
|
} | null;
|
|
13
|
+
export declare class PlayerColors implements NonNullable<IPlayerColors> {
|
|
14
|
+
brand: string | null;
|
|
15
|
+
button: string | null;
|
|
16
|
+
buttonInactive: string | null;
|
|
17
|
+
cardButton: string | null;
|
|
18
|
+
cardBackground: string | null;
|
|
19
|
+
menuBackground: string | null;
|
|
20
|
+
playerBackground: string | null;
|
|
21
|
+
price: string | null;
|
|
22
|
+
salePrice: string | null;
|
|
23
|
+
sidebarBackground: string | null;
|
|
24
|
+
constructor(init: IPlayerColors | null | undefined);
|
|
25
|
+
}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export class PlayerColors {
|
|
2
|
+
brand;
|
|
3
|
+
button;
|
|
4
|
+
buttonInactive;
|
|
5
|
+
cardButton;
|
|
6
|
+
cardBackground;
|
|
7
|
+
menuBackground;
|
|
8
|
+
playerBackground;
|
|
9
|
+
price;
|
|
10
|
+
salePrice;
|
|
11
|
+
sidebarBackground;
|
|
12
|
+
constructor(init) {
|
|
13
|
+
this.brand = init?.brand ?? null;
|
|
14
|
+
this.button = init?.button ?? null;
|
|
15
|
+
this.buttonInactive = init?.buttonInactive ?? null;
|
|
16
|
+
this.cardButton = init?.cardButton ?? null;
|
|
17
|
+
this.cardBackground = init?.cardBackground ?? null;
|
|
18
|
+
this.menuBackground = init?.menuBackground ?? null;
|
|
19
|
+
this.playerBackground = init?.playerBackground ?? null;
|
|
20
|
+
this.price = init?.price ?? null;
|
|
21
|
+
this.salePrice = init?.salePrice ?? null;
|
|
22
|
+
this.sidebarBackground = init?.sidebarBackground ?? null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -9,6 +9,7 @@ export declare class DefaultChunksPlayerBuffer<TItem extends WithId, TChunk exte
|
|
|
9
9
|
readonly navigationDisabled: boolean;
|
|
10
10
|
readonly animationDuration = 500;
|
|
11
11
|
private _playerChunksManager;
|
|
12
|
+
private _onEndReachedFn;
|
|
12
13
|
constructor(provider: IChunksPlayerDataProvider<TItem, TChunk>);
|
|
13
14
|
get activeChunk(): import("./chunks-player-buffer").PlayerChunk<TItem, TChunk>;
|
|
14
15
|
setActiveChunkItemIndex: (index: number) => void;
|
|
@@ -5,12 +5,14 @@ export class DefaultChunksPlayerBuffer {
|
|
|
5
5
|
loaded = $derived.by(() => this._playerChunksManager.flattenedChunkItems);
|
|
6
6
|
currentIndex = $derived.by(() => this._playerChunksManager.flattenedActiveChunkItemIndex);
|
|
7
7
|
current = $derived(this.currentIndex >= 0 ? this.loaded[this.currentIndex] : null);
|
|
8
|
-
canLoadNext = $derived(this.currentIndex < this.loaded.length - 1);
|
|
8
|
+
canLoadNext = $derived.by(() => this.currentIndex < this.loaded.length - 1 || !!this._onEndReachedFn);
|
|
9
9
|
canLoadPrevious = $derived(this.currentIndex > 0);
|
|
10
10
|
navigationDisabled = $derived(!this.canLoadNext && !this.canLoadPrevious);
|
|
11
11
|
animationDuration = 500;
|
|
12
12
|
_playerChunksManager;
|
|
13
|
+
_onEndReachedFn;
|
|
13
14
|
constructor(provider) {
|
|
15
|
+
this._onEndReachedFn = provider.onEndReached;
|
|
14
16
|
// Throttle navigation methods
|
|
15
17
|
this.loadNext = Utils.throttle(this.loadNext, this.animationDuration);
|
|
16
18
|
this.loadPrevious = Utils.throttle(this.loadPrevious, this.animationDuration);
|
|
@@ -30,6 +32,10 @@ export class DefaultChunksPlayerBuffer {
|
|
|
30
32
|
if (!this.canLoadNext) {
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
35
|
+
if (this.currentIndex >= this.loaded.length - 1) {
|
|
36
|
+
this._onEndReachedFn?.();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
33
39
|
this._playerChunksManager.activateItemAtFlattenedIndex(this.currentIndex + 1);
|
|
34
40
|
};
|
|
35
41
|
loadPrevious = async () => {
|
|
@@ -16,6 +16,7 @@ export declare class DefaultFeedPlayerBuffer<T extends WithId> implements IFeedP
|
|
|
16
16
|
private _loaded;
|
|
17
17
|
private _loadMoreFn;
|
|
18
18
|
private _fetchDeferred;
|
|
19
|
+
private _onEndReachedFn;
|
|
19
20
|
constructor(provider: IFeedPlayerDataProvider<T>);
|
|
20
21
|
loadNext: () => Promise<void>;
|
|
21
22
|
loadPrevious: () => Promise<void>;
|