@vouchfor/embeds 0.0.0-experiment.f77dbf9 → 0.0.0-experiment.f90d920
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/embeds.js +6 -6
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/src/components/PlayerEmbed/index.d.ts +1 -1
- package/dist/iife/dialog-embed/embed.iife.js +108 -108
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +108 -108
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +123 -123
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +4 -4
- package/src/components/PlayerEmbed/controllers/tracking/index.ts +5 -5
- package/src/components/PlayerEmbed/index.ts +2 -2
- package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +5 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vouchfor/embeds",
|
3
|
-
"version": "0.0.0-experiment.
|
3
|
+
"version": "0.0.0-experiment.f90d920",
|
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.
|
47
|
-
"@vouchfor/media-player": "0.0.0-experiment.
|
46
|
+
"@vouchfor/canvas-video": "0.0.0-experiment.f90d920",
|
47
|
+
"@vouchfor/media-player": "0.0.0-experiment.f90d920",
|
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.
|
66
|
+
"@vouchfor/video-utils": "0.0.0-experiment.f90d920",
|
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",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PlayerEmbed } from '../..';
|
2
|
-
import type {
|
2
|
+
import type { MediaEventDetail } from '@vouchfor/media-player';
|
3
3
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
4
4
|
|
5
5
|
import { findVouchId, getReportingMetadata, getUids } from './utils';
|
@@ -41,7 +41,7 @@ class TrackingController implements ReactiveController {
|
|
41
41
|
private _answersViewed: BooleanMap = {};
|
42
42
|
private _streamStartTime: TimeMap = {};
|
43
43
|
private _streamLatestTime: TimeMap = {};
|
44
|
-
private _currentlyPlayingVideo:
|
44
|
+
private _currentlyPlayingVideo: MediaEventDetail | null = null;
|
45
45
|
|
46
46
|
constructor(host: PlayerEmbedHost) {
|
47
47
|
this.host = host;
|
@@ -134,7 +134,7 @@ class TrackingController implements ReactiveController {
|
|
134
134
|
}
|
135
135
|
};
|
136
136
|
|
137
|
-
private _handleVideoPlay = ({ detail: { id, key } }: CustomEvent<
|
137
|
+
private _handleVideoPlay = ({ detail: { id, key } }: CustomEvent<MediaEventDetail>) => {
|
138
138
|
// Only increment play count once per session
|
139
139
|
if (!this._answersViewed[key]) {
|
140
140
|
this._createTrackingEvent('VOUCH_RESPONSE_VIEWED', {
|
@@ -144,7 +144,7 @@ class TrackingController implements ReactiveController {
|
|
144
144
|
}
|
145
145
|
};
|
146
146
|
|
147
|
-
private _handleVideoTimeUpdate = ({ detail: { id, key, node } }: CustomEvent<
|
147
|
+
private _handleVideoTimeUpdate = ({ detail: { id, key, node } }: CustomEvent<MediaEventDetail>) => {
|
148
148
|
if (
|
149
149
|
// We only want to count any time that the video is actually playing
|
150
150
|
!this.host.paused
|
@@ -161,7 +161,7 @@ class TrackingController implements ReactiveController {
|
|
161
161
|
}
|
162
162
|
};
|
163
163
|
|
164
|
-
private _handleVideoPause = ({ detail: { id, key } }: CustomEvent<
|
164
|
+
private _handleVideoPause = ({ detail: { id, key } }: CustomEvent<MediaEventDetail>) => {
|
165
165
|
if (this._streamLatestTime[key] > this._streamStartTime[key] + MINIMUM_SEND_THRESHOLD) {
|
166
166
|
this._createTrackingEvent('VIDEO_STREAMED', {
|
167
167
|
answerId: id,
|
@@ -173,8 +173,8 @@ class PlayerEmbed extends LitElement {
|
|
173
173
|
// return this._mediaPlayerRef.value?.sceneConfig ?? null;
|
174
174
|
// }
|
175
175
|
|
176
|
-
get
|
177
|
-
return this._mediaPlayerRef.value?.
|
176
|
+
get mediaState() {
|
177
|
+
return this._mediaPlayerRef.value?.mediaState;
|
178
178
|
}
|
179
179
|
|
180
180
|
get mediaPlayer() {
|
@@ -4,7 +4,7 @@ import { html } from 'lit';
|
|
4
4
|
import sinon from 'sinon';
|
5
5
|
|
6
6
|
import type { PlayerEmbed } from '../index.js';
|
7
|
-
import type {
|
7
|
+
import type { MediaMap } from '@vouchfor/media-player';
|
8
8
|
|
9
9
|
import { data } from './data.js';
|
10
10
|
|
@@ -13,7 +13,7 @@ import { data } from './data.js';
|
|
13
13
|
// https://modern-web.dev/guides/test-runner/typescript/
|
14
14
|
import '../../../test/lib/embeds.js';
|
15
15
|
|
16
|
-
function getVideo(videos:
|
16
|
+
function getVideo(videos: MediaMap) {
|
17
17
|
return Object.values(videos)[0];
|
18
18
|
}
|
19
19
|
|
@@ -45,14 +45,14 @@ describe.skip('Embeds', () => {
|
|
45
45
|
await waitUntil(
|
46
46
|
() => {
|
47
47
|
// Video plays for 3 seconds
|
48
|
-
return (getVideo(player.mediaPlayer!.
|
48
|
+
return (getVideo(player.mediaPlayer!.media)?.node?.currentTime ?? 0) > 3;
|
49
49
|
},
|
50
50
|
'Video did not play for 3 seconds',
|
51
51
|
{ timeout: 20000 }
|
52
52
|
);
|
53
|
-
expect(getVideo(player.mediaPlayer!.
|
53
|
+
expect(getVideo(player.mediaPlayer!.media)?.node?.paused).eq(false);
|
54
54
|
player.pause();
|
55
|
-
expect(getVideo(player.mediaPlayer!.
|
55
|
+
expect(getVideo(player.mediaPlayer!.media)?.node?.paused).eq(true);
|
56
56
|
expect(sendTrackingSpy.callCount).to.be.eq(0);
|
57
57
|
// Destroy node because events are sent when node is removed from the document
|
58
58
|
player.remove();
|