@streamscloud/embeddable 2.8.0 → 2.8.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,6 +1,6 @@
1
1
  import { isLocale } from '../../core/locale';
2
2
  export class ShortVideoProductLocalization {
3
- beforeNowPrefix = $state('Before');
3
+ beforeNowPrefix;
4
4
  constructor(init) {
5
5
  this.beforeNowPrefix = isLocale(init) ? loc.beforeNowPrefix[init] : init?.beforeNowPrefix || loc.beforeNowPrefix.en;
6
6
  }
@@ -2,5 +2,5 @@ export const isShortVideosProviderInit = (init) => {
2
2
  return typeof init === 'object' && init !== null && 'shortVideosProvider' in init;
3
3
  };
4
4
  export function isIdsInit(init) {
5
- return typeof init === 'object' && init !== null && 'ids' in init && 'graphqlUrl' in init;
5
+ return typeof init === 'object' && init !== null && 'ids' in init && 'graphqlOrigin' in init;
6
6
  }
@@ -4,74 +4,74 @@ export const generateStreamLayoutStyles = (styles) => {
4
4
  if (!styles) {
5
5
  return '';
6
6
  }
7
- const values = [`background-color: ${transformColorValue(styles.backgroundColor)};`, `font-family: ${mapFontFamily(styles.fontFamily)};`];
8
- return values.join('');
7
+ const values = [`background-color: ${transformColorValue(styles.backgroundColor)}`, `font-family: ${mapFontFamily(styles.fontFamily)}`];
8
+ return values.join(';');
9
9
  };
10
10
  export const generateContainerStyles = (styles) => {
11
11
  styles = styles || {};
12
12
  const values = [
13
- 'display: flex;',
14
- 'flex-direction: column;',
15
- `width: ${transformCssValue(styles.width, 'auto')};`,
16
- `height: ${transformCssValue(styles.height, 'fit-content')};`,
17
- `aspect-ratio: ${styles.aspectRatio || 'auto'};`,
18
- `gap: ${transformNumericValue(styles.gap)};`,
19
- `padding-top: ${transformNumericValue(styles.paddingTop)};`,
20
- `padding-right: ${transformNumericValue(styles.paddingRight)};`,
21
- `padding-bottom: ${transformNumericValue(styles.paddingBottom)};`,
22
- `padding-left: ${transformNumericValue(styles.paddingLeft)};`,
23
- `background-color: ${transformColorValue(styles.backgroundColor)};`,
24
- `border-width: ${styles.borderColor ? '1px' : '0'};`,
25
- `border-radius: ${transformNumericValue(styles.borderRadius)};`,
26
- `border-color: ${transformColorValue(styles.borderColor)};`,
27
- `overflow: ${styles.borderRadius ? 'hidden' : 'visible'};`
13
+ 'display: flex',
14
+ 'flex-direction: column',
15
+ `width: ${transformCssValue(styles.width, 'auto')}`,
16
+ `height: ${transformCssValue(styles.height, 'fit-content')}`,
17
+ `aspect-ratio: ${styles.aspectRatio || 'auto'}`,
18
+ `gap: ${transformNumericValue(styles.gap)}`,
19
+ `padding-top: ${transformNumericValue(styles.paddingTop)}`,
20
+ `padding-right: ${transformNumericValue(styles.paddingRight)}`,
21
+ `padding-bottom: ${transformNumericValue(styles.paddingBottom)}`,
22
+ `padding-left: ${transformNumericValue(styles.paddingLeft)}`,
23
+ `background-color: ${transformColorValue(styles.backgroundColor)}`,
24
+ `border-width: ${styles.borderColor ? '1px' : '0'}`,
25
+ `border-radius: ${transformNumericValue(styles.borderRadius)}`,
26
+ `border-color: ${transformColorValue(styles.borderColor)}`,
27
+ `overflow: ${styles.borderRadius ? 'hidden' : 'visible'}`
28
28
  ];
29
29
  if (styles.direction) {
30
- values.push(`display: flex;`);
31
- values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'};`);
30
+ values.push(`display: flex`);
31
+ values.push(`flex-direction: ${styles.direction === StreamElementStyleDirection.Horizontal ? 'row' : 'column'}`);
32
32
  }
33
- return values.join('');
33
+ return values.join(';');
34
34
  };
35
35
  export const generateAnnotationStyles = (styles, placement) => {
36
- const values = [`height: ${transformNumericValue(styles.size)};`, 'position: absolute;'];
36
+ const values = [`height: ${transformNumericValue(styles.height)}`, `aspect-ratio: ${styles.aspectRatio}`, 'position: absolute'];
37
37
  switch (placement) {
38
38
  case AnnotationStreamElementPlacement.TopLeft:
39
- values.push(`top: ${transformNumericValue(styles.offsetY)};`);
40
- values.push(`left: ${transformNumericValue(styles.offsetX)};`);
39
+ values.push(`top: ${transformNumericValue(styles.offsetY)}`);
40
+ values.push(`left: ${transformNumericValue(styles.offsetX)}`);
41
41
  break;
42
42
  case AnnotationStreamElementPlacement.TopRight:
43
- values.push(`top: ${transformNumericValue(styles.offsetY)};`);
43
+ values.push(`top: ${transformNumericValue(styles.offsetY)}`);
44
44
  values.push(`right: ${transformNumericValue(styles.offsetX)}`);
45
45
  break;
46
46
  case AnnotationStreamElementPlacement.BottomLeft:
47
- values.push(`bottom: ${transformNumericValue(styles.offsetY)};`);
48
- values.push(`left: ${transformNumericValue(styles.offsetX)};`);
47
+ values.push(`bottom: ${transformNumericValue(styles.offsetY)}`);
48
+ values.push(`left: ${transformNumericValue(styles.offsetX)}`);
49
49
  break;
50
50
  case AnnotationStreamElementPlacement.BottomRight:
51
- values.push(`bottom: ${transformNumericValue(styles.offsetY)};`);
52
- values.push(`right: ${transformNumericValue(styles.offsetX)};`);
51
+ values.push(`bottom: ${transformNumericValue(styles.offsetY)}`);
52
+ values.push(`right: ${transformNumericValue(styles.offsetX)}`);
53
53
  break;
54
54
  default:
55
55
  Utils.assertUnreachable(placement);
56
56
  }
57
- return values.join('');
57
+ return values.join(';');
58
58
  };
59
59
  export const generateTextStyles = (styles) => {
60
60
  styles = styles || {};
61
61
  const values = [
62
- `font-family: ${mapFontFamily(styles.fontFamily)};`,
63
- `font-size: ${transformFontSizeValue(styles.fontSize)};`,
64
- `font-weight: ${mapFontWeight(styles.fontWeight)};`,
65
- `line-height: ${transformNumericValue(styles.lineHeight, '1.2')};`,
66
- `text-align: ${mapTextAlign(styles.textAlign)};`,
67
- `color: ${transformColorValue(styles.color)};`
62
+ `font-family: ${mapFontFamily(styles.fontFamily)}`,
63
+ `font-size: ${transformFontSizeValue(styles.fontSize)}`,
64
+ `font-weight: ${mapFontWeight(styles.fontWeight)}`,
65
+ `line-height: ${transformNumericValue(styles.lineHeight, '1.2')}`,
66
+ `text-align: ${mapTextAlign(styles.textAlign)}`,
67
+ `color: ${transformColorValue(styles.color)}`
68
68
  ];
69
- return values.join('');
69
+ return values.join(';');
70
70
  };
71
71
  export const generateImageStyles = (styles) => {
72
72
  styles = styles || {};
73
- const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)};`];
74
- return imageStyles.join('');
73
+ const imageStyles = [`object-fit: ${mapMediaFit(styles.mediaFit)}`];
74
+ return imageStyles.join(';');
75
75
  };
76
76
  export const mapFontFamily = (value) => {
77
77
  switch (value) {
@@ -5,7 +5,8 @@ export type StreamLayoutStyles = {
5
5
  fontFamily?: StreamElementStyleFontFamily | null;
6
6
  };
7
7
  export type AnnotationStreamElementStyles = {
8
- size: number;
8
+ height: number;
9
+ aspectRatio: number;
9
10
  offsetX: number;
10
11
  offsetY: number;
11
12
  };
@@ -27,7 +27,7 @@ import { StreamPlayerLocalization } from './stream-player-localization';
27
27
  import { StreamPlayerUiManager } from './ui-manager.svelte';
28
28
  import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
29
29
  import { onMount } from 'svelte';
30
- let { streamId, graphqlOrigin, localization: localizationInit, on } = $props();
30
+ let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, on } = $props();
31
31
  const localization = $derived(new StreamPlayerLocalization(localizationInit));
32
32
  let model = $state(null);
33
33
  let buffer = $state.raw(null);
@@ -174,6 +174,13 @@ const onProgress = (pageId, videoId, progress) => {
174
174
  <Loading positionAbsoluteCenter={true} timeout={600} />
175
175
  {/if}
176
176
  <div class="stream-player" style={uiManager.globalCssVariables}>
177
+ {#if showStreamsCloudWatermark}
178
+ <div class="stream-player__watermark">
179
+ <a href="https://streamscloud.com/" tabindex="-1" aria-label="none">
180
+ <img src="https://embedabble-assets.streamscloud-cdn.com/watermark.svg" alt="StreamsCloud" />
181
+ </a>
182
+ </div>
183
+ {/if}
177
184
  {#if buffer && model}
178
185
  <SpotlightLayout ratio={9 / 16} on={{ dimensionsChanged: handleDimensionsChanged }}>
179
186
  <div class="stream-player__content" use:contentMounted>
@@ -265,6 +272,11 @@ const onProgress = (pageId, videoId, progress) => {
265
272
  padding: 0;
266
273
  }
267
274
  }
275
+ .stream-player__watermark {
276
+ position: absolute;
277
+ bottom: 5rem;
278
+ left: 20rem;
279
+ }
268
280
  .stream-player__content {
269
281
  width: 100%;
270
282
  height: 100%;
@@ -4,6 +4,7 @@ type Props = {
4
4
  streamId: string;
5
5
  localization: IStreamPlayerLocalization | Locale;
6
6
  graphqlOrigin?: string;
7
+ showStreamsCloudWatermark?: boolean;
7
8
  on?: {
8
9
  closePlayer?: () => void;
9
10
  streamActivated?: (data: {
@@ -27,6 +27,7 @@ export declare const openStreamPlayer: (init: {
27
27
  streamId: string;
28
28
  graphqlOrigin?: string;
29
29
  localization?: IStreamPlayerLocalization | "en" | "no";
30
+ showStreamsCloudWatermark?: boolean;
30
31
  on?: {
31
32
  streamActivated?: (data: {
32
33
  title: string;
@@ -27,7 +27,7 @@ import { mount, unmount } from 'svelte';
27
27
  * ```
28
28
  */
29
29
  export const openStreamPlayer = (init) => {
30
- const { streamId, graphqlOrigin, localization } = init;
30
+ const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark } = init;
31
31
  const shadowHost = new ShadowHost();
32
32
  const mounted = mount(StreamPlayer, {
33
33
  target: shadowHost.shadowRoot,
@@ -35,6 +35,7 @@ export const openStreamPlayer = (init) => {
35
35
  streamId,
36
36
  graphqlOrigin,
37
37
  localization: getLocale(localization),
38
+ showStreamsCloudWatermark,
38
39
  on: {
39
40
  streamActivated: (data) => {
40
41
  AppEventsTracker.setOrganizationId(data.ownerId);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "author": "StreamsCloud",
5
5
  "repository": "https://github.com/StreamsCloud/streamscloud-frontend-packages.git",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "dev": "vite dev --port 3010",
9
9
  "build": "svelte-package --tsconfig ./tsconfig.app.json && prettier --write --plugin prettier-plugin-svelte . && eslint --fix .",
10
- "publish": "npm publish --access public",
10
+ "build-publish": "npm run build && npm publish --access public",
11
11
  "pack": "npm run build && npm pack",
12
12
  "preview": "vite preview",
13
13
  "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json",
@@ -97,7 +97,7 @@
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@fluentui/svg-icons": "^1.1.292",
100
- "@streamscloud/streams-analytics-collector": "latest",
100
+ "@streamscloud/streams-analytics-collector": "^2.0.1",
101
101
  "@urql/core": "^5.1.1",
102
102
  "dompurify": "^3.2.6",
103
103
  "mobile-detect": "^1.4.5",