@vouchfor/embeds 0.0.0-experiment.51a4ad7 → 0.0.0-experiment.51c7ed5

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/embeds",
3
- "version": "0.0.0-experiment.51a4ad7",
3
+ "version": "0.0.0-experiment.51c7ed5",
4
4
  "license": "MIT",
5
5
  "author": "Aaron Williams",
6
6
  "main": "dist/es/embeds.js",
@@ -43,8 +43,8 @@
43
43
  "dependencies": {
44
44
  "@a11y/focus-trap": "^1.0.5",
45
45
  "@lit/task": "^1.0.0",
46
- "@vouchfor/canvas-video": "0.0.0-experiment.51a4ad7",
47
- "@vouchfor/media-player": "0.0.0-experiment.51a4ad7",
46
+ "@vouchfor/canvas-video": "0.0.0-experiment.51c7ed5",
47
+ "@vouchfor/media-player": "0.0.0-experiment.51c7ed5",
48
48
  "uuid": "^9.0.1"
49
49
  },
50
50
  "peerDependencies": {
@@ -63,7 +63,7 @@
63
63
  "@types/mocha": "^10.0.6",
64
64
  "@vouchfor/eslint-config": "^1.0.1",
65
65
  "@vouchfor/prettier-config": "^1.0.1",
66
- "@vouchfor/video-utils": "0.0.0-experiment.51a4ad7",
66
+ "@vouchfor/video-utils": "0.0.0-experiment.51c7ed5",
67
67
  "@web/dev-server-esbuild": "^1.0.2",
68
68
  "@web/test-runner": "^0.18.1",
69
69
  "@web/test-runner-browserstack": "^0.7.1",
@@ -147,9 +147,9 @@ class TrackingController implements ReactiveController {
147
147
  private _handleVideoTimeUpdate = ({ detail: { id, key, node } }: CustomEvent<VideoEventDetail>) => {
148
148
  if (
149
149
  // We only want to count any time that the video is actually playing
150
- !this.host.paused
150
+ !this.host.paused &&
151
151
  // Only update the latest time if this event fires for the currently active video
152
- // id === this.host.scene?.video?.id
152
+ id === this.host.scene?.video?.id
153
153
  ) {
154
154
  this._currentlyPlayingVideo = { id, key, node };
155
155
  this._streamLatestTime[key] = node.currentTime;
@@ -3,9 +3,8 @@ import { customElement, property, state } from 'lit/decorators.js';
3
3
  import { ifDefined } from 'lit/directives/if-defined.js';
4
4
  import { createRef, ref } from 'lit/directives/ref.js';
5
5
 
6
- import type { TemplateInstance } from '@vouchfor/canvas-video';
6
+ import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
7
7
  import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
8
- import type { Vouch } from '@vouchfor/video-utils';
9
8
  import type { PropertyValueMap } from 'lit';
10
9
  import type { Environment } from '~/utils/env';
11
10
 
@@ -15,8 +14,10 @@ import { TrackingController } from './controllers/tracking';
15
14
 
16
15
  import '@vouchfor/media-player';
17
16
 
18
- type PlayerEmbedProps = Pick<MediaPlayerProps, 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'> & {
19
- data?: Vouch;
17
+ type PlayerEmbedProps = Pick<
18
+ MediaPlayerProps,
19
+ 'data' | 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'
20
+ > & {
20
21
  env: Environment;
21
22
  apiKey: string;
22
23
  disableTracking?: boolean;
@@ -161,17 +162,17 @@ class PlayerEmbed extends LitElement {
161
162
  return this._mediaPlayerRef.value?.muted ?? false;
162
163
  }
163
164
 
164
- // get scene(): Scene | null {
165
- // return this._mediaPlayerRef.value?.scene ?? null;
166
- // }
165
+ get scene(): Scene | null {
166
+ return this._mediaPlayerRef.value?.scene ?? null;
167
+ }
167
168
 
168
- // get scenes(): Scene[] {
169
- // return this._mediaPlayerRef.value?.scenes ?? [];
170
- // }
169
+ get scenes(): Scene[] {
170
+ return this._mediaPlayerRef.value?.scenes ?? [];
171
+ }
171
172
 
172
- // get sceneConfig(): Scenes | null {
173
- // return this._mediaPlayerRef.value?.sceneConfig ?? null;
174
- // }
173
+ get sceneConfig(): Scenes | null {
174
+ return this._mediaPlayerRef.value?.sceneConfig ?? null;
175
+ }
175
176
 
176
177
  get videoState() {
177
178
  return this._mediaPlayerRef.value?.videoState;
@@ -193,9 +194,9 @@ class PlayerEmbed extends LitElement {
193
194
  this._mediaPlayerRef.value?.reset(time, play);
194
195
  }
195
196
 
196
- // setScene(index: number) {
197
- // this._mediaPlayerRef.value?.setScene(index);
198
- // }
197
+ setScene(index: number) {
198
+ this._mediaPlayerRef.value?.setScene(index);
199
+ }
199
200
 
200
201
  private _renderStyles() {
201
202
  if (!this.aspectRatio) {
@@ -237,6 +238,8 @@ class PlayerEmbed extends LitElement {
237
238
  ${this.eventController.register()}
238
239
  ?autoplay=${this.autoplay}
239
240
  ?loading=${this.fetching}
241
+ .data=${this.vouch}
242
+ .template=${this.template}
240
243
  aspectRatio=${ifDefined(this.aspectRatio)}
241
244
  preload=${ifDefined(this.preload)}
242
245
  language=${ifDefined(this.language)}
@@ -27,7 +27,7 @@ function playerLoaded(player: PlayerEmbed) {
27
27
  );
28
28
  }
29
29
 
30
- describe.skip('Embeds', () => {
30
+ describe('Embeds', () => {
31
31
  it('Sends correct tracking events', async () => {
32
32
  const player = await fixture<PlayerEmbed>(
33
33
  html`<vouch-embed-player env="dev" .data=${data} aspectratio=${1}></vouch-embed-player>`