timingsrc 1.2.14 → 1.2.16
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/build/es2019/factories/compute-velocity.d.ts.map +1 -1
- package/build/es2019/factories/compute-velocity.js +4 -1
- package/build/es2019/factories/compute-velocity.js.map +1 -1
- package/build/es2019/factories/default-set-timingsrc.d.ts +1 -2
- package/build/es2019/factories/default-set-timingsrc.d.ts.map +1 -1
- package/build/es2019/factories/default-set-timingsrc.js +2 -2
- package/build/es2019/factories/default-set-timingsrc.js.map +1 -1
- package/build/es2019/factories/set-playback-rate.d.ts +1 -1
- package/build/es2019/factories/set-playback-rate.d.ts.map +1 -1
- package/build/es2019/factories/set-playback-rate.js +3 -3
- package/build/es2019/factories/set-playback-rate.js.map +1 -1
- package/build/es2019/factories/update-gradually.d.ts +1 -2
- package/build/es2019/factories/update-gradually.d.ts.map +1 -1
- package/build/es2019/factories/update-gradually.js +4 -3
- package/build/es2019/factories/update-gradually.js.map +1 -1
- package/build/es2019/module.d.ts.map +1 -1
- package/build/es2019/module.js +2 -3
- package/build/es2019/module.js.map +1 -1
- package/build/es5/bundle.js +21 -24
- package/package.json +10 -10
- package/src/factories/compute-velocity.ts +5 -2
- package/src/factories/default-set-timingsrc.ts +1 -4
- package/src/factories/set-playback-rate.ts +7 -3
- package/src/factories/update-gradually.ts +5 -9
- package/src/module.ts +6 -3
- package/build/es2019/functions/update-vector-with-new-position.d.ts +0 -6
- package/build/es2019/functions/update-vector-with-new-position.d.ts.map +0 -1
- package/build/es2019/functions/update-vector-with-new-position.js +0 -5
- package/build/es2019/functions/update-vector-with-new-position.js.map +0 -1
- package/src/functions/update-vector-with-new-position.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-velocity.d.ts","sourceRoot":"","sources":["../../../src/factories/compute-velocity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,iBAAkB,MAAM,aAAa,MAAM,YAAY,MAAM,YAAY,MAAM,YAAY,MAAM,
|
|
1
|
+
{"version":3,"file":"compute-velocity.d.ts","sourceRoot":"","sources":["../../../src/factories/compute-velocity.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,iBAAkB,MAAM,aAAa,MAAM,YAAY,MAAM,YAAY,MAAM,YAAY,MAAM,WAIlI,CAAC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export const createComputeVelocity = (timeConstant) => (delta, minValue, maxValue, velocity) =>
|
|
1
|
+
export const createComputeVelocity = (timeConstant) => (delta, minValue, maxValue, velocity) => {
|
|
2
|
+
const factor = (Math.abs(delta) + timeConstant) / timeConstant;
|
|
3
|
+
return Math.max(minValue, Math.min(maxValue, delta > 0 ? velocity / factor : factor * velocity));
|
|
4
|
+
};
|
|
2
5
|
//# sourceMappingURL=compute-velocity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-velocity.js","sourceRoot":"","sources":["../../../src/factories/compute-velocity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,KAAa,EAAE,QAAgB,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"compute-velocity.js","sourceRoot":"","sources":["../../../src/factories/compute-velocity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,KAAa,EAAE,QAAgB,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE;IACnI,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,GAAG,YAAY,CAAC;IAE/D,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;AACrG,CAAC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { determineSupportedPlaybackRateValues as determineSupportedPlaybackRateValuesFunction } from '../functions/determine-supported-playback-rate-values';
|
|
2
|
-
import type { updateVectorWithNewPosition as updateVectorWithNewPositionFunction } from '../functions/update-vector-with-new-position';
|
|
3
2
|
import type { createComputeVelocity as createComputeVelocityFunction } from './compute-velocity';
|
|
4
3
|
import type { createSetTimingsrc as createSetTimingsrcFunction } from './set-timingsrc';
|
|
5
4
|
import type { createSetTimingsrcWithCustomUpdateFunction } from './set-timingsrc-with-custom-update-function';
|
|
6
5
|
import type { createUpdateGradually as createUpdateGraduallyFunction } from './update-gradually';
|
|
7
6
|
import type { createUpdateStepwiseFactory } from './update-stepwise-factory';
|
|
8
7
|
import type { createWindow } from './window';
|
|
9
|
-
export declare const createDefaultSetTimingsrc: (createComputeVelocity: typeof createComputeVelocityFunction, createSetTimingsrc: typeof createSetTimingsrcFunction, createUpdateGradually: typeof createUpdateGraduallyFunction, createUpdateStepwise: ReturnType<typeof createUpdateStepwiseFactory>, determineSupportedPlaybackRateValues: typeof determineSupportedPlaybackRateValuesFunction, setTimingsrcWithCustomUpdateFunction: ReturnType<typeof createSetTimingsrcWithCustomUpdateFunction>,
|
|
8
|
+
export declare const createDefaultSetTimingsrc: (createComputeVelocity: typeof createComputeVelocityFunction, createSetTimingsrc: typeof createSetTimingsrcFunction, createUpdateGradually: typeof createUpdateGraduallyFunction, createUpdateStepwise: ReturnType<typeof createUpdateStepwiseFactory>, determineSupportedPlaybackRateValues: typeof determineSupportedPlaybackRateValuesFunction, setTimingsrcWithCustomUpdateFunction: ReturnType<typeof createSetTimingsrcWithCustomUpdateFunction>, window: ReturnType<typeof createWindow>) => (mediaElement: HTMLMediaElement, timingObject: import("timing-object").ITimingObject, prepareTimingStateVector?: import("../types").TPrepareTimingStateVectorFunction | null) => () => void;
|
|
10
9
|
//# sourceMappingURL=default-set-timingsrc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-set-timingsrc.d.ts","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oCAAoC,IAAI,4CAA4C,EAAE,MAAM,uDAAuD,CAAC;
|
|
1
|
+
{"version":3,"file":"default-set-timingsrc.d.ts","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oCAAoC,IAAI,4CAA4C,EAAE,MAAM,uDAAuD,CAAC;AAElK,OAAO,KAAK,EAAE,qBAAqB,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,KAAK,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,6CAA6C,CAAC;AAC9G,OAAO,KAAK,EAAE,qBAAqB,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAM7C,eAAO,MAAM,yBAAyB,0BACX,oCAAoC,sBACvC,iCAAiC,yBAC9B,oCAAoC,wBACrC,WAAW,kCAAkC,CAAC,wCAC9B,mDAAmD,wCACnD,WAAW,iDAAiD,CAAC,UAC3F,WAAW,mBAAmB,CAAC,gMAa1C,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const DEFAULT_THRESHOLD = 1;
|
|
2
2
|
const DEFAULT_TIME_CONSTANT = 0.5;
|
|
3
3
|
const DEFAULT_TOLERANCE = 0.025;
|
|
4
|
-
export const createDefaultSetTimingsrc = (createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction,
|
|
4
|
+
export const createDefaultSetTimingsrc = (createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, window) => {
|
|
5
5
|
const update = window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome')
|
|
6
6
|
? createUpdateStepwise(DEFAULT_TOLERANCE)
|
|
7
|
-
: createUpdateGradually(createComputeVelocity(DEFAULT_TIME_CONSTANT), determineSupportedPlaybackRateValues(window), DEFAULT_THRESHOLD, DEFAULT_TOLERANCE
|
|
7
|
+
: createUpdateGradually(createComputeVelocity(DEFAULT_TIME_CONSTANT), determineSupportedPlaybackRateValues(window), DEFAULT_THRESHOLD, DEFAULT_TOLERANCE);
|
|
8
8
|
return createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, update);
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=default-set-timingsrc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-set-timingsrc.js","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-set-timingsrc.js","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AASA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACrC,qBAA2D,EAC3D,kBAAqD,EACrD,qBAA2D,EAC3D,oBAAoE,EACpE,oCAAyF,EACzF,oCAAmG,EACnG,MAAuC,EACzC,EAAE;IACA,MAAM,MAAM,GACR,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC9G,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;QACzC,CAAC,CAAC,qBAAqB,CACjB,qBAAqB,CAAC,qBAAqB,CAAC,EAC5C,oCAAoC,CAAC,MAAM,CAAC,EAC5C,iBAAiB,EACjB,iBAAiB,CACpB,CAAC;IAEZ,OAAO,kBAAkB,CAAC,oCAAoC,EAAgE,MAAM,CAAC,CAAC;AAC1I,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const createSetPlaybackRate: (playbackRateAssignments: WeakMap<HTMLMediaElement, [number, number]
|
|
1
|
+
export declare const createSetPlaybackRate: (negativeMaximum: number, playbackRateAssignments: WeakMap<HTMLMediaElement, [number, number]>, positiveMinimum: number) => (mediaElement: HTMLMediaElement, previousValue: number, nextValue: number) => void;
|
|
2
2
|
//# sourceMappingURL=set-playback-rate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-playback-rate.d.ts","sourceRoot":"","sources":["../../../src/factories/set-playback-rate.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"set-playback-rate.d.ts","sourceRoot":"","sources":["../../../src/factories/set-playback-rate.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,oBACb,MAAM,2BACE,QAAQ,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,mBACnD,MAAM,oBAED,gBAAgB,iBAAiB,MAAM,aAAa,MAAM,SAcnF,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const createSetPlaybackRate = (playbackRateAssignments) => {
|
|
1
|
+
export const createSetPlaybackRate = (negativeMaximum, playbackRateAssignments, positiveMinimum) => {
|
|
2
2
|
return (mediaElement, previousValue, nextValue) => {
|
|
3
3
|
const playbackRateAssignment = playbackRateAssignments.get(mediaElement);
|
|
4
4
|
if (playbackRateAssignment === undefined ||
|
|
5
5
|
playbackRateAssignment[0] !== previousValue ||
|
|
6
6
|
playbackRateAssignment[1] !== nextValue) {
|
|
7
|
-
//
|
|
8
|
-
mediaElement.playbackRate = nextValue
|
|
7
|
+
// Bug #6: Chrome does not adjust the tempo when the playbackRate is very close to 1.
|
|
8
|
+
mediaElement.playbackRate = nextValue > 1 ? Math.max(positiveMinimum, nextValue) : Math.min(negativeMaximum, nextValue);
|
|
9
9
|
playbackRateAssignments.set(mediaElement, [mediaElement.playbackRate, nextValue]);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-playback-rate.js","sourceRoot":"","sources":["../../../src/factories/set-playback-rate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"set-playback-rate.js","sourceRoot":"","sources":["../../../src/factories/set-playback-rate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,eAAuB,EACvB,uBAAoE,EACpE,eAAuB,EACzB,EAAE;IACA,OAAO,CAAC,YAA8B,EAAE,aAAqB,EAAE,SAAiB,EAAE,EAAE;QAChF,MAAM,sBAAsB,GAAG,uBAAuB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEzE,IACI,sBAAsB,KAAK,SAAS;YACpC,sBAAsB,CAAC,CAAC,CAAC,KAAK,aAAa;YAC3C,sBAAsB,CAAC,CAAC,CAAC,KAAK,SAAS,EACzC;YACE,qFAAqF;YACrF,YAAY,CAAC,YAAY,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;YAExH,uBAAuB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;SACrF;IACL,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { updateVectorWithNewPosition as updateVectorWithNewPositionFunction } from '../functions/update-vector-with-new-position';
|
|
2
1
|
import { IUpdateVector } from '../interfaces';
|
|
3
2
|
import { TUpdateFunction } from '../types';
|
|
4
3
|
import type { createComputeVelocity } from './compute-velocity';
|
|
5
|
-
export declare const createUpdateGradually: (computeVelocity: ReturnType<typeof createComputeVelocity>, [minValue, maxValue]: readonly [number, number], threshold: number, tolerance: number
|
|
4
|
+
export declare const createUpdateGradually: (computeVelocity: ReturnType<typeof createComputeVelocity>, [minValue, maxValue]: readonly [number, number], threshold: number, tolerance: number) => TUpdateFunction<IUpdateVector & {
|
|
6
5
|
mediaElementDelay: number;
|
|
7
6
|
}>;
|
|
8
7
|
//# sourceMappingURL=update-gradually.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-gradually.d.ts","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"update-gradually.d.ts","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,eAAO,MAAM,qBAAqB,oBACb,WAAW,4BAA4B,CAAC,8DAE9C,MAAM,aACN,MAAM,KAClB,gBAAgB,aAAa,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CA2C/D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const createUpdateGradually = (computeVelocity, [minValue, maxValue], threshold, tolerance
|
|
1
|
+
export const createUpdateGradually = (computeVelocity, [minValue, maxValue], threshold, tolerance) => {
|
|
2
2
|
return ({ position, velocity }, currentTime, previousUpdateVectorWithCustomState) => {
|
|
3
3
|
let { mediaElementDelay } = previousUpdateVectorWithCustomState !== null && previousUpdateVectorWithCustomState !== void 0 ? previousUpdateVectorWithCustomState : { mediaElementDelay: 0 };
|
|
4
4
|
if (velocity < minValue || velocity > maxValue) {
|
|
@@ -15,10 +15,11 @@ export const createUpdateGradually = (computeVelocity, [minValue, maxValue], thr
|
|
|
15
15
|
if (lastPosition === currentTime) {
|
|
16
16
|
mediaElementDelay += absolutePositionDifference;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return { mediaElementDelay, position: position + mediaElementDelay, velocity };
|
|
19
19
|
}
|
|
20
20
|
if (lastPosition !== currentTime) {
|
|
21
|
-
|
|
21
|
+
mediaElementDelay -= absolutePositionDifference;
|
|
22
|
+
return { mediaElementDelay, position: position + mediaElementDelay, velocity };
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
if (absolutePositionDifference > tolerance) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-gradually.js","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-gradually.js","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,eAAyD,EACzD,CAAC,QAAQ,EAAE,QAAQ,CAA0D,EAC7E,SAAiB,EACjB,SAAiB,EAC6C,EAAE;IAChE,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,EAAE;QAChF,IAAI,EAAE,iBAAiB,EAAE,GAAG,mCAAmC,aAAnC,mCAAmC,cAAnC,mCAAmC,GAAI,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;QAE5F,IAAI,QAAQ,GAAG,QAAQ,IAAI,QAAQ,GAAG,QAAQ,EAAE;YAC5C,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;SACvD;QAED,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,KAAK,CAAC,EAAE;YAChC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;SACpD;QAED,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,CAAC;QAClD,MAAM,0BAA0B,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAEhE,IAAI,0BAA0B,GAAG,SAAS,EAAE;YACxC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,mCAAmC,aAAnC,mCAAmC,cAAnC,mCAAmC,GAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAE7F,IAAI,kBAAkB,GAAG,CAAC,IAAI,kBAAkB,GAAG,iBAAiB,EAAE;gBAClE,IAAI,YAAY,KAAK,WAAW,EAAE;oBAC9B,iBAAiB,IAAI,0BAA0B,CAAC;iBACnD;gBAED,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,EAAE,QAAQ,EAAE,CAAC;aAClF;YAED,IAAI,YAAY,KAAK,WAAW,EAAE;gBAC9B,iBAAiB,IAAI,0BAA0B,CAAC;gBAEhD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,EAAE,QAAQ,EAAE,CAAC;aAClF;SACJ;QAED,IAAI,0BAA0B,GAAG,SAAS,EAAE;YACxC,OAAO;gBACH,iBAAiB;gBACjB,QAAQ,EAAE,WAAW;gBACrB,QAAQ,EAAE,eAAe,CAAC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;aAC9E,CAAC;SACL;QAED,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAClE,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAQrE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,eAAO,MAAM,oBAAoB;;;;;;;;EAA0D,CAAC;AAS5F,eAAO,MAAM,oCAAoC,sVAKhD,CAAC;AAEF,eAAO,MAAM,YAAY,4LAQxB,CAAC"}
|
package/build/es2019/module.js
CHANGED
|
@@ -13,11 +13,10 @@ import { createWindow } from './factories/window';
|
|
|
13
13
|
import { determineSupportedPlaybackRateValues } from './functions/determine-supported-playback-rate-values';
|
|
14
14
|
import { pause } from './functions/pause';
|
|
15
15
|
import { play } from './functions/play';
|
|
16
|
-
import { updateVectorWithNewPosition } from './functions/update-vector-with-new-position';
|
|
17
16
|
export { createSetTimingsrc };
|
|
18
17
|
export { createUpdateGradually };
|
|
19
18
|
export const createUpdateStepwise = createUpdateStepwiseFactory(translateTimingStateVector);
|
|
20
|
-
const updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
19
|
+
const updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(881 / 882, new WeakMap(), 882 / 881));
|
|
21
20
|
export const setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(animationFrame, document, on, updateMediaElement);
|
|
22
|
-
export const setTimingsrc = createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction,
|
|
21
|
+
export const setTimingsrc = createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
23
22
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,0CAA0C,EAAE,MAAM,uDAAuD,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oCAAoC,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,0CAA0C,EAAE,MAAM,uDAAuD,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oCAAoC,EAAE,MAAM,sDAAsD,CAAC;AAC5G,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,0BAA0B,CAAC,CAAC;AAE5F,MAAM,kBAAkB,GAAG,wBAAwB,CAC/C,KAAK,EACL,IAAI,EACJ,oBAAoB,CAAC,IAAI,OAAO,EAAE,CAAC,EACnC,qBAAqB,CAAC,GAAG,GAAG,GAAG,EAAE,IAAI,OAAO,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,0CAA0C,CAC1F,cAAc,EACd,QAAQ,EACR,EAAE,EACF,kBAAkB,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CACjD,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oCAAoC,EACpC,oCAAoC,EACpC,YAAY,EAAE,CACjB,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -6,15 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
var createComputeVelocity = function createComputeVelocity(timeConstant) {
|
|
8
8
|
return function (delta, minValue, maxValue, velocity) {
|
|
9
|
-
|
|
9
|
+
var factor = (Math.abs(delta) + timeConstant) / timeConstant;
|
|
10
|
+
return Math.max(minValue, Math.min(maxValue, delta > 0 ? velocity / factor : factor * velocity));
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
var DEFAULT_THRESHOLD = 1;
|
|
14
15
|
var DEFAULT_TIME_CONSTANT = 0.5;
|
|
15
16
|
var DEFAULT_TOLERANCE = 0.025;
|
|
16
|
-
var createDefaultSetTimingsrc = function createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction,
|
|
17
|
-
var update = window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') ? createUpdateStepwise(DEFAULT_TOLERANCE) : createUpdateGradually(createComputeVelocity(DEFAULT_TIME_CONSTANT), determineSupportedPlaybackRateValues(window), DEFAULT_THRESHOLD, DEFAULT_TOLERANCE
|
|
17
|
+
var createDefaultSetTimingsrc = function createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, window) {
|
|
18
|
+
var update = window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') ? createUpdateStepwise(DEFAULT_TOLERANCE) : createUpdateGradually(createComputeVelocity(DEFAULT_TIME_CONSTANT), determineSupportedPlaybackRateValues(window), DEFAULT_THRESHOLD, DEFAULT_TOLERANCE);
|
|
18
19
|
return createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, update);
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -30,12 +31,12 @@
|
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
var createSetPlaybackRate = function createSetPlaybackRate(playbackRateAssignments) {
|
|
34
|
+
var createSetPlaybackRate = function createSetPlaybackRate(negativeMaximum, playbackRateAssignments, positiveMinimum) {
|
|
34
35
|
return function (mediaElement, previousValue, nextValue) {
|
|
35
36
|
var playbackRateAssignment = playbackRateAssignments.get(mediaElement);
|
|
36
37
|
if (playbackRateAssignment === undefined || playbackRateAssignment[0] !== previousValue || playbackRateAssignment[1] !== nextValue) {
|
|
37
|
-
//
|
|
38
|
-
mediaElement.playbackRate = nextValue
|
|
38
|
+
// Bug #6: Chrome does not adjust the tempo when the playbackRate is very close to 1.
|
|
39
|
+
mediaElement.playbackRate = nextValue > 1 ? Math.max(positiveMinimum, nextValue) : Math.min(negativeMaximum, nextValue);
|
|
39
40
|
playbackRateAssignments.set(mediaElement, [mediaElement.playbackRate, nextValue]);
|
|
40
41
|
}
|
|
41
42
|
};
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
};
|
|
102
103
|
};
|
|
103
104
|
|
|
104
|
-
var createUpdateGradually = function createUpdateGradually(computeVelocity, _ref, threshold, tolerance
|
|
105
|
+
var createUpdateGradually = function createUpdateGradually(computeVelocity, _ref, threshold, tolerance) {
|
|
105
106
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
106
107
|
minValue = _ref2[0],
|
|
107
108
|
maxValue = _ref2[1];
|
|
@@ -137,14 +138,19 @@
|
|
|
137
138
|
if (lastPosition === currentTime) {
|
|
138
139
|
mediaElementDelay += absolutePositionDifference;
|
|
139
140
|
}
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
return {
|
|
142
|
+
mediaElementDelay: mediaElementDelay,
|
|
143
|
+
position: position + mediaElementDelay,
|
|
144
|
+
velocity: velocity
|
|
145
|
+
};
|
|
143
146
|
}
|
|
144
147
|
if (lastPosition !== currentTime) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
mediaElementDelay -= absolutePositionDifference;
|
|
149
|
+
return {
|
|
150
|
+
mediaElementDelay: mediaElementDelay,
|
|
151
|
+
position: position + mediaElementDelay,
|
|
152
|
+
velocity: velocity
|
|
153
|
+
};
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
156
|
if (absolutePositionDifference > tolerance) {
|
|
@@ -357,19 +363,10 @@
|
|
|
357
363
|
}
|
|
358
364
|
};
|
|
359
365
|
|
|
360
|
-
var updateVectorWithNewPosition = function updateVectorWithNewPosition(mediaElementDelay, position, updateVelocity) {
|
|
361
|
-
var nextPosition = position + mediaElementDelay;
|
|
362
|
-
return {
|
|
363
|
-
mediaElementDelay: mediaElementDelay,
|
|
364
|
-
position: nextPosition,
|
|
365
|
-
velocity: updateVelocity(nextPosition)
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
|
|
369
366
|
var createUpdateStepwise = createUpdateStepwiseFactory(timingObject.translateTimingStateVector);
|
|
370
|
-
var updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
367
|
+
var updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(881 / 882, new WeakMap(), 882 / 881));
|
|
371
368
|
var setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(subscribableThings.animationFrame, document, subscribableThings.on, updateMediaElement);
|
|
372
|
-
var setTimingsrc = createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction,
|
|
369
|
+
var setTimingsrc = createDefaultSetTimingsrc(createComputeVelocity, createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
373
370
|
|
|
374
371
|
exports.createSetTimingsrc = createSetTimingsrc;
|
|
375
372
|
exports.createUpdateGradually = createUpdateGradually;
|
package/package.json
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/runtime": "^7.20.13",
|
|
13
|
-
"subscribable-things": "^2.1.
|
|
14
|
-
"timing-object": "^3.1.
|
|
15
|
-
"tslib": "^2.
|
|
13
|
+
"subscribable-things": "^2.1.13",
|
|
14
|
+
"timing-object": "^3.1.54",
|
|
15
|
+
"tslib": "^2.5.0"
|
|
16
16
|
},
|
|
17
17
|
"description": "A library to synchronize a MediaElement with a TimingObject.",
|
|
18
18
|
"devDependencies": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"chai": "^4.3.7",
|
|
27
27
|
"commitizen": "^4.3.0",
|
|
28
28
|
"cz-conventional-changelog": "^3.3.0",
|
|
29
|
-
"eslint": "^8.
|
|
30
|
-
"eslint-config-holy-grail": "^55.0.
|
|
31
|
-
"grunt": "^1.
|
|
29
|
+
"eslint": "^8.33.0",
|
|
30
|
+
"eslint-config-holy-grail": "^55.0.6",
|
|
31
|
+
"grunt": "^1.6.1",
|
|
32
32
|
"grunt-cli": "^1.4.3",
|
|
33
33
|
"grunt-sh": "^0.2.0",
|
|
34
34
|
"husky": "^8.0.3",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"prettier": "^2.8.3",
|
|
46
46
|
"pretty-quick": "^3.1.3",
|
|
47
47
|
"rimraf": "^4.1.2",
|
|
48
|
-
"rollup": "^3.
|
|
48
|
+
"rollup": "^3.12.1",
|
|
49
49
|
"sinon": "^15.0.1",
|
|
50
50
|
"sinon-chai": "^3.7.0",
|
|
51
51
|
"ts-loader": "^9.4.2",
|
|
52
52
|
"tsconfig-holy-grail": "^12.0.0",
|
|
53
53
|
"tslint": "^6.1.3",
|
|
54
|
-
"tslint-config-holy-grail": "^54.0.
|
|
55
|
-
"typescript": "^4.9.
|
|
54
|
+
"tslint-config-holy-grail": "^54.0.1",
|
|
55
|
+
"typescript": "^4.9.5",
|
|
56
56
|
"webpack": "^5.75.0"
|
|
57
57
|
},
|
|
58
58
|
"files": [
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"test": "grunt lint && grunt test"
|
|
76
76
|
},
|
|
77
77
|
"types": "build/es2019/module.d.ts",
|
|
78
|
-
"version": "1.2.
|
|
78
|
+
"version": "1.2.16"
|
|
79
79
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export const createComputeVelocity = (timeConstant: number) => (delta: number, minValue: number, maxValue: number, velocity: number) =>
|
|
2
|
-
|
|
1
|
+
export const createComputeVelocity = (timeConstant: number) => (delta: number, minValue: number, maxValue: number, velocity: number) => {
|
|
2
|
+
const factor = (Math.abs(delta) + timeConstant) / timeConstant;
|
|
3
|
+
|
|
4
|
+
return Math.max(minValue, Math.min(maxValue, delta > 0 ? velocity / factor : factor * velocity));
|
|
5
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { determineSupportedPlaybackRateValues as determineSupportedPlaybackRateValuesFunction } from '../functions/determine-supported-playback-rate-values';
|
|
2
|
-
import type { updateVectorWithNewPosition as updateVectorWithNewPositionFunction } from '../functions/update-vector-with-new-position';
|
|
3
2
|
import { TUpdateFunction, TUpdateVectorWithCustomState } from '../types';
|
|
4
3
|
import type { createComputeVelocity as createComputeVelocityFunction } from './compute-velocity';
|
|
5
4
|
import type { createSetTimingsrc as createSetTimingsrcFunction } from './set-timingsrc';
|
|
@@ -19,7 +18,6 @@ export const createDefaultSetTimingsrc = (
|
|
|
19
18
|
createUpdateStepwise: ReturnType<typeof createUpdateStepwiseFactory>,
|
|
20
19
|
determineSupportedPlaybackRateValues: typeof determineSupportedPlaybackRateValuesFunction,
|
|
21
20
|
setTimingsrcWithCustomUpdateFunction: ReturnType<typeof createSetTimingsrcWithCustomUpdateFunction>,
|
|
22
|
-
updateVectorWithNewPosition: typeof updateVectorWithNewPositionFunction,
|
|
23
21
|
window: ReturnType<typeof createWindow>
|
|
24
22
|
) => {
|
|
25
23
|
const update =
|
|
@@ -29,8 +27,7 @@ export const createDefaultSetTimingsrc = (
|
|
|
29
27
|
createComputeVelocity(DEFAULT_TIME_CONSTANT),
|
|
30
28
|
determineSupportedPlaybackRateValues(window),
|
|
31
29
|
DEFAULT_THRESHOLD,
|
|
32
|
-
DEFAULT_TOLERANCE
|
|
33
|
-
updateVectorWithNewPosition
|
|
30
|
+
DEFAULT_TOLERANCE
|
|
34
31
|
);
|
|
35
32
|
|
|
36
33
|
return createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, <TUpdateFunction<TUpdateVectorWithCustomState<typeof update>>>update);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export const createSetPlaybackRate = (
|
|
1
|
+
export const createSetPlaybackRate = (
|
|
2
|
+
negativeMaximum: number,
|
|
3
|
+
playbackRateAssignments: WeakMap<HTMLMediaElement, [number, number]>,
|
|
4
|
+
positiveMinimum: number
|
|
5
|
+
) => {
|
|
2
6
|
return (mediaElement: HTMLMediaElement, previousValue: number, nextValue: number) => {
|
|
3
7
|
const playbackRateAssignment = playbackRateAssignments.get(mediaElement);
|
|
4
8
|
|
|
@@ -7,8 +11,8 @@ export const createSetPlaybackRate = (playbackRateAssignments: WeakMap<HTMLMedia
|
|
|
7
11
|
playbackRateAssignment[0] !== previousValue ||
|
|
8
12
|
playbackRateAssignment[1] !== nextValue
|
|
9
13
|
) {
|
|
10
|
-
//
|
|
11
|
-
mediaElement.playbackRate = nextValue
|
|
14
|
+
// Bug #6: Chrome does not adjust the tempo when the playbackRate is very close to 1.
|
|
15
|
+
mediaElement.playbackRate = nextValue > 1 ? Math.max(positiveMinimum, nextValue) : Math.min(negativeMaximum, nextValue);
|
|
12
16
|
|
|
13
17
|
playbackRateAssignments.set(mediaElement, [mediaElement.playbackRate, nextValue]);
|
|
14
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { determineSupportedPlaybackRateValues } from '../functions/determine-supported-playback-rate-values';
|
|
2
|
-
import type { updateVectorWithNewPosition as updateVectorWithNewPositionFunction } from '../functions/update-vector-with-new-position';
|
|
3
2
|
import { IUpdateVector } from '../interfaces';
|
|
4
3
|
import { TUpdateFunction } from '../types';
|
|
5
4
|
import type { createComputeVelocity } from './compute-velocity';
|
|
@@ -8,8 +7,7 @@ export const createUpdateGradually = (
|
|
|
8
7
|
computeVelocity: ReturnType<typeof createComputeVelocity>,
|
|
9
8
|
[minValue, maxValue]: ReturnType<typeof determineSupportedPlaybackRateValues>,
|
|
10
9
|
threshold: number,
|
|
11
|
-
tolerance: number
|
|
12
|
-
updateVectorWithNewPosition: typeof updateVectorWithNewPositionFunction
|
|
10
|
+
tolerance: number
|
|
13
11
|
): TUpdateFunction<IUpdateVector & { mediaElementDelay: number }> => {
|
|
14
12
|
return ({ position, velocity }, currentTime, previousUpdateVectorWithCustomState) => {
|
|
15
13
|
let { mediaElementDelay } = previousUpdateVectorWithCustomState ?? { mediaElementDelay: 0 };
|
|
@@ -33,15 +31,13 @@ export const createUpdateGradually = (
|
|
|
33
31
|
mediaElementDelay += absolutePositionDifference;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
return
|
|
37
|
-
computeVelocity(nextPosition - position, minValue, maxValue, velocity)
|
|
38
|
-
);
|
|
34
|
+
return { mediaElementDelay, position: position + mediaElementDelay, velocity };
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
if (lastPosition !== currentTime) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
mediaElementDelay -= absolutePositionDifference;
|
|
39
|
+
|
|
40
|
+
return { mediaElementDelay, position: position + mediaElementDelay, velocity };
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
|
package/src/module.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { createWindow } from './factories/window';
|
|
|
13
13
|
import { determineSupportedPlaybackRateValues } from './functions/determine-supported-playback-rate-values';
|
|
14
14
|
import { pause } from './functions/pause';
|
|
15
15
|
import { play } from './functions/play';
|
|
16
|
-
import { updateVectorWithNewPosition } from './functions/update-vector-with-new-position';
|
|
17
16
|
|
|
18
17
|
export { createSetTimingsrc };
|
|
19
18
|
|
|
@@ -21,7 +20,12 @@ export { createUpdateGradually };
|
|
|
21
20
|
|
|
22
21
|
export const createUpdateStepwise = createUpdateStepwiseFactory(translateTimingStateVector);
|
|
23
22
|
|
|
24
|
-
const updateMediaElement = createUpdateMediaElement(
|
|
23
|
+
const updateMediaElement = createUpdateMediaElement(
|
|
24
|
+
pause,
|
|
25
|
+
play,
|
|
26
|
+
createSetCurrentTime(new WeakMap()),
|
|
27
|
+
createSetPlaybackRate(881 / 882, new WeakMap(), 882 / 881)
|
|
28
|
+
);
|
|
25
29
|
|
|
26
30
|
export const setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(
|
|
27
31
|
animationFrame,
|
|
@@ -37,6 +41,5 @@ export const setTimingsrc = createDefaultSetTimingsrc(
|
|
|
37
41
|
createUpdateStepwise,
|
|
38
42
|
determineSupportedPlaybackRateValues,
|
|
39
43
|
setTimingsrcWithCustomUpdateFunction,
|
|
40
|
-
updateVectorWithNewPosition,
|
|
41
44
|
createWindow()
|
|
42
45
|
);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const updateVectorWithNewPosition: (mediaElementDelay: number, position: number, updateVelocity: (nextPosition: number) => number) => {
|
|
2
|
-
mediaElementDelay: number;
|
|
3
|
-
position: number;
|
|
4
|
-
velocity: number;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=update-vector-with-new-position.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-vector-with-new-position.d.ts","sourceRoot":"","sources":["../../../src/functions/update-vector-with-new-position.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,sBACjB,MAAM,YACf,MAAM,iCACe,MAAM,KAAK,MAAM;;;;CAKnD,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const updateVectorWithNewPosition = (mediaElementDelay, position, updateVelocity) => {
|
|
2
|
-
const nextPosition = position + mediaElementDelay;
|
|
3
|
-
return { mediaElementDelay, position: nextPosition, velocity: updateVelocity(nextPosition) };
|
|
4
|
-
};
|
|
5
|
-
//# sourceMappingURL=update-vector-with-new-position.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-vector-with-new-position.js","sourceRoot":"","sources":["../../../src/functions/update-vector-with-new-position.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACvC,iBAAyB,EACzB,QAAgB,EAChB,cAAgD,EAClD,EAAE;IACA,MAAM,YAAY,GAAG,QAAQ,GAAG,iBAAiB,CAAC;IAElD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC;AACjG,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const updateVectorWithNewPosition = (
|
|
2
|
-
mediaElementDelay: number,
|
|
3
|
-
position: number,
|
|
4
|
-
updateVelocity: (nextPosition: number) => number
|
|
5
|
-
) => {
|
|
6
|
-
const nextPosition = position + mediaElementDelay;
|
|
7
|
-
|
|
8
|
-
return { mediaElementDelay, position: nextPosition, velocity: updateVelocity(nextPosition) };
|
|
9
|
-
};
|