timingsrc 1.2.4 → 1.2.5
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/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-current-time.d.ts.map +1 -1
- package/build/es2019/factories/set-current-time.js +4 -1
- package/build/es2019/factories/set-current-time.js.map +1 -1
- package/build/es2019/factories/update-gradually.d.ts.map +1 -1
- package/build/es2019/factories/update-gradually.js +6 -3
- package/build/es2019/factories/update-gradually.js.map +1 -1
- package/build/es2019/factories/update-stepwise-factory.d.ts.map +1 -1
- package/build/es2019/factories/update-stepwise-factory.js +6 -2
- package/build/es2019/factories/update-stepwise-factory.js.map +1 -1
- package/build/es2019/functions/determine-supported-playback-rate-values.d.ts +2 -0
- package/build/es2019/functions/determine-supported-playback-rate-values.d.ts.map +1 -0
- package/build/es2019/functions/determine-supported-playback-rate-values.js +24 -0
- package/build/es2019/functions/determine-supported-playback-rate-values.js.map +1 -0
- package/build/es2019/module.d.ts.map +1 -1
- package/build/es2019/module.js +2 -1
- package/build/es2019/module.js.map +1 -1
- package/build/es2019/types/default-timingsrc-factory.d.ts +2 -1
- package/build/es2019/types/default-timingsrc-factory.d.ts.map +1 -1
- package/build/es2019/types/determine-supported-playback-rate-values-function.d.ts +2 -0
- package/build/es2019/types/determine-supported-playback-rate-values-function.d.ts.map +1 -0
- package/build/es2019/types/determine-supported-playback-rate-values-function.js +2 -0
- package/build/es2019/types/determine-supported-playback-rate-values-function.js.map +1 -0
- package/build/es2019/types/index.d.ts +1 -0
- package/build/es2019/types/index.d.ts.map +1 -1
- package/build/es2019/types/index.js +1 -0
- package/build/es2019/types/index.js.map +1 -1
- package/build/es2019/types/update-gradually-factory.d.ts +2 -1
- package/build/es2019/types/update-gradually-factory.d.ts.map +1 -1
- package/build/es2019/types/window-factory.d.ts +1 -1
- package/build/es2019/types/window-factory.d.ts.map +1 -1
- package/build/es5/bundle.js +53 -16
- package/package.json +9 -9
- package/src/factories/default-set-timingsrc.ts +7 -1
- package/src/factories/set-current-time.ts +6 -1
- package/src/factories/update-gradually.ts +6 -3
- package/src/factories/update-stepwise-factory.ts +8 -2
- package/src/functions/determine-supported-playback-rate-values.ts +26 -0
- package/src/module.ts +2 -0
- package/src/types/default-timingsrc-factory.ts +3 -1
- package/src/types/determine-supported-playback-rate-values-function.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/update-gradually-factory.ts +7 -1
- package/src/types/window-factory.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-set-timingsrc.d.ts","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAyB,MAAM,UAAU,CAAC;AAM9E,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"default-set-timingsrc.d.ts","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAyB,MAAM,UAAU,CAAC;AAM9E,eAAO,MAAM,yBAAyB,EAAE,2BAmB7B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
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 = (createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, window) => window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome')
|
|
4
|
+
export const createDefaultSetTimingsrc = (createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, window) => window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome')
|
|
5
5
|
? (...args) => createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateStepwise(DEFAULT_TOLERANCE))(...args)
|
|
6
|
-
: createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateGradually(DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE));
|
|
6
|
+
: createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateGradually(determineSupportedPlaybackRateValues(window), DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE));
|
|
7
7
|
//# 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":"AAEA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,yBAAyB,GAAgC,CAClE,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oCAAoC,EACpC,MAAM,EACR,EAAE,CACA,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;IAC9G,CAAC,CAAC,CAAC,GAAG,IAAuC,EAAE,EAAE,CAC3C,kBAAkB,CAAC,oCAAoC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChH,CAAC,CAAC,kBAAkB,CACd,oCAAoC,EACpC,qBAAqB,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"default-set-timingsrc.js","sourceRoot":"","sources":["../../../src/factories/default-set-timingsrc.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,yBAAyB,GAAgC,CAClE,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oCAAoC,EACpC,oCAAoC,EACpC,MAAM,EACR,EAAE,CACA,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;IAC9G,CAAC,CAAC,CAAC,GAAG,IAAuC,EAAE,EAAE,CAC3C,kBAAkB,CAAC,oCAAoC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChH,CAAC,CAAC,kBAAkB,CACd,oCAAoC,EACpC,qBAAqB,CACjB,oCAAoC,CAAC,MAAM,CAAC,EAC5C,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,CACpB,CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-current-time.d.ts","sourceRoot":"","sources":["../../../src/factories/set-current-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"set-current-time.d.ts","sourceRoot":"","sources":["../../../src/factories/set-current-time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,oBAAoB,EAAE,sBAelC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export const createSetCurrentTime = (currentTimeAssignments) => {
|
|
2
2
|
return (mediaElement, previousValue, nextValue) => {
|
|
3
3
|
const currentTimeAssignment = currentTimeAssignments.get(mediaElement);
|
|
4
|
-
if (currentTimeAssignment === undefined ||
|
|
4
|
+
if (currentTimeAssignment === undefined ||
|
|
5
|
+
// Bug #5: Safari limits the precision of the value after a while.
|
|
6
|
+
Math.abs(currentTimeAssignment[0] - previousValue) > 0.0001 ||
|
|
7
|
+
currentTimeAssignment[1] !== nextValue) {
|
|
5
8
|
mediaElement.currentTime = nextValue;
|
|
6
9
|
currentTimeAssignments.set(mediaElement, [mediaElement.currentTime, nextValue]);
|
|
7
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-current-time.js","sourceRoot":"","sources":["../../../src/factories/set-current-time.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAA2B,CAAC,sBAAsB,EAAE,EAAE;IACnF,OAAO,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE;QAC9C,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEvE,
|
|
1
|
+
{"version":3,"file":"set-current-time.js","sourceRoot":"","sources":["../../../src/factories/set-current-time.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAA2B,CAAC,sBAAsB,EAAE,EAAE;IACnF,OAAO,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE;QAC9C,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEvE,IACI,qBAAqB,KAAK,SAAS;YACnC,kEAAkE;YAClE,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,GAAG,MAAM;YAC3D,qBAAqB,CAAC,CAAC,CAAC,KAAK,SAAS,EACxC;YACE,YAAY,CAAC,WAAW,GAAG,SAAS,CAAC;YAErC,sBAAsB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;SACnF;IACL,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-gradually.d.ts","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"update-gradually.d.ts","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,qBAAqB,EAAE,uBA0BnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const createUpdateGradually = (timeConstant, threshold, tolerance) => {
|
|
1
|
+
export const createUpdateGradually = ([minValue, maxValue], timeConstant, threshold, tolerance) => {
|
|
2
2
|
return ({ position, velocity }, currentTime) => {
|
|
3
|
-
if (velocity <
|
|
3
|
+
if (velocity < minValue || velocity > maxValue) {
|
|
4
4
|
return { position, velocity: 0 };
|
|
5
5
|
}
|
|
6
6
|
if (position < 0 || velocity === 0) {
|
|
@@ -12,7 +12,10 @@ export const createUpdateGradually = (timeConstant, threshold, tolerance) => {
|
|
|
12
12
|
return { position, velocity };
|
|
13
13
|
}
|
|
14
14
|
if (absolutePositionDifference > tolerance) {
|
|
15
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
position: currentTime,
|
|
17
|
+
velocity: Math.max(minValue, Math.min(maxValue, ((timeConstant - positionDifference) / timeConstant) * velocity))
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
return { position: currentTime, velocity };
|
|
18
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-gradually.js","sourceRoot":"","sources":["../../../src/factories/update-gradually.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAA4B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.d.ts","sourceRoot":"","sources":["../../../src/factories/update-stepwise-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory.d.ts","sourceRoot":"","sources":["../../../src/factories/update-stepwise-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,2BAA2B,EAAE,6BAsDzC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const createUpdateStepwiseFactory = (translateTimingStateVector) => {
|
|
2
2
|
return (tolerance) => {
|
|
3
3
|
let lastMotionUpdate = null;
|
|
4
|
+
let lastPlayheadDifference = 0;
|
|
4
5
|
let mediaElementDelay = 0;
|
|
5
6
|
return (timingStateVector, currentTime) => {
|
|
6
7
|
if (timingStateVector.position < 0 || timingStateVector.velocity === 0) {
|
|
@@ -9,10 +10,12 @@ export const createUpdateStepwiseFactory = (translateTimingStateVector) => {
|
|
|
9
10
|
}
|
|
10
11
|
if (lastMotionUpdate !== null) {
|
|
11
12
|
const playheadDifference = Math.abs(currentTime - lastMotionUpdate.position);
|
|
12
|
-
//
|
|
13
|
-
if (playheadDifference < 0.
|
|
13
|
+
// Bug #4: Safari decreases currentTime after playing for about 200 milliseconds.
|
|
14
|
+
if (lastPlayheadDifference - 0.01 < playheadDifference && lastPlayheadDifference < 0.5) {
|
|
15
|
+
lastPlayheadDifference = playheadDifference;
|
|
14
16
|
return { position: currentTime, velocity: lastMotionUpdate.velocity };
|
|
15
17
|
}
|
|
18
|
+
lastPlayheadDifference = Number.POSITIVE_INFINITY;
|
|
16
19
|
}
|
|
17
20
|
const positionDifference = Math.abs(currentTime - timingStateVector.position);
|
|
18
21
|
if (positionDifference > tolerance) {
|
|
@@ -27,6 +30,7 @@ export const createUpdateStepwiseFactory = (translateTimingStateVector) => {
|
|
|
27
30
|
timestamp: timingStateVector.timestamp,
|
|
28
31
|
velocity: timingStateVector.velocity
|
|
29
32
|
};
|
|
33
|
+
lastPlayheadDifference = 0;
|
|
30
34
|
return { position: positioWithDelay, velocity: timingStateVector.velocity };
|
|
31
35
|
}
|
|
32
36
|
lastMotionUpdate = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-stepwise-factory.js","sourceRoot":"","sources":["../../../src/factories/update-stepwise-factory.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GAAkC,CAAC,0BAA0B,EAAE,EAAE;IACrG,OAAO,CAAC,SAAS,EAAE,EAAE;QACjB,IAAI,gBAAgB,GAAqE,IAAI,CAAC;QAC9F,IAAI,iBAAiB,GAAG,CAAC,CAAC;QAE1B,OAAO,CAAC,iBAAiB,EAAE,WAAW,EAAE,EAAE;YACtC,IAAI,iBAAiB,CAAC,QAAQ,GAAG,CAAC,IAAI,iBAAiB,CAAC,QAAQ,KAAK,CAAC,EAAE;gBACpE,gBAAgB,GAAG,IAAI,CAAC;gBAExB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC;aACzF;YAED,IAAI,gBAAgB,KAAK,IAAI,EAAE;gBAC3B,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;gBAE7E,
|
|
1
|
+
{"version":3,"file":"update-stepwise-factory.js","sourceRoot":"","sources":["../../../src/factories/update-stepwise-factory.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GAAkC,CAAC,0BAA0B,EAAE,EAAE;IACrG,OAAO,CAAC,SAAS,EAAE,EAAE;QACjB,IAAI,gBAAgB,GAAqE,IAAI,CAAC;QAC9F,IAAI,sBAAsB,GAAG,CAAC,CAAC;QAC/B,IAAI,iBAAiB,GAAG,CAA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ExE,gBAAgB,GAAG;oBACf,QAAQ,EAAE,gBAAgB;oBAC1B,SAAS,EAAE,iBAAiB,CAAC,SAAS;oBACtC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;iBACvC,CAAC;gBACF,sBAAsB,GAAG,CAAC,CAAC;gBAE3B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC;aAC/E;YAED,gBAAgB,GAAG,IAAI,CAAC;YAExB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAC3E,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-supported-playback-rate-values.d.ts","sourceRoot":"","sources":["../../../src/functions/determine-supported-playback-rate-values.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oCAAoC,WAAY,IAAI,GAAG,CAAC,MAAM,GAAG,iBAAiB,CAAC,8BAuB/F,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const DEFAULT_VALUES = [Number.MIN_VALUE, Number.MAX_VALUE];
|
|
2
|
+
export const determineSupportedPlaybackRateValues = (window) => {
|
|
3
|
+
if (window === null) {
|
|
4
|
+
return DEFAULT_VALUES;
|
|
5
|
+
}
|
|
6
|
+
const audio = new window.Audio();
|
|
7
|
+
try {
|
|
8
|
+
// Bug #2: Chrome does not support values above 16.
|
|
9
|
+
audio.playbackRate = 17;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// Bug #1: Chrome does not support values below 0.625.
|
|
13
|
+
return [0.625, 16];
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
// Bug #3: Firefox does not support negative values.
|
|
17
|
+
audio.playbackRate = -1;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return [0, DEFAULT_VALUES[1]];
|
|
21
|
+
}
|
|
22
|
+
return DEFAULT_VALUES;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=determine-supported-playback-rate-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-supported-playback-rate-values.js","sourceRoot":"","sources":["../../../src/functions/determine-supported-playback-rate-values.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAU,CAAC;AAErE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,MAA2C,EAAE,EAAE;IAChG,IAAI,MAAM,KAAK,IAAI,EAAE;QACjB,OAAO,cAAc,CAAC;KACzB;IAED,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;IAEjC,IAAI;QACA,mDAAmD;QACnD,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC;KAC3B;IAAC,MAAM;QACJ,sDAAsD;QACtD,OAAO,CAAC,KAAK,EAAE,EAAE,CAAU,CAAC;KAC/B;IAED,IAAI;QACA,oDAAoD;QACpD,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;KAC3B;IAAC,MAAM;QACJ,OAAO,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAU,CAAC;KAC1C;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAKA,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":"AAKA,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,0CAA0D,CAAC;AAI5F,eAAO,MAAM,oCAAoC,iEAKhD,CAAC;AAEF,eAAO,MAAM,YAAY,yCAOxB,CAAC"}
|
package/build/es2019/module.js
CHANGED
|
@@ -9,6 +9,7 @@ import { createUpdateGradually } from './factories/update-gradually';
|
|
|
9
9
|
import { createUpdateMediaElement } from './factories/update-media-element';
|
|
10
10
|
import { createUpdateStepwiseFactory } from './factories/update-stepwise-factory';
|
|
11
11
|
import { createWindow } from './factories/window';
|
|
12
|
+
import { determineSupportedPlaybackRateValues } from './functions/determine-supported-playback-rate-values';
|
|
12
13
|
import { pause } from './functions/pause';
|
|
13
14
|
import { play } from './functions/play';
|
|
14
15
|
export { createSetTimingsrc };
|
|
@@ -16,5 +17,5 @@ export { createUpdateGradually };
|
|
|
16
17
|
export const createUpdateStepwise = createUpdateStepwiseFactory(translateTimingStateVector);
|
|
17
18
|
const updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
18
19
|
export const setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(animationFrame, document, on, updateMediaElement);
|
|
19
|
-
export const setTimingsrc = createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
20
|
+
export const setTimingsrc = createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
20
21
|
//# 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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,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CACjD,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oCAAoC,EACpC,oCAAoC,EACpC,YAAY,EAAE,CACjB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { TDetermineSupportedPlaybackRateValuesFunction } from './determine-supported-playback-rate-values-function';
|
|
1
2
|
import { TSetTimingsrcFactory } from './set-timingsrc-factory';
|
|
2
3
|
import { TSetTimingsrcFunction } from './set-timingsrc-function';
|
|
3
4
|
import { TSetTimingsrcWithCustomUpdateFunctionFunction } from './set-timingsrc-with-custom-update-function-function';
|
|
4
5
|
import { TUpdateGraduallyFactory } from './update-gradually-factory';
|
|
5
6
|
import { TUpdateStepwiseFactory } from './update-stepwise-factory';
|
|
6
|
-
export declare type TDefaultSetTimingsrcFactory = (createSetTimingsrc: TSetTimingsrcFactory, createUpdateGradually: TUpdateGraduallyFactory, createUpdateStepwise: TUpdateStepwiseFactory, setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction, window: null | Window) => TSetTimingsrcFunction;
|
|
7
|
+
export declare type TDefaultSetTimingsrcFactory = (createSetTimingsrc: TSetTimingsrcFactory, createUpdateGradually: TUpdateGraduallyFactory, createUpdateStepwise: TUpdateStepwiseFactory, determineSupportedPlaybackRateValues: TDetermineSupportedPlaybackRateValuesFunction, setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction, window: null | (Window & typeof globalThis)) => TSetTimingsrcFunction;
|
|
7
8
|
//# sourceMappingURL=default-timingsrc-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-timingsrc-factory.d.ts","sourceRoot":"","sources":["../../../src/types/default-timingsrc-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,6CAA6C,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,oBAAY,2BAA2B,GAAG,CACtC,kBAAkB,EAAE,oBAAoB,EACxC,qBAAqB,EAAE,uBAAuB,EAC9C,oBAAoB,EAAE,sBAAsB,EAC5C,oCAAoC,EAAE,6CAA6C,EACnF,MAAM,EAAE,IAAI,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"default-timingsrc-factory.d.ts","sourceRoot":"","sources":["../../../src/types/default-timingsrc-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6CAA6C,EAAE,MAAM,qDAAqD,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,6CAA6C,EAAE,MAAM,sDAAsD,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,oBAAY,2BAA2B,GAAG,CACtC,kBAAkB,EAAE,oBAAoB,EACxC,qBAAqB,EAAE,uBAAuB,EAC9C,oBAAoB,EAAE,sBAAsB,EAC5C,oCAAoC,EAAE,6CAA6C,EACnF,oCAAoC,EAAE,6CAA6C,EACnF,MAAM,EAAE,IAAI,GAAG,CAAC,MAAM,GAAG,OAAO,UAAU,CAAC,KAC1C,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-supported-playback-rate-values-function.d.ts","sourceRoot":"","sources":["../../../src/types/determine-supported-playback-rate-values-function.ts"],"names":[],"mappings":"AAAA,oBAAY,6CAA6C,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,MAAM,GAAG,OAAO,UAAU,CAAC,KAAK,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"determine-supported-playback-rate-values-function.js","sourceRoot":"","sources":["../../../src/types/determine-supported-playback-rate-values-function.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qDAAqD,CAAC;AACpE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qDAAqD,CAAC;AACpE,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TDetermineSupportedPlaybackRateValuesFunction } from './determine-supported-playback-rate-values-function';
|
|
1
2
|
import { TUpdateFunction } from './update-function';
|
|
2
|
-
export declare type TUpdateGraduallyFactory = (timeConstant: number, threshold: number, tolerance: number) => TUpdateFunction;
|
|
3
|
+
export declare type TUpdateGraduallyFactory = (supportedPlaybackRateValues: ReturnType<TDetermineSupportedPlaybackRateValuesFunction>, timeConstant: number, threshold: number, tolerance: number) => TUpdateFunction;
|
|
3
4
|
//# sourceMappingURL=update-gradually-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-gradually-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-gradually-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,uBAAuB,GAAG,CAAC,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"update-gradually-factory.d.ts","sourceRoot":"","sources":["../../../src/types/update-gradually-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6CAA6C,EAAE,MAAM,qDAAqD,CAAC;AACpH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,oBAAY,uBAAuB,GAAG,CAClC,2BAA2B,EAAE,UAAU,CAAC,6CAA6C,CAAC,EACtF,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,KAChB,eAAe,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare type TWindowFactory = () => null | Window;
|
|
1
|
+
export declare type TWindowFactory = () => null | (Window & typeof globalThis);
|
|
2
2
|
//# sourceMappingURL=window-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window-factory.d.ts","sourceRoot":"","sources":["../../../src/types/window-factory.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG,MAAM,IAAI,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"window-factory.d.ts","sourceRoot":"","sources":["../../../src/types/window-factory.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,OAAO,UAAU,CAAC,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('subscribable-things'), require('timing-object'), require('@babel/runtime/helpers/defineProperty')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'subscribable-things', 'timing-object', '@babel/runtime/helpers/defineProperty'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.timingsrc = {}, global.subscribableThings, global.timingObject, global._defineProperty));
|
|
5
|
-
})(this, (function (exports, subscribableThings, timingObject, _defineProperty) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('subscribable-things'), require('timing-object'), require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/defineProperty')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'subscribable-things', 'timing-object', '@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/defineProperty'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.timingsrc = {}, global.subscribableThings, global.timingObject, global._slicedToArray, global._defineProperty));
|
|
5
|
+
})(this, (function (exports, subscribableThings, timingObject, _slicedToArray, _defineProperty) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
9
10
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
10
11
|
|
|
11
12
|
var DEFAULT_THRESHOLD = 1;
|
|
12
13
|
var DEFAULT_TIME_CONSTANT = 0.5;
|
|
13
14
|
var DEFAULT_TOLERANCE = 0.025;
|
|
14
|
-
var createDefaultSetTimingsrc = function createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, window) {
|
|
15
|
+
var createDefaultSetTimingsrc = function createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, window) {
|
|
15
16
|
return window !== null && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') ? function () {
|
|
16
17
|
return createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateStepwise(DEFAULT_TOLERANCE)).apply(void 0, arguments);
|
|
17
|
-
} : createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateGradually(DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE));
|
|
18
|
+
} : createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateGradually(determineSupportedPlaybackRateValues(window), DEFAULT_TIME_CONSTANT, DEFAULT_THRESHOLD, DEFAULT_TOLERANCE));
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
var createSetCurrentTime = function createSetCurrentTime(currentTimeAssignments) {
|
|
21
22
|
return function (mediaElement, previousValue, nextValue) {
|
|
22
23
|
var currentTimeAssignment = currentTimeAssignments.get(mediaElement);
|
|
23
24
|
|
|
24
|
-
if (currentTimeAssignment === undefined ||
|
|
25
|
+
if (currentTimeAssignment === undefined || // Bug #5: Safari limits the precision of the value after a while.
|
|
26
|
+
Math.abs(currentTimeAssignment[0] - previousValue) > 0.0001 || currentTimeAssignment[1] !== nextValue) {
|
|
25
27
|
mediaElement.currentTime = nextValue;
|
|
26
28
|
currentTimeAssignments.set(mediaElement, [mediaElement.currentTime, nextValue]);
|
|
27
29
|
}
|
|
@@ -80,12 +82,16 @@
|
|
|
80
82
|
};
|
|
81
83
|
};
|
|
82
84
|
|
|
83
|
-
var createUpdateGradually = function createUpdateGradually(timeConstant, threshold, tolerance) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
var createUpdateGradually = function createUpdateGradually(_ref, timeConstant, threshold, tolerance) {
|
|
86
|
+
var _ref2 = _slicedToArray__default["default"](_ref, 2),
|
|
87
|
+
minValue = _ref2[0],
|
|
88
|
+
maxValue = _ref2[1];
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
return function (_ref3, currentTime) {
|
|
91
|
+
var position = _ref3.position,
|
|
92
|
+
velocity = _ref3.velocity;
|
|
93
|
+
|
|
94
|
+
if (velocity < minValue || velocity > maxValue) {
|
|
89
95
|
return {
|
|
90
96
|
position: position,
|
|
91
97
|
velocity: 0
|
|
@@ -112,7 +118,7 @@
|
|
|
112
118
|
if (absolutePositionDifference > tolerance) {
|
|
113
119
|
return {
|
|
114
120
|
position: currentTime,
|
|
115
|
-
velocity: Math.max(
|
|
121
|
+
velocity: Math.max(minValue, Math.min(maxValue, (timeConstant - positionDifference) / timeConstant * velocity))
|
|
116
122
|
};
|
|
117
123
|
}
|
|
118
124
|
|
|
@@ -167,6 +173,7 @@
|
|
|
167
173
|
var createUpdateStepwiseFactory = function createUpdateStepwiseFactory(translateTimingStateVector) {
|
|
168
174
|
return function (tolerance) {
|
|
169
175
|
var lastMotionUpdate = null;
|
|
176
|
+
var lastPlayheadDifference = 0;
|
|
170
177
|
var mediaElementDelay = 0;
|
|
171
178
|
return function (timingStateVector, currentTime) {
|
|
172
179
|
if (timingStateVector.position < 0 || timingStateVector.velocity === 0) {
|
|
@@ -178,14 +185,17 @@
|
|
|
178
185
|
}
|
|
179
186
|
|
|
180
187
|
if (lastMotionUpdate !== null) {
|
|
181
|
-
var playheadDifference = Math.abs(currentTime - lastMotionUpdate.position); //
|
|
188
|
+
var playheadDifference = Math.abs(currentTime - lastMotionUpdate.position); // Bug #4: Safari decreases currentTime after playing for about 200 milliseconds.
|
|
182
189
|
|
|
183
|
-
if (playheadDifference < 0.
|
|
190
|
+
if (lastPlayheadDifference - 0.01 < playheadDifference && lastPlayheadDifference < 0.5) {
|
|
191
|
+
lastPlayheadDifference = playheadDifference;
|
|
184
192
|
return {
|
|
185
193
|
position: currentTime,
|
|
186
194
|
velocity: lastMotionUpdate.velocity
|
|
187
195
|
};
|
|
188
196
|
}
|
|
197
|
+
|
|
198
|
+
lastPlayheadDifference = Number.POSITIVE_INFINITY;
|
|
189
199
|
}
|
|
190
200
|
|
|
191
201
|
var positionDifference = Math.abs(currentTime - timingStateVector.position);
|
|
@@ -208,6 +218,7 @@
|
|
|
208
218
|
timestamp: timingStateVector.timestamp,
|
|
209
219
|
velocity: timingStateVector.velocity
|
|
210
220
|
};
|
|
221
|
+
lastPlayheadDifference = 0;
|
|
211
222
|
return {
|
|
212
223
|
position: positioWithDelay,
|
|
213
224
|
velocity: timingStateVector.velocity
|
|
@@ -227,6 +238,32 @@
|
|
|
227
238
|
return typeof window === 'undefined' ? null : window;
|
|
228
239
|
};
|
|
229
240
|
|
|
241
|
+
var DEFAULT_VALUES = [Number.MIN_VALUE, Number.MAX_VALUE];
|
|
242
|
+
var determineSupportedPlaybackRateValues = function determineSupportedPlaybackRateValues(window) {
|
|
243
|
+
if (window === null) {
|
|
244
|
+
return DEFAULT_VALUES;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
var audio = new window.Audio();
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
// Bug #2: Chrome does not support values above 16.
|
|
251
|
+
audio.playbackRate = 17;
|
|
252
|
+
} catch (_unused) {
|
|
253
|
+
// Bug #1: Chrome does not support values below 0.625.
|
|
254
|
+
return [0.625, 16];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
// Bug #3: Firefox does not support negative values.
|
|
259
|
+
audio.playbackRate = -1;
|
|
260
|
+
} catch (_unused2) {
|
|
261
|
+
return [0, DEFAULT_VALUES[1]];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return DEFAULT_VALUES;
|
|
265
|
+
};
|
|
266
|
+
|
|
230
267
|
var pause = function pause(mediaElement) {
|
|
231
268
|
if (!mediaElement.paused) {
|
|
232
269
|
mediaElement.pause();
|
|
@@ -244,7 +281,7 @@
|
|
|
244
281
|
var createUpdateStepwise = createUpdateStepwiseFactory(timingObject.translateTimingStateVector);
|
|
245
282
|
var updateMediaElement = createUpdateMediaElement(pause, play, createSetCurrentTime(new WeakMap()), createSetPlaybackRate(new WeakMap()));
|
|
246
283
|
var setTimingsrcWithCustomUpdateFunction = createSetTimingsrcWithCustomUpdateFunction(subscribableThings.animationFrame, document, subscribableThings.on, updateMediaElement);
|
|
247
|
-
var setTimingsrc = createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
284
|
+
var setTimingsrc = createDefaultSetTimingsrc(createSetTimingsrc, createUpdateGradually, createUpdateStepwise, determineSupportedPlaybackRateValues, setTimingsrcWithCustomUpdateFunction, createWindow());
|
|
248
285
|
|
|
249
286
|
exports.createSetTimingsrc = createSetTimingsrc;
|
|
250
287
|
exports.createUpdateGradually = createUpdateGradually;
|
package/package.json
CHANGED
|
@@ -16,18 +16,18 @@
|
|
|
16
16
|
},
|
|
17
17
|
"description": "A library to synchronize a MediaElement with a TimingObject.",
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@babel/core": "^7.18.
|
|
19
|
+
"@babel/core": "^7.18.13",
|
|
20
20
|
"@babel/plugin-external-helpers": "^7.18.6",
|
|
21
21
|
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
22
22
|
"@babel/preset-env": "^7.18.10",
|
|
23
|
-
"@commitlint/cli": "^17.
|
|
24
|
-
"@commitlint/config-angular": "^17.0
|
|
23
|
+
"@commitlint/cli": "^17.1.1",
|
|
24
|
+
"@commitlint/config-angular": "^17.1.0",
|
|
25
25
|
"@rollup/plugin-babel": "^5.3.1",
|
|
26
26
|
"chai": "^4.3.6",
|
|
27
27
|
"commitizen": "^4.2.5",
|
|
28
28
|
"cz-conventional-changelog": "^3.3.0",
|
|
29
|
-
"eslint": "^8.
|
|
30
|
-
"eslint-config-holy-grail": "^52.0.
|
|
29
|
+
"eslint": "^8.23.0",
|
|
30
|
+
"eslint-config-holy-grail": "^52.0.29",
|
|
31
31
|
"grunt": "^1.5.3",
|
|
32
32
|
"grunt-cli": "^1.4.3",
|
|
33
33
|
"grunt-sh": "^0.2.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"prettier": "^2.7.1",
|
|
46
46
|
"pretty-quick": "^3.1.3",
|
|
47
47
|
"rimraf": "^3.0.2",
|
|
48
|
-
"rollup": "^2.
|
|
48
|
+
"rollup": "^2.78.1",
|
|
49
49
|
"sinon": "^14.0.0",
|
|
50
50
|
"sinon-chai": "^3.7.0",
|
|
51
51
|
"ts-loader": "^9.3.1",
|
|
52
52
|
"tsconfig-holy-grail": "^11.1.34",
|
|
53
53
|
"tslint": "^6.1.3",
|
|
54
|
-
"tslint-config-holy-grail": "^53.2.
|
|
55
|
-
"typescript": "^4.
|
|
54
|
+
"tslint-config-holy-grail": "^53.2.31",
|
|
55
|
+
"typescript": "^4.8.2",
|
|
56
56
|
"webpack": "^5.74.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.5"
|
|
79
79
|
}
|
|
@@ -8,6 +8,7 @@ export const createDefaultSetTimingsrc: TDefaultSetTimingsrcFactory = (
|
|
|
8
8
|
createSetTimingsrc,
|
|
9
9
|
createUpdateGradually,
|
|
10
10
|
createUpdateStepwise,
|
|
11
|
+
determineSupportedPlaybackRateValues,
|
|
11
12
|
setTimingsrcWithCustomUpdateFunction,
|
|
12
13
|
window
|
|
13
14
|
) =>
|
|
@@ -16,5 +17,10 @@ export const createDefaultSetTimingsrc: TDefaultSetTimingsrcFactory = (
|
|
|
16
17
|
createSetTimingsrc(setTimingsrcWithCustomUpdateFunction, createUpdateStepwise(DEFAULT_TOLERANCE))(...args)
|
|
17
18
|
: createSetTimingsrc(
|
|
18
19
|
setTimingsrcWithCustomUpdateFunction,
|
|
19
|
-
createUpdateGradually(
|
|
20
|
+
createUpdateGradually(
|
|
21
|
+
determineSupportedPlaybackRateValues(window),
|
|
22
|
+
DEFAULT_TIME_CONSTANT,
|
|
23
|
+
DEFAULT_THRESHOLD,
|
|
24
|
+
DEFAULT_TOLERANCE
|
|
25
|
+
)
|
|
20
26
|
);
|
|
@@ -4,7 +4,12 @@ export const createSetCurrentTime: TSetCurrentTimeFactory = (currentTimeAssignme
|
|
|
4
4
|
return (mediaElement, previousValue, nextValue) => {
|
|
5
5
|
const currentTimeAssignment = currentTimeAssignments.get(mediaElement);
|
|
6
6
|
|
|
7
|
-
if (
|
|
7
|
+
if (
|
|
8
|
+
currentTimeAssignment === undefined ||
|
|
9
|
+
// Bug #5: Safari limits the precision of the value after a while.
|
|
10
|
+
Math.abs(currentTimeAssignment[0] - previousValue) > 0.0001 ||
|
|
11
|
+
currentTimeAssignment[1] !== nextValue
|
|
12
|
+
) {
|
|
8
13
|
mediaElement.currentTime = nextValue;
|
|
9
14
|
|
|
10
15
|
currentTimeAssignments.set(mediaElement, [mediaElement.currentTime, nextValue]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TUpdateGraduallyFactory } from '../types';
|
|
2
2
|
|
|
3
|
-
export const createUpdateGradually: TUpdateGraduallyFactory = (timeConstant, threshold, tolerance) => {
|
|
3
|
+
export const createUpdateGradually: TUpdateGraduallyFactory = ([minValue, maxValue], timeConstant, threshold, tolerance) => {
|
|
4
4
|
return ({ position, velocity }, currentTime) => {
|
|
5
|
-
if (velocity <
|
|
5
|
+
if (velocity < minValue || velocity > maxValue) {
|
|
6
6
|
return { position, velocity: 0 };
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -18,7 +18,10 @@ export const createUpdateGradually: TUpdateGraduallyFactory = (timeConstant, thr
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (absolutePositionDifference > tolerance) {
|
|
21
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
position: currentTime,
|
|
23
|
+
velocity: Math.max(minValue, Math.min(maxValue, ((timeConstant - positionDifference) / timeConstant) * velocity))
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
return { position: currentTime, velocity };
|
|
@@ -3,6 +3,7 @@ import { TUpdateStepwiseFactoryFactory } from '../types';
|
|
|
3
3
|
export const createUpdateStepwiseFactory: TUpdateStepwiseFactoryFactory = (translateTimingStateVector) => {
|
|
4
4
|
return (tolerance) => {
|
|
5
5
|
let lastMotionUpdate: null | { position: number; timestamp: number; velocity: number } = null;
|
|
6
|
+
let lastPlayheadDifference = 0;
|
|
6
7
|
let mediaElementDelay = 0;
|
|
7
8
|
|
|
8
9
|
return (timingStateVector, currentTime) => {
|
|
@@ -15,10 +16,14 @@ export const createUpdateStepwiseFactory: TUpdateStepwiseFactoryFactory = (trans
|
|
|
15
16
|
if (lastMotionUpdate !== null) {
|
|
16
17
|
const playheadDifference = Math.abs(currentTime - lastMotionUpdate.position);
|
|
17
18
|
|
|
18
|
-
//
|
|
19
|
-
if (playheadDifference < 0.
|
|
19
|
+
// Bug #4: Safari decreases currentTime after playing for about 200 milliseconds.
|
|
20
|
+
if (lastPlayheadDifference - 0.01 < playheadDifference && lastPlayheadDifference < 0.5) {
|
|
21
|
+
lastPlayheadDifference = playheadDifference;
|
|
22
|
+
|
|
20
23
|
return { position: currentTime, velocity: lastMotionUpdate.velocity };
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
lastPlayheadDifference = Number.POSITIVE_INFINITY;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
const positionDifference = Math.abs(currentTime - timingStateVector.position);
|
|
@@ -39,6 +44,7 @@ export const createUpdateStepwiseFactory: TUpdateStepwiseFactoryFactory = (trans
|
|
|
39
44
|
timestamp: timingStateVector.timestamp,
|
|
40
45
|
velocity: timingStateVector.velocity
|
|
41
46
|
};
|
|
47
|
+
lastPlayheadDifference = 0;
|
|
42
48
|
|
|
43
49
|
return { position: positioWithDelay, velocity: timingStateVector.velocity };
|
|
44
50
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const DEFAULT_VALUES = [Number.MIN_VALUE, Number.MAX_VALUE] as const;
|
|
2
|
+
|
|
3
|
+
export const determineSupportedPlaybackRateValues = (window: null | (Window & typeof globalThis)) => {
|
|
4
|
+
if (window === null) {
|
|
5
|
+
return DEFAULT_VALUES;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const audio = new window.Audio();
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
// Bug #2: Chrome does not support values above 16.
|
|
12
|
+
audio.playbackRate = 17;
|
|
13
|
+
} catch {
|
|
14
|
+
// Bug #1: Chrome does not support values below 0.625.
|
|
15
|
+
return [0.625, 16] as const;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// Bug #3: Firefox does not support negative values.
|
|
20
|
+
audio.playbackRate = -1;
|
|
21
|
+
} catch {
|
|
22
|
+
return [0, DEFAULT_VALUES[1]] as const;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return DEFAULT_VALUES;
|
|
26
|
+
};
|
package/src/module.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { createUpdateGradually } from './factories/update-gradually';
|
|
|
9
9
|
import { createUpdateMediaElement } from './factories/update-media-element';
|
|
10
10
|
import { createUpdateStepwiseFactory } from './factories/update-stepwise-factory';
|
|
11
11
|
import { createWindow } from './factories/window';
|
|
12
|
+
import { determineSupportedPlaybackRateValues } from './functions/determine-supported-playback-rate-values';
|
|
12
13
|
import { pause } from './functions/pause';
|
|
13
14
|
import { play } from './functions/play';
|
|
14
15
|
|
|
@@ -31,6 +32,7 @@ export const setTimingsrc = createDefaultSetTimingsrc(
|
|
|
31
32
|
createSetTimingsrc,
|
|
32
33
|
createUpdateGradually,
|
|
33
34
|
createUpdateStepwise,
|
|
35
|
+
determineSupportedPlaybackRateValues,
|
|
34
36
|
setTimingsrcWithCustomUpdateFunction,
|
|
35
37
|
createWindow()
|
|
36
38
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TDetermineSupportedPlaybackRateValuesFunction } from './determine-supported-playback-rate-values-function';
|
|
1
2
|
import { TSetTimingsrcFactory } from './set-timingsrc-factory';
|
|
2
3
|
import { TSetTimingsrcFunction } from './set-timingsrc-function';
|
|
3
4
|
import { TSetTimingsrcWithCustomUpdateFunctionFunction } from './set-timingsrc-with-custom-update-function-function';
|
|
@@ -8,6 +9,7 @@ export type TDefaultSetTimingsrcFactory = (
|
|
|
8
9
|
createSetTimingsrc: TSetTimingsrcFactory,
|
|
9
10
|
createUpdateGradually: TUpdateGraduallyFactory,
|
|
10
11
|
createUpdateStepwise: TUpdateStepwiseFactory,
|
|
12
|
+
determineSupportedPlaybackRateValues: TDetermineSupportedPlaybackRateValuesFunction,
|
|
11
13
|
setTimingsrcWithCustomUpdateFunction: TSetTimingsrcWithCustomUpdateFunctionFunction,
|
|
12
|
-
window: null | Window
|
|
14
|
+
window: null | (Window & typeof globalThis)
|
|
13
15
|
) => TSetTimingsrcFunction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TDetermineSupportedPlaybackRateValuesFunction = (window: null | (Window & typeof globalThis)) => readonly [number, number];
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { TDetermineSupportedPlaybackRateValuesFunction } from './determine-supported-playback-rate-values-function';
|
|
1
2
|
import { TUpdateFunction } from './update-function';
|
|
2
3
|
|
|
3
|
-
export type TUpdateGraduallyFactory = (
|
|
4
|
+
export type TUpdateGraduallyFactory = (
|
|
5
|
+
supportedPlaybackRateValues: ReturnType<TDetermineSupportedPlaybackRateValuesFunction>,
|
|
6
|
+
timeConstant: number,
|
|
7
|
+
threshold: number,
|
|
8
|
+
tolerance: number
|
|
9
|
+
) => TUpdateFunction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TWindowFactory = () => null | Window;
|
|
1
|
+
export type TWindowFactory = () => null | (Window & typeof globalThis);
|