@amazon/vinyl 4.0.0 → 4.0.1-next.20261016184530
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/index.cjs +40 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +41 -3
- package/dist/index.js.map +2 -2
- package/dist/test/benchmark.es5.js +5 -4
- package/dist/test/benchmark.js +11 -2
- package/dist/test/benchmark.js.map +3 -3
- package/dist/test/errata/mse-changetype-sequence.html +65 -0
- package/dist/test/errata/mse-changetype-sequence.js +179 -0
- package/dist/test/index.html +2 -2
- package/dist/test/integ.es5.js +287 -276
- package/dist/test/integ.js +629 -245
- package/dist/test/integ.js.map +4 -4
- package/dist/test/styles.css +23 -13
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts +12 -0
- package/dist/types/current/playback/PlaybackControllerImpl.d.ts.map +1 -1
- package/dist/types/current/playback/PlaybackControllerImpl.js +42 -1
- package/dist/types/current/streaming/buffering/BufferingController.d.ts.map +1 -1
- package/dist/types/current/streaming/buffering/BufferingController.js +9 -2
- package/dist/types/current/streaming/buffering/MediaSourceController.d.ts.map +1 -1
- package/dist/types/current/streaming/buffering/MediaSourceController.js +4 -2
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/playback/PlaybackControllerImpl.d.ts +12 -0
- package/dist/types/ts4.1/playback/PlaybackControllerImpl.d.ts +12 -0
- package/dist/types/ts4.7/playback/PlaybackControllerImpl.d.ts +12 -0
- package/dist/unit/types/current/playback/PlaybackControllerImpl.test.js +86 -0
- package/dist/unit/types/current/setup.js +6 -5
- package/dist/unit/types/current/streaming/SegmentControllerImpl.test.js +44 -1
- package/dist/unit/types/current/streaming/buffering/BufferingController.test.js +14 -0
- package/dist/unit/types/current/streaming/buffering/MediaSourceController.test.js +13 -0
- package/dist/unit/types/current/track/dash/createDashFactories.test.js +15 -5
- package/dist/unit/types/current/track/hls/createHlsFactories.test.js +36 -12
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/types/current/vinyl/VinylPlayerAdBreaks.test.js +8 -5
- package/dist/vinylTestUtil/index.js +92 -60
- package/dist/vinylTestUtil/index.js.map +4 -4
- package/dist/vinylTestUtil/types/current/media/FrequencyAnalyzer.d.ts +8 -5
- package/dist/vinylTestUtil/types/current/media/FrequencyAnalyzer.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/media/FrequencyAnalyzer.js +23 -29
- package/dist/vinylTestUtil/types/current/media/unlockMediaElement.d.ts +10 -1
- package/dist/vinylTestUtil/types/current/media/unlockMediaElement.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/media/unlockMediaElement.js +34 -6
- package/dist/vinylTestUtil/types/current/player/createVinylSuite.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/player/createVinylSuite.js +6 -1
- package/dist/vinylTestUtil/types/current/player/mediaRef.d.ts +7 -0
- package/dist/vinylTestUtil/types/current/player/mediaRef.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/player/mediaRef.js +8 -1
- package/dist/vinylTestUtil/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/vinylTestUtil/types/current/ui/requireUserInteraction.d.ts +6 -2
- package/dist/vinylTestUtil/types/current/ui/requireUserInteraction.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/ui/requireUserInteraction.js +31 -15
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlays.d.ts +9 -2
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlays.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlays.js +10 -7
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlaysUntil.d.ts +4 -1
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlaysUntil.d.ts.map +1 -1
- package/dist/vinylTestUtil/types/current/util/playback/expectTrackPlaysUntil.js +3 -2
- package/dist/vinylTestUtil/types/ts3.7/media/FrequencyAnalyzer.d.ts +8 -5
- package/dist/vinylTestUtil/types/ts3.7/media/unlockMediaElement.d.ts +10 -1
- package/dist/vinylTestUtil/types/ts3.7/player/mediaRef.d.ts +7 -0
- package/dist/vinylTestUtil/types/ts3.7/ui/requireUserInteraction.d.ts +6 -2
- package/dist/vinylTestUtil/types/ts3.7/util/playback/expectTrackPlays.d.ts +9 -2
- package/dist/vinylTestUtil/types/ts3.7/util/playback/expectTrackPlaysUntil.d.ts +4 -1
- package/dist/vinylTestUtil/types/ts4.1/media/FrequencyAnalyzer.d.ts +8 -5
- package/dist/vinylTestUtil/types/ts4.1/media/unlockMediaElement.d.ts +10 -1
- package/dist/vinylTestUtil/types/ts4.1/player/mediaRef.d.ts +7 -0
- package/dist/vinylTestUtil/types/ts4.1/ui/requireUserInteraction.d.ts +6 -2
- package/dist/vinylTestUtil/types/ts4.1/util/playback/expectTrackPlays.d.ts +9 -2
- package/dist/vinylTestUtil/types/ts4.1/util/playback/expectTrackPlaysUntil.d.ts +4 -1
- package/dist/vinylTestUtil/types/ts4.7/media/FrequencyAnalyzer.d.ts +8 -5
- package/dist/vinylTestUtil/types/ts4.7/media/unlockMediaElement.d.ts +10 -1
- package/dist/vinylTestUtil/types/ts4.7/player/mediaRef.d.ts +7 -0
- package/dist/vinylTestUtil/types/ts4.7/ui/requireUserInteraction.d.ts +6 -2
- package/dist/vinylTestUtil/types/ts4.7/util/playback/expectTrackPlays.d.ts +9 -2
- package/dist/vinylTestUtil/types/ts4.7/util/playback/expectTrackPlaysUntil.d.ts +4 -1
- package/package.json +11 -10
|
@@ -35,6 +35,11 @@ export declare class FrequencyAnalyzer implements LogTarget {
|
|
|
35
35
|
*/
|
|
36
36
|
assertFrequency(timeout?: number): Promise<void>;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The volume integ tests play at when checkAudio is set. Analyzers do not work at volume 0 or muted, and the
|
|
40
|
+
* measured dB is affected at very low volumes.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ANALYZER_VOLUME = 0.01;
|
|
38
43
|
/**
|
|
39
44
|
* A query param, if present, will indicate that audio should be analyzed. Does not work in CI environments.
|
|
40
45
|
*/
|
|
@@ -45,12 +50,10 @@ export declare const shouldCheckAudio: boolean;
|
|
|
45
50
|
*/
|
|
46
51
|
export declare function assertFrequency(): Promise<void>;
|
|
47
52
|
/**
|
|
48
|
-
*
|
|
53
|
+
* Attaches an analyzer to the shared media element if checkAudio is present in the query params.
|
|
49
54
|
*
|
|
50
|
-
* The checkAudio query param, if present, indicates that the actual sound output should be analyzed.
|
|
51
|
-
*
|
|
52
|
-
* requirement may be skipped with a flag. Note that Google deprecated --autoplay-policy=no-user-gesture-required
|
|
53
|
-
* March 2023, but older versions may still support it.
|
|
55
|
+
* The checkAudio query param, if present, indicates that the actual sound output should be analyzed. The analyzer is
|
|
56
|
+
* created after the media element is unlocked, so `initializeMediaUnlock` must be called first.
|
|
54
57
|
*/
|
|
55
58
|
export declare function initializeFrequencyAnalyzer(): void;
|
|
56
59
|
//# sourceMappingURL=FrequencyAnalyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrequencyAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/media/FrequencyAnalyzer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"FrequencyAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/media/FrequencyAnalyzer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,oBAAoB,CAAA;AAajE,MAAM,WAAW,wBAAwB;IACrC;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAE/B;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EACZ,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAA;CAC5E;AAQD,qBAAa,iBAAkB,YAAW,SAAS;IAS3C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAT3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2B;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IAEvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAElD,QAAQ,CAAC,SAAS,SAAuC;gBAGpC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,2BAA2B,EACpD,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC;IAc/C;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAUtB;IAED,IAAI,aAAa,IAAI,MAAM,CAQ1B;IAED;;OAEG;IACG,eAAe,CAAC,OAAO,SAAK;CA8DrC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,OAAO,CAAA;AAEnC;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAE5B,CAAA;AAID;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,SAc1C"}
|
|
@@ -10,9 +10,6 @@ import { logDebug } from '@amazon/vinyl-util';
|
|
|
10
10
|
import { getSearchParams } from '@amazon/vinyl-util';
|
|
11
11
|
import { createLogPrefix } from '@amazon/vinyl-util';
|
|
12
12
|
import { mediaRef } from '../player/mediaRef';
|
|
13
|
-
import { requireUserInteraction } from '../ui/requireUserInteraction';
|
|
14
|
-
import { unlockMediaElement } from './unlockMediaElement';
|
|
15
|
-
import { setNextTestTimeout } from '@amazon/vinyl-util/browserTestUtil';
|
|
16
13
|
/**
|
|
17
14
|
* The percent tolerance the time estimate based on the analyzed frequency can be off from the actual currentTime.
|
|
18
15
|
*/
|
|
@@ -112,6 +109,11 @@ export class FrequencyAnalyzer {
|
|
|
112
109
|
}
|
|
113
110
|
}
|
|
114
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* The volume integ tests play at when checkAudio is set. Analyzers do not work at volume 0 or muted, and the
|
|
114
|
+
* measured dB is affected at very low volumes.
|
|
115
|
+
*/
|
|
116
|
+
export const ANALYZER_VOLUME = 0.01;
|
|
115
117
|
/**
|
|
116
118
|
* A query param, if present, will indicate that audio should be analyzed. Does not work in CI environments.
|
|
117
119
|
*/
|
|
@@ -125,33 +127,25 @@ export function assertFrequency() {
|
|
|
125
127
|
return frequencyAnalyzer?.assertFrequency() ?? Promise.resolve();
|
|
126
128
|
}
|
|
127
129
|
/**
|
|
128
|
-
*
|
|
130
|
+
* Attaches an analyzer to the shared media element if checkAudio is present in the query params.
|
|
129
131
|
*
|
|
130
|
-
* The checkAudio query param, if present, indicates that the actual sound output should be analyzed.
|
|
131
|
-
*
|
|
132
|
-
* requirement may be skipped with a flag. Note that Google deprecated --autoplay-policy=no-user-gesture-required
|
|
133
|
-
* March 2023, but older versions may still support it.
|
|
132
|
+
* The checkAudio query param, if present, indicates that the actual sound output should be analyzed. The analyzer is
|
|
133
|
+
* created after the media element is unlocked, so `initializeMediaUnlock` must be called first.
|
|
134
134
|
*/
|
|
135
135
|
export function initializeFrequencyAnalyzer() {
|
|
136
|
-
if (shouldCheckAudio)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
console.warn('AudioContext not supported');
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
136
|
+
if (!shouldCheckAudio)
|
|
137
|
+
return;
|
|
138
|
+
beforeAll(() => {
|
|
139
|
+
const media = mediaRef.value;
|
|
140
|
+
media.crossOrigin = 'anonymous';
|
|
141
|
+
media.volume = ANALYZER_VOLUME;
|
|
142
|
+
const audioContext = getAudioContext();
|
|
143
|
+
if (audioContext) {
|
|
144
|
+
const source = audioContext.createMediaElementSource(media);
|
|
145
|
+
frequencyAnalyzer = new FrequencyAnalyzer(audioContext, source);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
console.warn('AudioContext not supported');
|
|
149
|
+
}
|
|
150
|
+
});
|
|
157
151
|
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 'Unlocks' the media element by playing and immediately pausing a src track, and resumes the AudioContext.
|
|
3
3
|
* This allows play() to settle on the media element without a user gesture later.
|
|
4
|
+
*
|
|
5
|
+
* Must be called synchronously from a user gesture handler. Rejects if the browser did not accept the gesture.
|
|
4
6
|
*/
|
|
5
7
|
export declare function unlockMediaElement(): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* In a browser, prompts for a click before any spec runs, unlocking the shared media element in response.
|
|
10
|
+
*
|
|
11
|
+
* Starting playback without a user gesture is only allowed for muted media, and some browsers (Safari 27)
|
|
12
|
+
* end progressive playback that starts silently without one, so integ tests play unmuted after this unlock.
|
|
13
|
+
*/
|
|
14
|
+
export declare function initializeMediaUnlock(): void;
|
|
6
15
|
//# sourceMappingURL=unlockMediaElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlockMediaElement.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/media/unlockMediaElement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unlockMediaElement.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/media/unlockMediaElement.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAaxD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,SAMpC"}
|
|
@@ -2,19 +2,47 @@
|
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
+
import { getAudioContext } from '@amazon/vinyl';
|
|
5
6
|
import { mediaRef } from '../player/mediaRef';
|
|
6
7
|
import { vinylTestAssets } from '../assets/vinylTestAssets';
|
|
8
|
+
import { requireUserInteraction } from '../ui/requireUserInteraction';
|
|
7
9
|
import { noop } from '@amazon/vinyl-util';
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
11
|
+
* The largest timeout jasmine accepts; there is no limit to how long a person may take to click.
|
|
12
|
+
*/
|
|
13
|
+
const MAX_TIMEOUT_MS = 2_147_483_647;
|
|
14
|
+
/**
|
|
15
|
+
* 'Unlocks' the media element by playing and immediately pausing a src track, and resumes the AudioContext.
|
|
10
16
|
* This allows play() to settle on the media element without a user gesture later.
|
|
17
|
+
*
|
|
18
|
+
* Must be called synchronously from a user gesture handler. Rejects if the browser did not accept the gesture.
|
|
11
19
|
*/
|
|
12
20
|
export async function unlockMediaElement() {
|
|
13
21
|
const media = mediaRef.value;
|
|
14
|
-
// Unlocks the media element.
|
|
15
22
|
media.src = vinylTestAssets.prog.libmp3lame_60s_2ch_16bit_44100Hz_48kbps;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const played = media.play();
|
|
24
|
+
const resumed = getAudioContext()?.resume().catch(noop);
|
|
25
|
+
try {
|
|
26
|
+
await played;
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
media.pause();
|
|
30
|
+
media.removeAttribute('src');
|
|
31
|
+
media.load();
|
|
32
|
+
}
|
|
33
|
+
await resumed;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* In a browser, prompts for a click before any spec runs, unlocking the shared media element in response.
|
|
37
|
+
*
|
|
38
|
+
* Starting playback without a user gesture is only allowed for muted media, and some browsers (Safari 27)
|
|
39
|
+
* end progressive playback that starts silently without one, so integ tests play unmuted after this unlock.
|
|
40
|
+
*/
|
|
41
|
+
export function initializeMediaUnlock() {
|
|
42
|
+
if (typeof document === 'undefined')
|
|
43
|
+
return;
|
|
44
|
+
beforeAll(async () => {
|
|
45
|
+
await requireUserInteraction(unlockMediaElement);
|
|
46
|
+
console.info('Media element unlocked');
|
|
47
|
+
}, MAX_TIMEOUT_MS);
|
|
20
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createVinylSuite.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/player/createVinylSuite.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EACnB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"createVinylSuite.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/player/createVinylSuite.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EACnB,MAAM,eAAe,CAAA;AAoBtB,MAAM,WAAW,iBAAiB;IAC9B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEzB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CACjC;AAED,qBAAa,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,WAAW;IAuB7D;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB;IA1BlD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IACD,QAAQ,CAAC,SAAS,SAAwB;IAE1C,OAAO,CAAC,OAAO,CAAiB;IAEhC,IAAI,MAAM,IAAI,CAAC,CAMd;IAED,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAIvC;;IAGG;;OAEG;IACc,aAAa,EAAE,MAAM,CAAC,EACpB,OAAO,CAAC,EAAE,iBAAiB,YAAA;IAGlD;;OAEG;IACH,IAAI;CAgDP;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,EACzD,OAAO,CAAC,EAAE,iBAAiB,GAC5B,UAAU,CASZ"}
|
|
@@ -6,7 +6,8 @@ import { createVinylPlayer, } from '@amazon/vinyl';
|
|
|
6
6
|
import { createDisposer, logError, toJson, } from '@amazon/vinyl-util';
|
|
7
7
|
import { createLogPrefix, createRequester, getGlobalRegistry, IllegalStateError, logDebug, requesterWithRetryRef, RetryStrategy, } from '@amazon/vinyl-util';
|
|
8
8
|
import { setTestTimeout } from '@amazon/vinyl-util/browserTestUtil';
|
|
9
|
-
import { mediaRef } from './mediaRef';
|
|
9
|
+
import { MEDIA_VOLUME, mediaRef } from './mediaRef';
|
|
10
|
+
import { ANALYZER_VOLUME, shouldCheckAudio } from '../media/FrequencyAnalyzer';
|
|
10
11
|
export class VinylSuite {
|
|
11
12
|
playerFactory;
|
|
12
13
|
options;
|
|
@@ -49,6 +50,10 @@ export class VinylSuite {
|
|
|
49
50
|
}));
|
|
50
51
|
document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
|
51
52
|
this._player = this.playerFactory();
|
|
53
|
+
// Through the player, so loudness normalization scales this volume rather than replacing it.
|
|
54
|
+
this._player.volume = shouldCheckAudio
|
|
55
|
+
? ANALYZER_VOLUME
|
|
56
|
+
: MEDIA_VOLUME;
|
|
52
57
|
add(this._player.on('error', (e) => {
|
|
53
58
|
logError(this, 'player emitted error event', toJson(e));
|
|
54
59
|
}));
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The volume integ tests play at: low enough not to be heard, but not 0 or muted. Safari 27 ends progressive
|
|
3
|
+
* playback that starts silently without a user gesture, and the media element is unlocked at this volume.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MEDIA_VOLUME = 0.0001;
|
|
1
6
|
/**
|
|
2
7
|
* For reliable integ tests on 3P devices, there should be a single media element.
|
|
3
8
|
* When using the media element, unload any sources and reset any state after each test.
|
|
9
|
+
*
|
|
10
|
+
* The element is unmuted at {@link MEDIA_VOLUME}; see `initializeMediaUnlock`.
|
|
4
11
|
*/
|
|
5
12
|
export declare const mediaRef: import("@amazon/vinyl-util").Lazy<HTMLMediaElement>;
|
|
6
13
|
//# sourceMappingURL=mediaRef.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediaRef.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/player/mediaRef.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,QAAQ,qDAMnB,CAAA"}
|
|
1
|
+
{"version":3,"file":"mediaRef.d.ts","sourceRoot":"","sources":["../../../../../test/vinylTestUtil/player/mediaRef.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA;AAElC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,qDAMnB,CAAA"}
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { lazy } from '@amazon/vinyl-util';
|
|
6
|
+
/**
|
|
7
|
+
* The volume integ tests play at: low enough not to be heard, but not 0 or muted. Safari 27 ends progressive
|
|
8
|
+
* playback that starts silently without a user gesture, and the media element is unlocked at this volume.
|
|
9
|
+
*/
|
|
10
|
+
export const MEDIA_VOLUME = 0.0001;
|
|
6
11
|
/**
|
|
7
12
|
* For reliable integ tests on 3P devices, there should be a single media element.
|
|
8
13
|
* When using the media element, unload any sources and reset any state after each test.
|
|
14
|
+
*
|
|
15
|
+
* The element is unmuted at {@link MEDIA_VOLUME}; see `initializeMediaUnlock`.
|
|
9
16
|
*/
|
|
10
17
|
export const mediaRef = lazy(() => {
|
|
11
18
|
const media = document.createElement('video');
|
|
12
|
-
media.
|
|
19
|
+
media.volume = MEDIA_VOLUME;
|
|
13
20
|
media.playsInline = true; // needed for iOS
|
|
14
21
|
media.disableRemotePlayback = true; // Disables casting. Needed for ManagedMediaSource
|
|
15
22
|
return media;
|